// 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_f64_2d;
struct futhark_f64_2d *futhark_new_f64_2d(struct futhark_context *ctx, const
                                          double *data, int64_t dim0,
                                          int64_t dim1);
struct futhark_f64_2d *futhark_new_raw_f64_2d(struct futhark_context *ctx, const
                                              unsigned char *data,
                                              int64_t offset, int64_t dim0,
                                              int64_t dim1);
int futhark_free_f64_2d(struct futhark_context *ctx,
                        struct futhark_f64_2d *arr);
int futhark_values_f64_2d(struct futhark_context *ctx,
                          struct futhark_f64_2d *arr, double *data);
unsigned char *futhark_values_raw_f64_2d(struct futhark_context *ctx,
                                         struct futhark_f64_2d *arr);
const int64_t *futhark_shape_f64_2d(struct futhark_context *ctx,
                                    struct futhark_f64_2d *arr);

// Opaque values


// Entry points
int futhark_entry_main(struct futhark_context *ctx,
                       struct futhark_f64_2d **out0,
                       struct futhark_f64_2d **out1,
                       struct futhark_f64_2d **out2, const
                       struct futhark_f64_2d *in0, const int64_t in1, const
                       int64_t in2, const int64_t in3, const int64_t in4, const
                       int64_t in5, const int64_t in6, const int64_t in7, const
                       int64_t in8, const int64_t in9, const int64_t in10, const
                       int64_t in11, const int64_t in12, const int64_t in13,
                       const int64_t in14);

// 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_segred_stage_1_parloop_235420_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235420_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235420_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235420_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235420_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235420_total_iter;
    int64_t *futhark_mc_segred_task_235417_total_runtime;
    int *futhark_mc_segred_task_235417_runs;
    int64_t *futhark_mc_segred_task_235417_iter;
    int64_t futhark_mc_segred_task_235417_total_time;
    int64_t futhark_mc_segred_task_235417_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235429_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235429_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235429_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235429_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235429_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235429_total_iter;
    int64_t *futhark_mc_segred_task_235426_total_runtime;
    int *futhark_mc_segred_task_235426_runs;
    int64_t *futhark_mc_segred_task_235426_iter;
    int64_t futhark_mc_segred_task_235426_total_time;
    int64_t futhark_mc_segred_task_235426_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235424_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235424_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235424_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235424_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235424_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235424_total_iter;
    int64_t *futhark_mc_segred_nested_task_235421_total_runtime;
    int *futhark_mc_segred_nested_task_235421_runs;
    int64_t *futhark_mc_segred_nested_task_235421_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_235415_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_235415_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_235415_iter;
    int64_t futhark_mc_scan_stage_1_parloop_235415_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_235415_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_235415_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235434_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235434_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235434_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235434_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235434_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235434_total_iter;
    int64_t *futhark_mc_segred_task_235431_total_runtime;
    int *futhark_mc_segred_task_235431_runs;
    int64_t *futhark_mc_segred_task_235431_iter;
    int64_t futhark_mc_segred_task_235431_total_time;
    int64_t futhark_mc_segred_task_235431_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235443_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235443_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235443_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235443_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235443_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235443_total_iter;
    int64_t *futhark_mc_segred_task_235440_total_runtime;
    int *futhark_mc_segred_task_235440_runs;
    int64_t *futhark_mc_segred_task_235440_iter;
    int64_t futhark_mc_segred_task_235440_total_time;
    int64_t futhark_mc_segred_task_235440_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235438_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235438_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235438_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235438_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235438_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235438_total_iter;
    int64_t *futhark_mc_segred_nested_task_235435_total_runtime;
    int *futhark_mc_segred_nested_task_235435_runs;
    int64_t *futhark_mc_segred_nested_task_235435_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235450_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235450_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235450_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235450_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235450_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235450_total_iter;
    int64_t *futhark_mc_segred_task_235447_total_runtime;
    int *futhark_mc_segred_task_235447_runs;
    int64_t *futhark_mc_segred_task_235447_iter;
    int64_t futhark_mc_segred_task_235447_total_time;
    int64_t futhark_mc_segred_task_235447_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235459_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235459_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235459_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235459_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235459_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235459_total_iter;
    int64_t *futhark_mc_segred_task_235456_total_runtime;
    int *futhark_mc_segred_task_235456_runs;
    int64_t *futhark_mc_segred_task_235456_iter;
    int64_t futhark_mc_segred_task_235456_total_time;
    int64_t futhark_mc_segred_task_235456_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235454_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235454_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235454_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235454_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235454_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235454_total_iter;
    int64_t *futhark_mc_segred_nested_task_235451_total_runtime;
    int *futhark_mc_segred_nested_task_235451_runs;
    int64_t *futhark_mc_segred_nested_task_235451_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_235445_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_235445_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_235445_iter;
    int64_t futhark_mc_scan_stage_3_parloop_235445_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_235445_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_235445_total_iter;
    int64_t *futhark_mc_segscan_task_235412_total_runtime;
    int *futhark_mc_segscan_task_235412_runs;
    int64_t *futhark_mc_segscan_task_235412_iter;
    int64_t futhark_mc_segscan_task_235412_total_time;
    int64_t futhark_mc_segscan_task_235412_total_iter;
    int64_t *futhark_mc_segmap_parloop_235463_total_runtime;
    int *futhark_mc_segmap_parloop_235463_runs;
    int64_t *futhark_mc_segmap_parloop_235463_iter;
    int64_t futhark_mc_segmap_parloop_235463_total_total_runtime;
    int futhark_mc_segmap_parloop_235463_total_runs;
    int64_t futhark_mc_segmap_parloop_235463_total_iter;
    int64_t *futhark_mc_segmap_task_235461_total_runtime;
    int *futhark_mc_segmap_task_235461_runs;
    int64_t *futhark_mc_segmap_task_235461_iter;
    int64_t futhark_mc_segmap_task_235461_total_time;
    int64_t futhark_mc_segmap_task_235461_total_iter;
    int64_t *futhark_mc_segmap_parloop_235467_total_runtime;
    int *futhark_mc_segmap_parloop_235467_runs;
    int64_t *futhark_mc_segmap_parloop_235467_iter;
    int64_t futhark_mc_segmap_parloop_235467_total_total_runtime;
    int futhark_mc_segmap_parloop_235467_total_runs;
    int64_t futhark_mc_segmap_parloop_235467_total_iter;
    int64_t *futhark_mc_segmap_task_235465_total_runtime;
    int *futhark_mc_segmap_task_235465_runs;
    int64_t *futhark_mc_segmap_task_235465_iter;
    int64_t futhark_mc_segmap_task_235465_total_time;
    int64_t futhark_mc_segmap_task_235465_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_235479_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_235479_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_235479_iter;
    int64_t futhark_mc_scan_stage_1_parloop_235479_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_235479_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_235479_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_235481_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_235481_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_235481_iter;
    int64_t futhark_mc_scan_stage_3_parloop_235481_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_235481_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_235481_total_iter;
    int64_t *futhark_mc_segscan_task_235476_total_runtime;
    int *futhark_mc_segscan_task_235476_runs;
    int64_t *futhark_mc_segscan_task_235476_iter;
    int64_t futhark_mc_segscan_task_235476_total_time;
    int64_t futhark_mc_segscan_task_235476_total_iter;
    int64_t *futhark_mc_segmap_parloop_235485_total_runtime;
    int *futhark_mc_segmap_parloop_235485_runs;
    int64_t *futhark_mc_segmap_parloop_235485_iter;
    int64_t futhark_mc_segmap_parloop_235485_total_total_runtime;
    int futhark_mc_segmap_parloop_235485_total_runs;
    int64_t futhark_mc_segmap_parloop_235485_total_iter;
    int64_t *futhark_mc_segmap_task_235483_total_runtime;
    int *futhark_mc_segmap_task_235483_runs;
    int64_t *futhark_mc_segmap_task_235483_iter;
    int64_t futhark_mc_segmap_task_235483_total_time;
    int64_t futhark_mc_segmap_task_235483_total_iter;
    int64_t *futhark_mc_segmap_parloop_235472_total_runtime;
    int *futhark_mc_segmap_parloop_235472_runs;
    int64_t *futhark_mc_segmap_parloop_235472_iter;
    int64_t futhark_mc_segmap_parloop_235472_total_total_runtime;
    int futhark_mc_segmap_parloop_235472_total_runs;
    int64_t futhark_mc_segmap_parloop_235472_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235470_total_runtime;
    int *futhark_mc_segmap_nested_task_235470_runs;
    int64_t *futhark_mc_segmap_nested_task_235470_iter;
    int64_t *futhark_mc_segmap_parloop_235489_total_runtime;
    int *futhark_mc_segmap_parloop_235489_runs;
    int64_t *futhark_mc_segmap_parloop_235489_iter;
    int64_t futhark_mc_segmap_parloop_235489_total_total_runtime;
    int futhark_mc_segmap_parloop_235489_total_runs;
    int64_t futhark_mc_segmap_parloop_235489_total_iter;
    int64_t *futhark_mc_segmap_task_235487_total_runtime;
    int *futhark_mc_segmap_task_235487_runs;
    int64_t *futhark_mc_segmap_task_235487_iter;
    int64_t futhark_mc_segmap_task_235487_total_time;
    int64_t futhark_mc_segmap_task_235487_total_iter;
    int64_t *futhark_mc_segmap_parloop_235498_total_runtime;
    int *futhark_mc_segmap_parloop_235498_runs;
    int64_t *futhark_mc_segmap_parloop_235498_iter;
    int64_t futhark_mc_segmap_parloop_235498_total_total_runtime;
    int futhark_mc_segmap_parloop_235498_total_runs;
    int64_t futhark_mc_segmap_parloop_235498_total_iter;
    int64_t *futhark_mc_segmap_task_235496_total_runtime;
    int *futhark_mc_segmap_task_235496_runs;
    int64_t *futhark_mc_segmap_task_235496_iter;
    int64_t futhark_mc_segmap_task_235496_total_time;
    int64_t futhark_mc_segmap_task_235496_total_iter;
    int64_t *futhark_mc_segmap_parloop_235507_total_runtime;
    int *futhark_mc_segmap_parloop_235507_runs;
    int64_t *futhark_mc_segmap_parloop_235507_iter;
    int64_t futhark_mc_segmap_parloop_235507_total_total_runtime;
    int futhark_mc_segmap_parloop_235507_total_runs;
    int64_t futhark_mc_segmap_parloop_235507_total_iter;
    int64_t *futhark_mc_segmap_task_235505_total_runtime;
    int *futhark_mc_segmap_task_235505_runs;
    int64_t *futhark_mc_segmap_task_235505_iter;
    int64_t futhark_mc_segmap_task_235505_total_time;
    int64_t futhark_mc_segmap_task_235505_total_iter;
    int64_t *futhark_mc_segmap_parloop_235502_total_runtime;
    int *futhark_mc_segmap_parloop_235502_runs;
    int64_t *futhark_mc_segmap_parloop_235502_iter;
    int64_t futhark_mc_segmap_parloop_235502_total_total_runtime;
    int futhark_mc_segmap_parloop_235502_total_runs;
    int64_t futhark_mc_segmap_parloop_235502_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235500_total_runtime;
    int *futhark_mc_segmap_nested_task_235500_runs;
    int64_t *futhark_mc_segmap_nested_task_235500_iter;
    int64_t *futhark_mc_segmap_parloop_235493_total_runtime;
    int *futhark_mc_segmap_parloop_235493_runs;
    int64_t *futhark_mc_segmap_parloop_235493_iter;
    int64_t futhark_mc_segmap_parloop_235493_total_total_runtime;
    int futhark_mc_segmap_parloop_235493_total_runs;
    int64_t futhark_mc_segmap_parloop_235493_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235491_total_runtime;
    int *futhark_mc_segmap_nested_task_235491_runs;
    int64_t *futhark_mc_segmap_nested_task_235491_iter;
    int64_t *futhark_mc_segmap_parloop_235511_total_runtime;
    int *futhark_mc_segmap_parloop_235511_runs;
    int64_t *futhark_mc_segmap_parloop_235511_iter;
    int64_t futhark_mc_segmap_parloop_235511_total_total_runtime;
    int futhark_mc_segmap_parloop_235511_total_runs;
    int64_t futhark_mc_segmap_parloop_235511_total_iter;
    int64_t *futhark_mc_segmap_task_235509_total_runtime;
    int *futhark_mc_segmap_task_235509_runs;
    int64_t *futhark_mc_segmap_task_235509_iter;
    int64_t futhark_mc_segmap_task_235509_total_time;
    int64_t futhark_mc_segmap_task_235509_total_iter;
    int64_t *futhark_mc_segmap_parloop_235524_total_runtime;
    int *futhark_mc_segmap_parloop_235524_runs;
    int64_t *futhark_mc_segmap_parloop_235524_iter;
    int64_t futhark_mc_segmap_parloop_235524_total_total_runtime;
    int futhark_mc_segmap_parloop_235524_total_runs;
    int64_t futhark_mc_segmap_parloop_235524_total_iter;
    int64_t *futhark_mc_segmap_task_235522_total_runtime;
    int *futhark_mc_segmap_task_235522_runs;
    int64_t *futhark_mc_segmap_task_235522_iter;
    int64_t futhark_mc_segmap_task_235522_total_time;
    int64_t futhark_mc_segmap_task_235522_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_235536_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_235536_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_235536_iter;
    int64_t futhark_mc_scan_stage_1_parloop_235536_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_235536_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_235536_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_235538_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_235538_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_235538_iter;
    int64_t futhark_mc_scan_stage_3_parloop_235538_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_235538_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_235538_total_iter;
    int64_t *futhark_mc_segscan_task_235533_total_runtime;
    int *futhark_mc_segscan_task_235533_runs;
    int64_t *futhark_mc_segscan_task_235533_iter;
    int64_t futhark_mc_segscan_task_235533_total_time;
    int64_t futhark_mc_segscan_task_235533_total_iter;
    int64_t *futhark_mc_segmap_parloop_235542_total_runtime;
    int *futhark_mc_segmap_parloop_235542_runs;
    int64_t *futhark_mc_segmap_parloop_235542_iter;
    int64_t futhark_mc_segmap_parloop_235542_total_total_runtime;
    int futhark_mc_segmap_parloop_235542_total_runs;
    int64_t futhark_mc_segmap_parloop_235542_total_iter;
    int64_t *futhark_mc_segmap_task_235540_total_runtime;
    int *futhark_mc_segmap_task_235540_runs;
    int64_t *futhark_mc_segmap_task_235540_iter;
    int64_t futhark_mc_segmap_task_235540_total_time;
    int64_t futhark_mc_segmap_task_235540_total_iter;
    int64_t *futhark_mc_segmap_parloop_235529_total_runtime;
    int *futhark_mc_segmap_parloop_235529_runs;
    int64_t *futhark_mc_segmap_parloop_235529_iter;
    int64_t futhark_mc_segmap_parloop_235529_total_total_runtime;
    int futhark_mc_segmap_parloop_235529_total_runs;
    int64_t futhark_mc_segmap_parloop_235529_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235527_total_runtime;
    int *futhark_mc_segmap_nested_task_235527_runs;
    int64_t *futhark_mc_segmap_nested_task_235527_iter;
    int64_t *futhark_mc_segmap_parloop_235518_total_runtime;
    int *futhark_mc_segmap_parloop_235518_runs;
    int64_t *futhark_mc_segmap_parloop_235518_iter;
    int64_t futhark_mc_segmap_parloop_235518_total_total_runtime;
    int futhark_mc_segmap_parloop_235518_total_runs;
    int64_t futhark_mc_segmap_parloop_235518_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235516_total_runtime;
    int *futhark_mc_segmap_nested_task_235516_runs;
    int64_t *futhark_mc_segmap_nested_task_235516_iter;
    int64_t *futhark_mc_segmap_parloop_235546_total_runtime;
    int *futhark_mc_segmap_parloop_235546_runs;
    int64_t *futhark_mc_segmap_parloop_235546_iter;
    int64_t futhark_mc_segmap_parloop_235546_total_total_runtime;
    int futhark_mc_segmap_parloop_235546_total_runs;
    int64_t futhark_mc_segmap_parloop_235546_total_iter;
    int64_t *futhark_mc_segmap_task_235544_total_runtime;
    int *futhark_mc_segmap_task_235544_runs;
    int64_t *futhark_mc_segmap_task_235544_iter;
    int64_t futhark_mc_segmap_task_235544_total_time;
    int64_t futhark_mc_segmap_task_235544_total_iter;
    int64_t *futhark_mc_segmap_parloop_235558_total_runtime;
    int *futhark_mc_segmap_parloop_235558_runs;
    int64_t *futhark_mc_segmap_parloop_235558_iter;
    int64_t futhark_mc_segmap_parloop_235558_total_total_runtime;
    int futhark_mc_segmap_parloop_235558_total_runs;
    int64_t futhark_mc_segmap_parloop_235558_total_iter;
    int64_t *futhark_mc_segmap_task_235556_total_runtime;
    int *futhark_mc_segmap_task_235556_runs;
    int64_t *futhark_mc_segmap_task_235556_iter;
    int64_t futhark_mc_segmap_task_235556_total_time;
    int64_t futhark_mc_segmap_task_235556_total_iter;
    int64_t *futhark_mc_segmap_parloop_235571_total_runtime;
    int *futhark_mc_segmap_parloop_235571_runs;
    int64_t *futhark_mc_segmap_parloop_235571_iter;
    int64_t futhark_mc_segmap_parloop_235571_total_total_runtime;
    int futhark_mc_segmap_parloop_235571_total_runs;
    int64_t futhark_mc_segmap_parloop_235571_total_iter;
    int64_t *futhark_mc_segmap_task_235569_total_runtime;
    int *futhark_mc_segmap_task_235569_runs;
    int64_t *futhark_mc_segmap_task_235569_iter;
    int64_t futhark_mc_segmap_task_235569_total_time;
    int64_t futhark_mc_segmap_task_235569_total_iter;
    int64_t *futhark_mc_segmap_parloop_235575_total_runtime;
    int *futhark_mc_segmap_parloop_235575_runs;
    int64_t *futhark_mc_segmap_parloop_235575_iter;
    int64_t futhark_mc_segmap_parloop_235575_total_total_runtime;
    int futhark_mc_segmap_parloop_235575_total_runs;
    int64_t futhark_mc_segmap_parloop_235575_total_iter;
    int64_t *futhark_mc_segmap_task_235573_total_runtime;
    int *futhark_mc_segmap_task_235573_runs;
    int64_t *futhark_mc_segmap_task_235573_iter;
    int64_t futhark_mc_segmap_task_235573_total_time;
    int64_t futhark_mc_segmap_task_235573_total_iter;
    int64_t *futhark_mc_segmap_parloop_235564_total_runtime;
    int *futhark_mc_segmap_parloop_235564_runs;
    int64_t *futhark_mc_segmap_parloop_235564_iter;
    int64_t futhark_mc_segmap_parloop_235564_total_total_runtime;
    int futhark_mc_segmap_parloop_235564_total_runs;
    int64_t futhark_mc_segmap_parloop_235564_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235562_total_runtime;
    int *futhark_mc_segmap_nested_task_235562_runs;
    int64_t *futhark_mc_segmap_nested_task_235562_iter;
    int64_t *futhark_mc_segmap_parloop_235552_total_runtime;
    int *futhark_mc_segmap_parloop_235552_runs;
    int64_t *futhark_mc_segmap_parloop_235552_iter;
    int64_t futhark_mc_segmap_parloop_235552_total_total_runtime;
    int futhark_mc_segmap_parloop_235552_total_runs;
    int64_t futhark_mc_segmap_parloop_235552_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235550_total_runtime;
    int *futhark_mc_segmap_nested_task_235550_runs;
    int64_t *futhark_mc_segmap_nested_task_235550_iter;
    int64_t *futhark_mc_segmap_parloop_235579_total_runtime;
    int *futhark_mc_segmap_parloop_235579_runs;
    int64_t *futhark_mc_segmap_parloop_235579_iter;
    int64_t futhark_mc_segmap_parloop_235579_total_total_runtime;
    int futhark_mc_segmap_parloop_235579_total_runs;
    int64_t futhark_mc_segmap_parloop_235579_total_iter;
    int64_t *futhark_mc_segmap_task_235577_total_runtime;
    int *futhark_mc_segmap_task_235577_runs;
    int64_t *futhark_mc_segmap_task_235577_iter;
    int64_t futhark_mc_segmap_task_235577_total_time;
    int64_t futhark_mc_segmap_task_235577_total_iter;
    int64_t *futhark_mc_segmap_parloop_235592_total_runtime;
    int *futhark_mc_segmap_parloop_235592_runs;
    int64_t *futhark_mc_segmap_parloop_235592_iter;
    int64_t futhark_mc_segmap_parloop_235592_total_total_runtime;
    int futhark_mc_segmap_parloop_235592_total_runs;
    int64_t futhark_mc_segmap_parloop_235592_total_iter;
    int64_t *futhark_mc_segmap_task_235590_total_runtime;
    int *futhark_mc_segmap_task_235590_runs;
    int64_t *futhark_mc_segmap_task_235590_iter;
    int64_t futhark_mc_segmap_task_235590_total_time;
    int64_t futhark_mc_segmap_task_235590_total_iter;
    int64_t *futhark_mc_segmap_parloop_235596_total_runtime;
    int *futhark_mc_segmap_parloop_235596_runs;
    int64_t *futhark_mc_segmap_parloop_235596_iter;
    int64_t futhark_mc_segmap_parloop_235596_total_total_runtime;
    int futhark_mc_segmap_parloop_235596_total_runs;
    int64_t futhark_mc_segmap_parloop_235596_total_iter;
    int64_t *futhark_mc_segmap_task_235594_total_runtime;
    int *futhark_mc_segmap_task_235594_runs;
    int64_t *futhark_mc_segmap_task_235594_iter;
    int64_t futhark_mc_segmap_task_235594_total_time;
    int64_t futhark_mc_segmap_task_235594_total_iter;
    int64_t *futhark_mc_segmap_parloop_235585_total_runtime;
    int *futhark_mc_segmap_parloop_235585_runs;
    int64_t *futhark_mc_segmap_parloop_235585_iter;
    int64_t futhark_mc_segmap_parloop_235585_total_total_runtime;
    int futhark_mc_segmap_parloop_235585_total_runs;
    int64_t futhark_mc_segmap_parloop_235585_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235583_total_runtime;
    int *futhark_mc_segmap_nested_task_235583_runs;
    int64_t *futhark_mc_segmap_nested_task_235583_iter;
    int64_t *futhark_mc_segmap_parloop_235600_total_runtime;
    int *futhark_mc_segmap_parloop_235600_runs;
    int64_t *futhark_mc_segmap_parloop_235600_iter;
    int64_t futhark_mc_segmap_parloop_235600_total_total_runtime;
    int futhark_mc_segmap_parloop_235600_total_runs;
    int64_t futhark_mc_segmap_parloop_235600_total_iter;
    int64_t *futhark_mc_segmap_task_235598_total_runtime;
    int *futhark_mc_segmap_task_235598_runs;
    int64_t *futhark_mc_segmap_task_235598_iter;
    int64_t futhark_mc_segmap_task_235598_total_time;
    int64_t futhark_mc_segmap_task_235598_total_iter;
    int64_t *futhark_mc_segmap_parloop_235613_total_runtime;
    int *futhark_mc_segmap_parloop_235613_runs;
    int64_t *futhark_mc_segmap_parloop_235613_iter;
    int64_t futhark_mc_segmap_parloop_235613_total_total_runtime;
    int futhark_mc_segmap_parloop_235613_total_runs;
    int64_t futhark_mc_segmap_parloop_235613_total_iter;
    int64_t *futhark_mc_segmap_task_235611_total_runtime;
    int *futhark_mc_segmap_task_235611_runs;
    int64_t *futhark_mc_segmap_task_235611_iter;
    int64_t futhark_mc_segmap_task_235611_total_time;
    int64_t futhark_mc_segmap_task_235611_total_iter;
    int64_t *futhark_mc_segmap_parloop_235617_total_runtime;
    int *futhark_mc_segmap_parloop_235617_runs;
    int64_t *futhark_mc_segmap_parloop_235617_iter;
    int64_t futhark_mc_segmap_parloop_235617_total_total_runtime;
    int futhark_mc_segmap_parloop_235617_total_runs;
    int64_t futhark_mc_segmap_parloop_235617_total_iter;
    int64_t *futhark_mc_segmap_task_235615_total_runtime;
    int *futhark_mc_segmap_task_235615_runs;
    int64_t *futhark_mc_segmap_task_235615_iter;
    int64_t futhark_mc_segmap_task_235615_total_time;
    int64_t futhark_mc_segmap_task_235615_total_iter;
    int64_t *futhark_mc_segmap_parloop_235606_total_runtime;
    int *futhark_mc_segmap_parloop_235606_runs;
    int64_t *futhark_mc_segmap_parloop_235606_iter;
    int64_t futhark_mc_segmap_parloop_235606_total_total_runtime;
    int futhark_mc_segmap_parloop_235606_total_runs;
    int64_t futhark_mc_segmap_parloop_235606_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235604_total_runtime;
    int *futhark_mc_segmap_nested_task_235604_runs;
    int64_t *futhark_mc_segmap_nested_task_235604_iter;
    int64_t *futhark_mc_segmap_parloop_235621_total_runtime;
    int *futhark_mc_segmap_parloop_235621_runs;
    int64_t *futhark_mc_segmap_parloop_235621_iter;
    int64_t futhark_mc_segmap_parloop_235621_total_total_runtime;
    int futhark_mc_segmap_parloop_235621_total_runs;
    int64_t futhark_mc_segmap_parloop_235621_total_iter;
    int64_t *futhark_mc_segmap_task_235619_total_runtime;
    int *futhark_mc_segmap_task_235619_runs;
    int64_t *futhark_mc_segmap_task_235619_iter;
    int64_t futhark_mc_segmap_task_235619_total_time;
    int64_t futhark_mc_segmap_task_235619_total_iter;
    int64_t *futhark_mc_segmap_parloop_235630_total_runtime;
    int *futhark_mc_segmap_parloop_235630_runs;
    int64_t *futhark_mc_segmap_parloop_235630_iter;
    int64_t futhark_mc_segmap_parloop_235630_total_total_runtime;
    int futhark_mc_segmap_parloop_235630_total_runs;
    int64_t futhark_mc_segmap_parloop_235630_total_iter;
    int64_t *futhark_mc_segmap_task_235628_total_runtime;
    int *futhark_mc_segmap_task_235628_runs;
    int64_t *futhark_mc_segmap_task_235628_iter;
    int64_t futhark_mc_segmap_task_235628_total_time;
    int64_t futhark_mc_segmap_task_235628_total_iter;
    int64_t *futhark_mc_segmap_parloop_235625_total_runtime;
    int *futhark_mc_segmap_parloop_235625_runs;
    int64_t *futhark_mc_segmap_parloop_235625_iter;
    int64_t futhark_mc_segmap_parloop_235625_total_total_runtime;
    int futhark_mc_segmap_parloop_235625_total_runs;
    int64_t futhark_mc_segmap_parloop_235625_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235623_total_runtime;
    int *futhark_mc_segmap_nested_task_235623_runs;
    int64_t *futhark_mc_segmap_nested_task_235623_iter;
    int64_t *futhark_mc_segmap_parloop_235634_total_runtime;
    int *futhark_mc_segmap_parloop_235634_runs;
    int64_t *futhark_mc_segmap_parloop_235634_iter;
    int64_t futhark_mc_segmap_parloop_235634_total_total_runtime;
    int futhark_mc_segmap_parloop_235634_total_runs;
    int64_t futhark_mc_segmap_parloop_235634_total_iter;
    int64_t *futhark_mc_segmap_task_235632_total_runtime;
    int *futhark_mc_segmap_task_235632_runs;
    int64_t *futhark_mc_segmap_task_235632_iter;
    int64_t futhark_mc_segmap_task_235632_total_time;
    int64_t futhark_mc_segmap_task_235632_total_iter;
    int64_t *futhark_mc_segmap_parloop_235645_total_runtime;
    int *futhark_mc_segmap_parloop_235645_runs;
    int64_t *futhark_mc_segmap_parloop_235645_iter;
    int64_t futhark_mc_segmap_parloop_235645_total_total_runtime;
    int futhark_mc_segmap_parloop_235645_total_runs;
    int64_t futhark_mc_segmap_parloop_235645_total_iter;
    int64_t *futhark_mc_segmap_task_235643_total_runtime;
    int *futhark_mc_segmap_task_235643_runs;
    int64_t *futhark_mc_segmap_task_235643_iter;
    int64_t futhark_mc_segmap_task_235643_total_time;
    int64_t futhark_mc_segmap_task_235643_total_iter;
    int64_t *futhark_mc_segmap_parloop_235656_total_runtime;
    int *futhark_mc_segmap_parloop_235656_runs;
    int64_t *futhark_mc_segmap_parloop_235656_iter;
    int64_t futhark_mc_segmap_parloop_235656_total_total_runtime;
    int futhark_mc_segmap_parloop_235656_total_runs;
    int64_t futhark_mc_segmap_parloop_235656_total_iter;
    int64_t *futhark_mc_segmap_task_235654_total_runtime;
    int *futhark_mc_segmap_task_235654_runs;
    int64_t *futhark_mc_segmap_task_235654_iter;
    int64_t futhark_mc_segmap_task_235654_total_time;
    int64_t futhark_mc_segmap_task_235654_total_iter;
    int64_t *futhark_mc_segmap_parloop_235650_total_runtime;
    int *futhark_mc_segmap_parloop_235650_runs;
    int64_t *futhark_mc_segmap_parloop_235650_iter;
    int64_t futhark_mc_segmap_parloop_235650_total_total_runtime;
    int futhark_mc_segmap_parloop_235650_total_runs;
    int64_t futhark_mc_segmap_parloop_235650_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235648_total_runtime;
    int *futhark_mc_segmap_nested_task_235648_runs;
    int64_t *futhark_mc_segmap_nested_task_235648_iter;
    int64_t *futhark_mc_segmap_parloop_235639_total_runtime;
    int *futhark_mc_segmap_parloop_235639_runs;
    int64_t *futhark_mc_segmap_parloop_235639_iter;
    int64_t futhark_mc_segmap_parloop_235639_total_total_runtime;
    int futhark_mc_segmap_parloop_235639_total_runs;
    int64_t futhark_mc_segmap_parloop_235639_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235637_total_runtime;
    int *futhark_mc_segmap_nested_task_235637_runs;
    int64_t *futhark_mc_segmap_nested_task_235637_iter;
    int64_t *futhark_mc_segmap_parloop_235660_total_runtime;
    int *futhark_mc_segmap_parloop_235660_runs;
    int64_t *futhark_mc_segmap_parloop_235660_iter;
    int64_t futhark_mc_segmap_parloop_235660_total_total_runtime;
    int futhark_mc_segmap_parloop_235660_total_runs;
    int64_t futhark_mc_segmap_parloop_235660_total_iter;
    int64_t *futhark_mc_segmap_task_235658_total_runtime;
    int *futhark_mc_segmap_task_235658_runs;
    int64_t *futhark_mc_segmap_task_235658_iter;
    int64_t futhark_mc_segmap_task_235658_total_time;
    int64_t futhark_mc_segmap_task_235658_total_iter;
    int64_t *futhark_mc_segmap_parloop_235669_total_runtime;
    int *futhark_mc_segmap_parloop_235669_runs;
    int64_t *futhark_mc_segmap_parloop_235669_iter;
    int64_t futhark_mc_segmap_parloop_235669_total_total_runtime;
    int futhark_mc_segmap_parloop_235669_total_runs;
    int64_t futhark_mc_segmap_parloop_235669_total_iter;
    int64_t *futhark_mc_segmap_task_235667_total_runtime;
    int *futhark_mc_segmap_task_235667_runs;
    int64_t *futhark_mc_segmap_task_235667_iter;
    int64_t futhark_mc_segmap_task_235667_total_time;
    int64_t futhark_mc_segmap_task_235667_total_iter;
    int64_t *futhark_mc_segmap_parloop_235678_total_runtime;
    int *futhark_mc_segmap_parloop_235678_runs;
    int64_t *futhark_mc_segmap_parloop_235678_iter;
    int64_t futhark_mc_segmap_parloop_235678_total_total_runtime;
    int futhark_mc_segmap_parloop_235678_total_runs;
    int64_t futhark_mc_segmap_parloop_235678_total_iter;
    int64_t *futhark_mc_segmap_task_235676_total_runtime;
    int *futhark_mc_segmap_task_235676_runs;
    int64_t *futhark_mc_segmap_task_235676_iter;
    int64_t futhark_mc_segmap_task_235676_total_time;
    int64_t futhark_mc_segmap_task_235676_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235686_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235686_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235686_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235686_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235686_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235686_total_iter;
    int64_t *futhark_mc_segred_task_235683_total_runtime;
    int *futhark_mc_segred_task_235683_runs;
    int64_t *futhark_mc_segred_task_235683_iter;
    int64_t futhark_mc_segred_task_235683_total_time;
    int64_t futhark_mc_segred_task_235683_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235691_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235691_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235691_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235691_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235691_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235691_total_iter;
    int64_t *futhark_mc_segred_task_235688_total_runtime;
    int *futhark_mc_segred_task_235688_runs;
    int64_t *futhark_mc_segred_task_235688_iter;
    int64_t futhark_mc_segred_task_235688_total_time;
    int64_t futhark_mc_segred_task_235688_total_iter;
    int64_t *futhark_mc_segmap_parloop_235681_total_runtime;
    int *futhark_mc_segmap_parloop_235681_runs;
    int64_t *futhark_mc_segmap_parloop_235681_iter;
    int64_t futhark_mc_segmap_parloop_235681_total_total_runtime;
    int futhark_mc_segmap_parloop_235681_total_runs;
    int64_t futhark_mc_segmap_parloop_235681_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235679_total_runtime;
    int *futhark_mc_segmap_nested_task_235679_runs;
    int64_t *futhark_mc_segmap_nested_task_235679_iter;
    int64_t *futhark_mc_segmap_parloop_235673_total_runtime;
    int *futhark_mc_segmap_parloop_235673_runs;
    int64_t *futhark_mc_segmap_parloop_235673_iter;
    int64_t futhark_mc_segmap_parloop_235673_total_total_runtime;
    int futhark_mc_segmap_parloop_235673_total_runs;
    int64_t futhark_mc_segmap_parloop_235673_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235671_total_runtime;
    int *futhark_mc_segmap_nested_task_235671_runs;
    int64_t *futhark_mc_segmap_nested_task_235671_iter;
    int64_t *futhark_mc_segmap_parloop_235664_total_runtime;
    int *futhark_mc_segmap_parloop_235664_runs;
    int64_t *futhark_mc_segmap_parloop_235664_iter;
    int64_t futhark_mc_segmap_parloop_235664_total_total_runtime;
    int futhark_mc_segmap_parloop_235664_total_runs;
    int64_t futhark_mc_segmap_parloop_235664_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235662_total_runtime;
    int *futhark_mc_segmap_nested_task_235662_runs;
    int64_t *futhark_mc_segmap_nested_task_235662_iter;
    int64_t *futhark_mc_segmap_parloop_235695_total_runtime;
    int *futhark_mc_segmap_parloop_235695_runs;
    int64_t *futhark_mc_segmap_parloop_235695_iter;
    int64_t futhark_mc_segmap_parloop_235695_total_total_runtime;
    int futhark_mc_segmap_parloop_235695_total_runs;
    int64_t futhark_mc_segmap_parloop_235695_total_iter;
    int64_t *futhark_mc_segmap_task_235693_total_runtime;
    int *futhark_mc_segmap_task_235693_runs;
    int64_t *futhark_mc_segmap_task_235693_iter;
    int64_t futhark_mc_segmap_task_235693_total_time;
    int64_t futhark_mc_segmap_task_235693_total_iter;
    int64_t *futhark_mc_segmap_parloop_235706_total_runtime;
    int *futhark_mc_segmap_parloop_235706_runs;
    int64_t *futhark_mc_segmap_parloop_235706_iter;
    int64_t futhark_mc_segmap_parloop_235706_total_total_runtime;
    int futhark_mc_segmap_parloop_235706_total_runs;
    int64_t futhark_mc_segmap_parloop_235706_total_iter;
    int64_t *futhark_mc_segmap_task_235704_total_runtime;
    int *futhark_mc_segmap_task_235704_runs;
    int64_t *futhark_mc_segmap_task_235704_iter;
    int64_t futhark_mc_segmap_task_235704_total_time;
    int64_t futhark_mc_segmap_task_235704_total_iter;
    int64_t *futhark_mc_segmap_parloop_235717_total_runtime;
    int *futhark_mc_segmap_parloop_235717_runs;
    int64_t *futhark_mc_segmap_parloop_235717_iter;
    int64_t futhark_mc_segmap_parloop_235717_total_total_runtime;
    int futhark_mc_segmap_parloop_235717_total_runs;
    int64_t futhark_mc_segmap_parloop_235717_total_iter;
    int64_t *futhark_mc_segmap_task_235715_total_runtime;
    int *futhark_mc_segmap_task_235715_runs;
    int64_t *futhark_mc_segmap_task_235715_iter;
    int64_t futhark_mc_segmap_task_235715_total_time;
    int64_t futhark_mc_segmap_task_235715_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235727_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235727_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235727_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235727_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235727_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235727_total_iter;
    int64_t *futhark_mc_segred_task_235722_total_runtime;
    int *futhark_mc_segred_task_235722_runs;
    int64_t *futhark_mc_segred_task_235722_iter;
    int64_t futhark_mc_segred_task_235722_total_time;
    int64_t futhark_mc_segred_task_235722_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235733_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235733_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235733_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235733_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235733_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235733_total_iter;
    int64_t *futhark_mc_segred_task_235729_total_runtime;
    int *futhark_mc_segred_task_235729_runs;
    int64_t *futhark_mc_segred_task_235729_iter;
    int64_t futhark_mc_segred_task_235729_total_time;
    int64_t futhark_mc_segred_task_235729_total_iter;
    int64_t *futhark_mc_segmap_parloop_235720_total_runtime;
    int *futhark_mc_segmap_parloop_235720_runs;
    int64_t *futhark_mc_segmap_parloop_235720_iter;
    int64_t futhark_mc_segmap_parloop_235720_total_total_runtime;
    int futhark_mc_segmap_parloop_235720_total_runs;
    int64_t futhark_mc_segmap_parloop_235720_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235718_total_runtime;
    int *futhark_mc_segmap_nested_task_235718_runs;
    int64_t *futhark_mc_segmap_nested_task_235718_iter;
    int64_t *futhark_mc_segmap_parloop_235711_total_runtime;
    int *futhark_mc_segmap_parloop_235711_runs;
    int64_t *futhark_mc_segmap_parloop_235711_iter;
    int64_t futhark_mc_segmap_parloop_235711_total_total_runtime;
    int futhark_mc_segmap_parloop_235711_total_runs;
    int64_t futhark_mc_segmap_parloop_235711_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235709_total_runtime;
    int *futhark_mc_segmap_nested_task_235709_runs;
    int64_t *futhark_mc_segmap_nested_task_235709_iter;
    int64_t *futhark_mc_segmap_parloop_235700_total_runtime;
    int *futhark_mc_segmap_parloop_235700_runs;
    int64_t *futhark_mc_segmap_parloop_235700_iter;
    int64_t futhark_mc_segmap_parloop_235700_total_total_runtime;
    int futhark_mc_segmap_parloop_235700_total_runs;
    int64_t futhark_mc_segmap_parloop_235700_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235698_total_runtime;
    int *futhark_mc_segmap_nested_task_235698_runs;
    int64_t *futhark_mc_segmap_nested_task_235698_iter;
    int64_t *futhark_mc_segmap_parloop_235737_total_runtime;
    int *futhark_mc_segmap_parloop_235737_runs;
    int64_t *futhark_mc_segmap_parloop_235737_iter;
    int64_t futhark_mc_segmap_parloop_235737_total_total_runtime;
    int futhark_mc_segmap_parloop_235737_total_runs;
    int64_t futhark_mc_segmap_parloop_235737_total_iter;
    int64_t *futhark_mc_segmap_task_235735_total_runtime;
    int *futhark_mc_segmap_task_235735_runs;
    int64_t *futhark_mc_segmap_task_235735_iter;
    int64_t futhark_mc_segmap_task_235735_total_time;
    int64_t futhark_mc_segmap_task_235735_total_iter;
    int64_t *futhark_mc_segmap_parloop_235748_total_runtime;
    int *futhark_mc_segmap_parloop_235748_runs;
    int64_t *futhark_mc_segmap_parloop_235748_iter;
    int64_t futhark_mc_segmap_parloop_235748_total_total_runtime;
    int futhark_mc_segmap_parloop_235748_total_runs;
    int64_t futhark_mc_segmap_parloop_235748_total_iter;
    int64_t *futhark_mc_segmap_task_235746_total_runtime;
    int *futhark_mc_segmap_task_235746_runs;
    int64_t *futhark_mc_segmap_task_235746_iter;
    int64_t futhark_mc_segmap_task_235746_total_time;
    int64_t futhark_mc_segmap_task_235746_total_iter;
    int64_t *futhark_mc_segmap_parloop_235759_total_runtime;
    int *futhark_mc_segmap_parloop_235759_runs;
    int64_t *futhark_mc_segmap_parloop_235759_iter;
    int64_t futhark_mc_segmap_parloop_235759_total_total_runtime;
    int futhark_mc_segmap_parloop_235759_total_runs;
    int64_t futhark_mc_segmap_parloop_235759_total_iter;
    int64_t *futhark_mc_segmap_task_235757_total_runtime;
    int *futhark_mc_segmap_task_235757_runs;
    int64_t *futhark_mc_segmap_task_235757_iter;
    int64_t futhark_mc_segmap_task_235757_total_time;
    int64_t futhark_mc_segmap_task_235757_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235771_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235771_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235771_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235771_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235771_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235771_total_iter;
    int64_t *futhark_mc_segred_task_235764_total_runtime;
    int *futhark_mc_segred_task_235764_runs;
    int64_t *futhark_mc_segred_task_235764_iter;
    int64_t futhark_mc_segred_task_235764_total_time;
    int64_t futhark_mc_segred_task_235764_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235777_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235777_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235777_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235777_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235777_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235777_total_iter;
    int64_t *futhark_mc_segred_task_235773_total_runtime;
    int *futhark_mc_segred_task_235773_runs;
    int64_t *futhark_mc_segred_task_235773_iter;
    int64_t futhark_mc_segred_task_235773_total_time;
    int64_t futhark_mc_segred_task_235773_total_iter;
    int64_t *futhark_mc_segmap_parloop_235762_total_runtime;
    int *futhark_mc_segmap_parloop_235762_runs;
    int64_t *futhark_mc_segmap_parloop_235762_iter;
    int64_t futhark_mc_segmap_parloop_235762_total_total_runtime;
    int futhark_mc_segmap_parloop_235762_total_runs;
    int64_t futhark_mc_segmap_parloop_235762_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235760_total_runtime;
    int *futhark_mc_segmap_nested_task_235760_runs;
    int64_t *futhark_mc_segmap_nested_task_235760_iter;
    int64_t *futhark_mc_segmap_parloop_235753_total_runtime;
    int *futhark_mc_segmap_parloop_235753_runs;
    int64_t *futhark_mc_segmap_parloop_235753_iter;
    int64_t futhark_mc_segmap_parloop_235753_total_total_runtime;
    int futhark_mc_segmap_parloop_235753_total_runs;
    int64_t futhark_mc_segmap_parloop_235753_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235751_total_runtime;
    int *futhark_mc_segmap_nested_task_235751_runs;
    int64_t *futhark_mc_segmap_nested_task_235751_iter;
    int64_t *futhark_mc_segmap_parloop_235742_total_runtime;
    int *futhark_mc_segmap_parloop_235742_runs;
    int64_t *futhark_mc_segmap_parloop_235742_iter;
    int64_t futhark_mc_segmap_parloop_235742_total_total_runtime;
    int futhark_mc_segmap_parloop_235742_total_runs;
    int64_t futhark_mc_segmap_parloop_235742_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235740_total_runtime;
    int *futhark_mc_segmap_nested_task_235740_runs;
    int64_t *futhark_mc_segmap_nested_task_235740_iter;
    int64_t *futhark_mc_segmap_parloop_235781_total_runtime;
    int *futhark_mc_segmap_parloop_235781_runs;
    int64_t *futhark_mc_segmap_parloop_235781_iter;
    int64_t futhark_mc_segmap_parloop_235781_total_total_runtime;
    int futhark_mc_segmap_parloop_235781_total_runs;
    int64_t futhark_mc_segmap_parloop_235781_total_iter;
    int64_t *futhark_mc_segmap_task_235779_total_runtime;
    int *futhark_mc_segmap_task_235779_runs;
    int64_t *futhark_mc_segmap_task_235779_iter;
    int64_t futhark_mc_segmap_task_235779_total_time;
    int64_t futhark_mc_segmap_task_235779_total_iter;
    int64_t *futhark_mc_segmap_parloop_235791_total_runtime;
    int *futhark_mc_segmap_parloop_235791_runs;
    int64_t *futhark_mc_segmap_parloop_235791_iter;
    int64_t futhark_mc_segmap_parloop_235791_total_total_runtime;
    int futhark_mc_segmap_parloop_235791_total_runs;
    int64_t futhark_mc_segmap_parloop_235791_total_iter;
    int64_t *futhark_mc_segmap_task_235789_total_runtime;
    int *futhark_mc_segmap_task_235789_runs;
    int64_t *futhark_mc_segmap_task_235789_iter;
    int64_t futhark_mc_segmap_task_235789_total_time;
    int64_t futhark_mc_segmap_task_235789_total_iter;
    int64_t *futhark_mc_segmap_parloop_235801_total_runtime;
    int *futhark_mc_segmap_parloop_235801_runs;
    int64_t *futhark_mc_segmap_parloop_235801_iter;
    int64_t futhark_mc_segmap_parloop_235801_total_total_runtime;
    int futhark_mc_segmap_parloop_235801_total_runs;
    int64_t futhark_mc_segmap_parloop_235801_total_iter;
    int64_t *futhark_mc_segmap_task_235799_total_runtime;
    int *futhark_mc_segmap_task_235799_runs;
    int64_t *futhark_mc_segmap_task_235799_iter;
    int64_t futhark_mc_segmap_task_235799_total_time;
    int64_t futhark_mc_segmap_task_235799_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235811_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235811_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235811_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235811_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235811_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235811_total_iter;
    int64_t *futhark_mc_segred_task_235808_total_runtime;
    int *futhark_mc_segred_task_235808_runs;
    int64_t *futhark_mc_segred_task_235808_iter;
    int64_t futhark_mc_segred_task_235808_total_time;
    int64_t futhark_mc_segred_task_235808_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235816_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235816_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235816_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235816_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235816_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235816_total_iter;
    int64_t *futhark_mc_segred_task_235813_total_runtime;
    int *futhark_mc_segred_task_235813_runs;
    int64_t *futhark_mc_segred_task_235813_iter;
    int64_t futhark_mc_segred_task_235813_total_time;
    int64_t futhark_mc_segred_task_235813_total_iter;
    int64_t *futhark_mc_segmap_parloop_235805_total_runtime;
    int *futhark_mc_segmap_parloop_235805_runs;
    int64_t *futhark_mc_segmap_parloop_235805_iter;
    int64_t futhark_mc_segmap_parloop_235805_total_total_runtime;
    int futhark_mc_segmap_parloop_235805_total_runs;
    int64_t futhark_mc_segmap_parloop_235805_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235803_total_runtime;
    int *futhark_mc_segmap_nested_task_235803_runs;
    int64_t *futhark_mc_segmap_nested_task_235803_iter;
    int64_t *futhark_mc_segmap_parloop_235796_total_runtime;
    int *futhark_mc_segmap_parloop_235796_runs;
    int64_t *futhark_mc_segmap_parloop_235796_iter;
    int64_t futhark_mc_segmap_parloop_235796_total_total_runtime;
    int futhark_mc_segmap_parloop_235796_total_runs;
    int64_t futhark_mc_segmap_parloop_235796_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235794_total_runtime;
    int *futhark_mc_segmap_nested_task_235794_runs;
    int64_t *futhark_mc_segmap_nested_task_235794_iter;
    int64_t *futhark_mc_segmap_parloop_235786_total_runtime;
    int *futhark_mc_segmap_parloop_235786_runs;
    int64_t *futhark_mc_segmap_parloop_235786_iter;
    int64_t futhark_mc_segmap_parloop_235786_total_total_runtime;
    int futhark_mc_segmap_parloop_235786_total_runs;
    int64_t futhark_mc_segmap_parloop_235786_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235784_total_runtime;
    int *futhark_mc_segmap_nested_task_235784_runs;
    int64_t *futhark_mc_segmap_nested_task_235784_iter;
    int64_t *futhark_mc_segmap_parloop_235820_total_runtime;
    int *futhark_mc_segmap_parloop_235820_runs;
    int64_t *futhark_mc_segmap_parloop_235820_iter;
    int64_t futhark_mc_segmap_parloop_235820_total_total_runtime;
    int futhark_mc_segmap_parloop_235820_total_runs;
    int64_t futhark_mc_segmap_parloop_235820_total_iter;
    int64_t *futhark_mc_segmap_task_235818_total_runtime;
    int *futhark_mc_segmap_task_235818_runs;
    int64_t *futhark_mc_segmap_task_235818_iter;
    int64_t futhark_mc_segmap_task_235818_total_time;
    int64_t futhark_mc_segmap_task_235818_total_iter;
    int64_t *futhark_mc_segmap_parloop_235833_total_runtime;
    int *futhark_mc_segmap_parloop_235833_runs;
    int64_t *futhark_mc_segmap_parloop_235833_iter;
    int64_t futhark_mc_segmap_parloop_235833_total_total_runtime;
    int futhark_mc_segmap_parloop_235833_total_runs;
    int64_t futhark_mc_segmap_parloop_235833_total_iter;
    int64_t *futhark_mc_segmap_task_235831_total_runtime;
    int *futhark_mc_segmap_task_235831_runs;
    int64_t *futhark_mc_segmap_task_235831_iter;
    int64_t futhark_mc_segmap_task_235831_total_time;
    int64_t futhark_mc_segmap_task_235831_total_iter;
    int64_t *futhark_mc_segmap_parloop_235846_total_runtime;
    int *futhark_mc_segmap_parloop_235846_runs;
    int64_t *futhark_mc_segmap_parloop_235846_iter;
    int64_t futhark_mc_segmap_parloop_235846_total_total_runtime;
    int futhark_mc_segmap_parloop_235846_total_runs;
    int64_t futhark_mc_segmap_parloop_235846_total_iter;
    int64_t *futhark_mc_segmap_task_235844_total_runtime;
    int *futhark_mc_segmap_task_235844_runs;
    int64_t *futhark_mc_segmap_task_235844_iter;
    int64_t futhark_mc_segmap_task_235844_total_time;
    int64_t futhark_mc_segmap_task_235844_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235860_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235860_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235860_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235860_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235860_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235860_total_iter;
    int64_t *futhark_mc_segred_task_235855_total_runtime;
    int *futhark_mc_segred_task_235855_runs;
    int64_t *futhark_mc_segred_task_235855_iter;
    int64_t futhark_mc_segred_task_235855_total_time;
    int64_t futhark_mc_segred_task_235855_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235866_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235866_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235866_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235866_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235866_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235866_total_iter;
    int64_t *futhark_mc_segred_task_235862_total_runtime;
    int *futhark_mc_segred_task_235862_runs;
    int64_t *futhark_mc_segred_task_235862_iter;
    int64_t futhark_mc_segred_task_235862_total_time;
    int64_t futhark_mc_segred_task_235862_total_iter;
    int64_t *futhark_mc_segmap_parloop_235851_total_runtime;
    int *futhark_mc_segmap_parloop_235851_runs;
    int64_t *futhark_mc_segmap_parloop_235851_iter;
    int64_t futhark_mc_segmap_parloop_235851_total_total_runtime;
    int futhark_mc_segmap_parloop_235851_total_runs;
    int64_t futhark_mc_segmap_parloop_235851_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235849_total_runtime;
    int *futhark_mc_segmap_nested_task_235849_runs;
    int64_t *futhark_mc_segmap_nested_task_235849_iter;
    int64_t *futhark_mc_segmap_parloop_235840_total_runtime;
    int *futhark_mc_segmap_parloop_235840_runs;
    int64_t *futhark_mc_segmap_parloop_235840_iter;
    int64_t futhark_mc_segmap_parloop_235840_total_total_runtime;
    int futhark_mc_segmap_parloop_235840_total_runs;
    int64_t futhark_mc_segmap_parloop_235840_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235838_total_runtime;
    int *futhark_mc_segmap_nested_task_235838_runs;
    int64_t *futhark_mc_segmap_nested_task_235838_iter;
    int64_t *futhark_mc_segmap_parloop_235827_total_runtime;
    int *futhark_mc_segmap_parloop_235827_runs;
    int64_t *futhark_mc_segmap_parloop_235827_iter;
    int64_t futhark_mc_segmap_parloop_235827_total_total_runtime;
    int futhark_mc_segmap_parloop_235827_total_runs;
    int64_t futhark_mc_segmap_parloop_235827_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235825_total_runtime;
    int *futhark_mc_segmap_nested_task_235825_runs;
    int64_t *futhark_mc_segmap_nested_task_235825_iter;
    int64_t *futhark_mc_segmap_parloop_235870_total_runtime;
    int *futhark_mc_segmap_parloop_235870_runs;
    int64_t *futhark_mc_segmap_parloop_235870_iter;
    int64_t futhark_mc_segmap_parloop_235870_total_total_runtime;
    int futhark_mc_segmap_parloop_235870_total_runs;
    int64_t futhark_mc_segmap_parloop_235870_total_iter;
    int64_t *futhark_mc_segmap_task_235868_total_runtime;
    int *futhark_mc_segmap_task_235868_runs;
    int64_t *futhark_mc_segmap_task_235868_iter;
    int64_t futhark_mc_segmap_task_235868_total_time;
    int64_t futhark_mc_segmap_task_235868_total_iter;
    int64_t *futhark_mc_segmap_parloop_235885_total_runtime;
    int *futhark_mc_segmap_parloop_235885_runs;
    int64_t *futhark_mc_segmap_parloop_235885_iter;
    int64_t futhark_mc_segmap_parloop_235885_total_total_runtime;
    int futhark_mc_segmap_parloop_235885_total_runs;
    int64_t futhark_mc_segmap_parloop_235885_total_iter;
    int64_t *futhark_mc_segmap_task_235883_total_runtime;
    int *futhark_mc_segmap_task_235883_runs;
    int64_t *futhark_mc_segmap_task_235883_iter;
    int64_t futhark_mc_segmap_task_235883_total_time;
    int64_t futhark_mc_segmap_task_235883_total_iter;
    int64_t *futhark_mc_segmap_parloop_235900_total_runtime;
    int *futhark_mc_segmap_parloop_235900_runs;
    int64_t *futhark_mc_segmap_parloop_235900_iter;
    int64_t futhark_mc_segmap_parloop_235900_total_total_runtime;
    int futhark_mc_segmap_parloop_235900_total_runs;
    int64_t futhark_mc_segmap_parloop_235900_total_iter;
    int64_t *futhark_mc_segmap_task_235898_total_runtime;
    int *futhark_mc_segmap_task_235898_runs;
    int64_t *futhark_mc_segmap_task_235898_iter;
    int64_t futhark_mc_segmap_task_235898_total_time;
    int64_t futhark_mc_segmap_task_235898_total_iter;
    int64_t *futhark_mc_segmap_parloop_235915_total_runtime;
    int *futhark_mc_segmap_parloop_235915_runs;
    int64_t *futhark_mc_segmap_parloop_235915_iter;
    int64_t futhark_mc_segmap_parloop_235915_total_total_runtime;
    int futhark_mc_segmap_parloop_235915_total_runs;
    int64_t futhark_mc_segmap_parloop_235915_total_iter;
    int64_t *futhark_mc_segmap_task_235913_total_runtime;
    int *futhark_mc_segmap_task_235913_runs;
    int64_t *futhark_mc_segmap_task_235913_iter;
    int64_t futhark_mc_segmap_task_235913_total_time;
    int64_t futhark_mc_segmap_task_235913_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235924_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235924_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235924_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235924_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235924_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235924_total_iter;
    int64_t *futhark_mc_segred_task_235917_total_runtime;
    int *futhark_mc_segred_task_235917_runs;
    int64_t *futhark_mc_segred_task_235917_iter;
    int64_t futhark_mc_segred_task_235917_total_time;
    int64_t futhark_mc_segred_task_235917_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235930_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235930_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235930_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235930_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235930_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235930_total_iter;
    int64_t *futhark_mc_segred_task_235926_total_runtime;
    int *futhark_mc_segred_task_235926_runs;
    int64_t *futhark_mc_segred_task_235926_iter;
    int64_t futhark_mc_segred_task_235926_total_time;
    int64_t futhark_mc_segred_task_235926_total_iter;
    int64_t *futhark_mc_segmap_parloop_235907_total_runtime;
    int *futhark_mc_segmap_parloop_235907_runs;
    int64_t *futhark_mc_segmap_parloop_235907_iter;
    int64_t futhark_mc_segmap_parloop_235907_total_total_runtime;
    int futhark_mc_segmap_parloop_235907_total_runs;
    int64_t futhark_mc_segmap_parloop_235907_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235905_total_runtime;
    int *futhark_mc_segmap_nested_task_235905_runs;
    int64_t *futhark_mc_segmap_nested_task_235905_iter;
    int64_t *futhark_mc_segmap_parloop_235894_total_runtime;
    int *futhark_mc_segmap_parloop_235894_runs;
    int64_t *futhark_mc_segmap_parloop_235894_iter;
    int64_t futhark_mc_segmap_parloop_235894_total_total_runtime;
    int futhark_mc_segmap_parloop_235894_total_runs;
    int64_t futhark_mc_segmap_parloop_235894_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235892_total_runtime;
    int *futhark_mc_segmap_nested_task_235892_runs;
    int64_t *futhark_mc_segmap_nested_task_235892_iter;
    int64_t *futhark_mc_segmap_parloop_235879_total_runtime;
    int *futhark_mc_segmap_parloop_235879_runs;
    int64_t *futhark_mc_segmap_parloop_235879_iter;
    int64_t futhark_mc_segmap_parloop_235879_total_total_runtime;
    int futhark_mc_segmap_parloop_235879_total_runs;
    int64_t futhark_mc_segmap_parloop_235879_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235877_total_runtime;
    int *futhark_mc_segmap_nested_task_235877_runs;
    int64_t *futhark_mc_segmap_nested_task_235877_iter;
    int64_t *futhark_mc_segmap_parloop_235934_total_runtime;
    int *futhark_mc_segmap_parloop_235934_runs;
    int64_t *futhark_mc_segmap_parloop_235934_iter;
    int64_t futhark_mc_segmap_parloop_235934_total_total_runtime;
    int futhark_mc_segmap_parloop_235934_total_runs;
    int64_t futhark_mc_segmap_parloop_235934_total_iter;
    int64_t *futhark_mc_segmap_task_235932_total_runtime;
    int *futhark_mc_segmap_task_235932_runs;
    int64_t *futhark_mc_segmap_task_235932_iter;
    int64_t futhark_mc_segmap_task_235932_total_time;
    int64_t futhark_mc_segmap_task_235932_total_iter;
    int64_t *futhark_mc_segmap_parloop_235943_total_runtime;
    int *futhark_mc_segmap_parloop_235943_runs;
    int64_t *futhark_mc_segmap_parloop_235943_iter;
    int64_t futhark_mc_segmap_parloop_235943_total_total_runtime;
    int futhark_mc_segmap_parloop_235943_total_runs;
    int64_t futhark_mc_segmap_parloop_235943_total_iter;
    int64_t *futhark_mc_segmap_task_235941_total_runtime;
    int *futhark_mc_segmap_task_235941_runs;
    int64_t *futhark_mc_segmap_task_235941_iter;
    int64_t futhark_mc_segmap_task_235941_total_time;
    int64_t futhark_mc_segmap_task_235941_total_iter;
    int64_t *futhark_mc_segmap_parloop_235952_total_runtime;
    int *futhark_mc_segmap_parloop_235952_runs;
    int64_t *futhark_mc_segmap_parloop_235952_iter;
    int64_t futhark_mc_segmap_parloop_235952_total_total_runtime;
    int futhark_mc_segmap_parloop_235952_total_runs;
    int64_t futhark_mc_segmap_parloop_235952_total_iter;
    int64_t *futhark_mc_segmap_task_235950_total_runtime;
    int *futhark_mc_segmap_task_235950_runs;
    int64_t *futhark_mc_segmap_task_235950_iter;
    int64_t futhark_mc_segmap_task_235950_total_time;
    int64_t futhark_mc_segmap_task_235950_total_iter;
    int64_t *futhark_mc_segmap_parloop_235947_total_runtime;
    int *futhark_mc_segmap_parloop_235947_runs;
    int64_t *futhark_mc_segmap_parloop_235947_iter;
    int64_t futhark_mc_segmap_parloop_235947_total_total_runtime;
    int futhark_mc_segmap_parloop_235947_total_runs;
    int64_t futhark_mc_segmap_parloop_235947_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235945_total_runtime;
    int *futhark_mc_segmap_nested_task_235945_runs;
    int64_t *futhark_mc_segmap_nested_task_235945_iter;
    int64_t *futhark_mc_segmap_parloop_235938_total_runtime;
    int *futhark_mc_segmap_parloop_235938_runs;
    int64_t *futhark_mc_segmap_parloop_235938_iter;
    int64_t futhark_mc_segmap_parloop_235938_total_total_runtime;
    int futhark_mc_segmap_parloop_235938_total_runs;
    int64_t futhark_mc_segmap_parloop_235938_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235936_total_runtime;
    int *futhark_mc_segmap_nested_task_235936_runs;
    int64_t *futhark_mc_segmap_nested_task_235936_iter;
    int64_t *futhark_mc_segmap_parloop_235956_total_runtime;
    int *futhark_mc_segmap_parloop_235956_runs;
    int64_t *futhark_mc_segmap_parloop_235956_iter;
    int64_t futhark_mc_segmap_parloop_235956_total_total_runtime;
    int futhark_mc_segmap_parloop_235956_total_runs;
    int64_t futhark_mc_segmap_parloop_235956_total_iter;
    int64_t *futhark_mc_segmap_task_235954_total_runtime;
    int *futhark_mc_segmap_task_235954_runs;
    int64_t *futhark_mc_segmap_task_235954_iter;
    int64_t futhark_mc_segmap_task_235954_total_time;
    int64_t futhark_mc_segmap_task_235954_total_iter;
    int64_t *futhark_mc_segmap_parloop_235965_total_runtime;
    int *futhark_mc_segmap_parloop_235965_runs;
    int64_t *futhark_mc_segmap_parloop_235965_iter;
    int64_t futhark_mc_segmap_parloop_235965_total_total_runtime;
    int futhark_mc_segmap_parloop_235965_total_runs;
    int64_t futhark_mc_segmap_parloop_235965_total_iter;
    int64_t *futhark_mc_segmap_task_235963_total_runtime;
    int *futhark_mc_segmap_task_235963_runs;
    int64_t *futhark_mc_segmap_task_235963_iter;
    int64_t futhark_mc_segmap_task_235963_total_time;
    int64_t futhark_mc_segmap_task_235963_total_iter;
    int64_t *futhark_mc_segmap_parloop_235960_total_runtime;
    int *futhark_mc_segmap_parloop_235960_runs;
    int64_t *futhark_mc_segmap_parloop_235960_iter;
    int64_t futhark_mc_segmap_parloop_235960_total_total_runtime;
    int futhark_mc_segmap_parloop_235960_total_runs;
    int64_t futhark_mc_segmap_parloop_235960_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235958_total_runtime;
    int *futhark_mc_segmap_nested_task_235958_runs;
    int64_t *futhark_mc_segmap_nested_task_235958_iter;
    int64_t *futhark_mc_segmap_parloop_235969_total_runtime;
    int *futhark_mc_segmap_parloop_235969_runs;
    int64_t *futhark_mc_segmap_parloop_235969_iter;
    int64_t futhark_mc_segmap_parloop_235969_total_total_runtime;
    int futhark_mc_segmap_parloop_235969_total_runs;
    int64_t futhark_mc_segmap_parloop_235969_total_iter;
    int64_t *futhark_mc_segmap_task_235967_total_runtime;
    int *futhark_mc_segmap_task_235967_runs;
    int64_t *futhark_mc_segmap_task_235967_iter;
    int64_t futhark_mc_segmap_task_235967_total_time;
    int64_t futhark_mc_segmap_task_235967_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235977_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235977_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235977_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235977_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235977_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235977_total_iter;
    int64_t *futhark_mc_segred_task_235974_total_runtime;
    int *futhark_mc_segred_task_235974_runs;
    int64_t *futhark_mc_segred_task_235974_iter;
    int64_t futhark_mc_segred_task_235974_total_time;
    int64_t futhark_mc_segred_task_235974_total_iter;
    int64_t *futhark_mc_segmap_parloop_235972_total_runtime;
    int *futhark_mc_segmap_parloop_235972_runs;
    int64_t *futhark_mc_segmap_parloop_235972_iter;
    int64_t futhark_mc_segmap_parloop_235972_total_total_runtime;
    int futhark_mc_segmap_parloop_235972_total_runs;
    int64_t futhark_mc_segmap_parloop_235972_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235970_total_runtime;
    int *futhark_mc_segmap_nested_task_235970_runs;
    int64_t *futhark_mc_segmap_nested_task_235970_iter;
    int64_t *futhark_mc_segmap_parloop_235981_total_runtime;
    int *futhark_mc_segmap_parloop_235981_runs;
    int64_t *futhark_mc_segmap_parloop_235981_iter;
    int64_t futhark_mc_segmap_parloop_235981_total_total_runtime;
    int futhark_mc_segmap_parloop_235981_total_runs;
    int64_t futhark_mc_segmap_parloop_235981_total_iter;
    int64_t *futhark_mc_segmap_task_235979_total_runtime;
    int *futhark_mc_segmap_task_235979_runs;
    int64_t *futhark_mc_segmap_task_235979_iter;
    int64_t futhark_mc_segmap_task_235979_total_time;
    int64_t futhark_mc_segmap_task_235979_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_235991_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_235991_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_235991_iter;
    int64_t futhark_mc_scan_stage_1_parloop_235991_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_235991_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_235991_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_235993_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_235993_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_235993_iter;
    int64_t futhark_mc_scan_stage_3_parloop_235993_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_235993_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_235993_total_iter;
    int64_t *futhark_mc_segscan_task_235988_total_runtime;
    int *futhark_mc_segscan_task_235988_runs;
    int64_t *futhark_mc_segscan_task_235988_iter;
    int64_t futhark_mc_segscan_task_235988_total_time;
    int64_t futhark_mc_segscan_task_235988_total_iter;
    int64_t *futhark_mc_segmap_parloop_235985_total_runtime;
    int *futhark_mc_segmap_parloop_235985_runs;
    int64_t *futhark_mc_segmap_parloop_235985_iter;
    int64_t futhark_mc_segmap_parloop_235985_total_total_runtime;
    int futhark_mc_segmap_parloop_235985_total_runs;
    int64_t futhark_mc_segmap_parloop_235985_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235983_total_runtime;
    int *futhark_mc_segmap_nested_task_235983_runs;
    int64_t *futhark_mc_segmap_nested_task_235983_iter;
    int64_t *futhark_mc_segmap_parloop_235997_total_runtime;
    int *futhark_mc_segmap_parloop_235997_runs;
    int64_t *futhark_mc_segmap_parloop_235997_iter;
    int64_t futhark_mc_segmap_parloop_235997_total_total_runtime;
    int futhark_mc_segmap_parloop_235997_total_runs;
    int64_t futhark_mc_segmap_parloop_235997_total_iter;
    int64_t *futhark_mc_segmap_task_235995_total_runtime;
    int *futhark_mc_segmap_task_235995_runs;
    int64_t *futhark_mc_segmap_task_235995_iter;
    int64_t futhark_mc_segmap_task_235995_total_time;
    int64_t futhark_mc_segmap_task_235995_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236005_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236005_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236005_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236005_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236005_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236005_total_iter;
    int64_t *futhark_mc_segred_task_236002_total_runtime;
    int *futhark_mc_segred_task_236002_runs;
    int64_t *futhark_mc_segred_task_236002_iter;
    int64_t futhark_mc_segred_task_236002_total_time;
    int64_t futhark_mc_segred_task_236002_total_iter;
    int64_t *futhark_mc_segmap_parloop_236000_total_runtime;
    int *futhark_mc_segmap_parloop_236000_runs;
    int64_t *futhark_mc_segmap_parloop_236000_iter;
    int64_t futhark_mc_segmap_parloop_236000_total_total_runtime;
    int futhark_mc_segmap_parloop_236000_total_runs;
    int64_t futhark_mc_segmap_parloop_236000_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235998_total_runtime;
    int *futhark_mc_segmap_nested_task_235998_runs;
    int64_t *futhark_mc_segmap_nested_task_235998_iter;
    int64_t *futhark_mc_segmap_parloop_236009_total_runtime;
    int *futhark_mc_segmap_parloop_236009_runs;
    int64_t *futhark_mc_segmap_parloop_236009_iter;
    int64_t futhark_mc_segmap_parloop_236009_total_total_runtime;
    int futhark_mc_segmap_parloop_236009_total_runs;
    int64_t futhark_mc_segmap_parloop_236009_total_iter;
    int64_t *futhark_mc_segmap_task_236007_total_runtime;
    int *futhark_mc_segmap_task_236007_runs;
    int64_t *futhark_mc_segmap_task_236007_iter;
    int64_t futhark_mc_segmap_task_236007_total_time;
    int64_t futhark_mc_segmap_task_236007_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_236019_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_236019_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_236019_iter;
    int64_t futhark_mc_scan_stage_1_parloop_236019_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_236019_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_236019_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_236021_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_236021_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_236021_iter;
    int64_t futhark_mc_scan_stage_3_parloop_236021_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_236021_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_236021_total_iter;
    int64_t *futhark_mc_segscan_task_236016_total_runtime;
    int *futhark_mc_segscan_task_236016_runs;
    int64_t *futhark_mc_segscan_task_236016_iter;
    int64_t futhark_mc_segscan_task_236016_total_time;
    int64_t futhark_mc_segscan_task_236016_total_iter;
    int64_t *futhark_mc_segmap_parloop_236013_total_runtime;
    int *futhark_mc_segmap_parloop_236013_runs;
    int64_t *futhark_mc_segmap_parloop_236013_iter;
    int64_t futhark_mc_segmap_parloop_236013_total_total_runtime;
    int futhark_mc_segmap_parloop_236013_total_runs;
    int64_t futhark_mc_segmap_parloop_236013_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236011_total_runtime;
    int *futhark_mc_segmap_nested_task_236011_runs;
    int64_t *futhark_mc_segmap_nested_task_236011_iter;
    int64_t *futhark_mc_segmap_parloop_236025_total_runtime;
    int *futhark_mc_segmap_parloop_236025_runs;
    int64_t *futhark_mc_segmap_parloop_236025_iter;
    int64_t futhark_mc_segmap_parloop_236025_total_total_runtime;
    int futhark_mc_segmap_parloop_236025_total_runs;
    int64_t futhark_mc_segmap_parloop_236025_total_iter;
    int64_t *futhark_mc_segmap_task_236023_total_runtime;
    int *futhark_mc_segmap_task_236023_runs;
    int64_t *futhark_mc_segmap_task_236023_iter;
    int64_t futhark_mc_segmap_task_236023_total_time;
    int64_t futhark_mc_segmap_task_236023_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236033_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236033_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236033_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236033_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236033_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236033_total_iter;
    int64_t *futhark_mc_segred_task_236030_total_runtime;
    int *futhark_mc_segred_task_236030_runs;
    int64_t *futhark_mc_segred_task_236030_iter;
    int64_t futhark_mc_segred_task_236030_total_time;
    int64_t futhark_mc_segred_task_236030_total_iter;
    int64_t *futhark_mc_segmap_parloop_236028_total_runtime;
    int *futhark_mc_segmap_parloop_236028_runs;
    int64_t *futhark_mc_segmap_parloop_236028_iter;
    int64_t futhark_mc_segmap_parloop_236028_total_total_runtime;
    int futhark_mc_segmap_parloop_236028_total_runs;
    int64_t futhark_mc_segmap_parloop_236028_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236026_total_runtime;
    int *futhark_mc_segmap_nested_task_236026_runs;
    int64_t *futhark_mc_segmap_nested_task_236026_iter;
    int64_t *futhark_mc_segmap_parloop_236037_total_runtime;
    int *futhark_mc_segmap_parloop_236037_runs;
    int64_t *futhark_mc_segmap_parloop_236037_iter;
    int64_t futhark_mc_segmap_parloop_236037_total_total_runtime;
    int futhark_mc_segmap_parloop_236037_total_runs;
    int64_t futhark_mc_segmap_parloop_236037_total_iter;
    int64_t *futhark_mc_segmap_task_236035_total_runtime;
    int *futhark_mc_segmap_task_236035_runs;
    int64_t *futhark_mc_segmap_task_236035_iter;
    int64_t futhark_mc_segmap_task_236035_total_time;
    int64_t futhark_mc_segmap_task_236035_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_236047_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_236047_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_236047_iter;
    int64_t futhark_mc_scan_stage_1_parloop_236047_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_236047_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_236047_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_236049_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_236049_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_236049_iter;
    int64_t futhark_mc_scan_stage_3_parloop_236049_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_236049_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_236049_total_iter;
    int64_t *futhark_mc_segscan_task_236044_total_runtime;
    int *futhark_mc_segscan_task_236044_runs;
    int64_t *futhark_mc_segscan_task_236044_iter;
    int64_t futhark_mc_segscan_task_236044_total_time;
    int64_t futhark_mc_segscan_task_236044_total_iter;
    int64_t *futhark_mc_segmap_parloop_236041_total_runtime;
    int *futhark_mc_segmap_parloop_236041_runs;
    int64_t *futhark_mc_segmap_parloop_236041_iter;
    int64_t futhark_mc_segmap_parloop_236041_total_total_runtime;
    int futhark_mc_segmap_parloop_236041_total_runs;
    int64_t futhark_mc_segmap_parloop_236041_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236039_total_runtime;
    int *futhark_mc_segmap_nested_task_236039_runs;
    int64_t *futhark_mc_segmap_nested_task_236039_iter;
    int64_t *futhark_mc_segmap_parloop_236053_total_runtime;
    int *futhark_mc_segmap_parloop_236053_runs;
    int64_t *futhark_mc_segmap_parloop_236053_iter;
    int64_t futhark_mc_segmap_parloop_236053_total_total_runtime;
    int futhark_mc_segmap_parloop_236053_total_runs;
    int64_t futhark_mc_segmap_parloop_236053_total_iter;
    int64_t *futhark_mc_segmap_task_236051_total_runtime;
    int *futhark_mc_segmap_task_236051_runs;
    int64_t *futhark_mc_segmap_task_236051_iter;
    int64_t futhark_mc_segmap_task_236051_total_time;
    int64_t futhark_mc_segmap_task_236051_total_iter;
    int64_t *futhark_mc_segmap_parloop_236062_total_runtime;
    int *futhark_mc_segmap_parloop_236062_runs;
    int64_t *futhark_mc_segmap_parloop_236062_iter;
    int64_t futhark_mc_segmap_parloop_236062_total_total_runtime;
    int futhark_mc_segmap_parloop_236062_total_runs;
    int64_t futhark_mc_segmap_parloop_236062_total_iter;
    int64_t *futhark_mc_segmap_task_236060_total_runtime;
    int *futhark_mc_segmap_task_236060_runs;
    int64_t *futhark_mc_segmap_task_236060_iter;
    int64_t futhark_mc_segmap_task_236060_total_time;
    int64_t futhark_mc_segmap_task_236060_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236070_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236070_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236070_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236070_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236070_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236070_total_iter;
    int64_t *futhark_mc_segred_task_236067_total_runtime;
    int *futhark_mc_segred_task_236067_runs;
    int64_t *futhark_mc_segred_task_236067_iter;
    int64_t futhark_mc_segred_task_236067_total_time;
    int64_t futhark_mc_segred_task_236067_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236075_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236075_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236075_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236075_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236075_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236075_total_iter;
    int64_t *futhark_mc_segred_task_236072_total_runtime;
    int *futhark_mc_segred_task_236072_runs;
    int64_t *futhark_mc_segred_task_236072_iter;
    int64_t futhark_mc_segred_task_236072_total_time;
    int64_t futhark_mc_segred_task_236072_total_iter;
    int64_t *futhark_mc_segmap_parloop_236065_total_runtime;
    int *futhark_mc_segmap_parloop_236065_runs;
    int64_t *futhark_mc_segmap_parloop_236065_iter;
    int64_t futhark_mc_segmap_parloop_236065_total_total_runtime;
    int futhark_mc_segmap_parloop_236065_total_runs;
    int64_t futhark_mc_segmap_parloop_236065_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236063_total_runtime;
    int *futhark_mc_segmap_nested_task_236063_runs;
    int64_t *futhark_mc_segmap_nested_task_236063_iter;
    int64_t *futhark_mc_segmap_parloop_236057_total_runtime;
    int *futhark_mc_segmap_parloop_236057_runs;
    int64_t *futhark_mc_segmap_parloop_236057_iter;
    int64_t futhark_mc_segmap_parloop_236057_total_total_runtime;
    int futhark_mc_segmap_parloop_236057_total_runs;
    int64_t futhark_mc_segmap_parloop_236057_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236055_total_runtime;
    int *futhark_mc_segmap_nested_task_236055_runs;
    int64_t *futhark_mc_segmap_nested_task_236055_iter;
    int64_t *futhark_mc_segmap_parloop_236079_total_runtime;
    int *futhark_mc_segmap_parloop_236079_runs;
    int64_t *futhark_mc_segmap_parloop_236079_iter;
    int64_t futhark_mc_segmap_parloop_236079_total_total_runtime;
    int futhark_mc_segmap_parloop_236079_total_runs;
    int64_t futhark_mc_segmap_parloop_236079_total_iter;
    int64_t *futhark_mc_segmap_task_236077_total_runtime;
    int *futhark_mc_segmap_task_236077_runs;
    int64_t *futhark_mc_segmap_task_236077_iter;
    int64_t futhark_mc_segmap_task_236077_total_time;
    int64_t futhark_mc_segmap_task_236077_total_iter;
    int64_t *futhark_mc_segmap_parloop_236090_total_runtime;
    int *futhark_mc_segmap_parloop_236090_runs;
    int64_t *futhark_mc_segmap_parloop_236090_iter;
    int64_t futhark_mc_segmap_parloop_236090_total_total_runtime;
    int futhark_mc_segmap_parloop_236090_total_runs;
    int64_t futhark_mc_segmap_parloop_236090_total_iter;
    int64_t *futhark_mc_segmap_task_236088_total_runtime;
    int *futhark_mc_segmap_task_236088_runs;
    int64_t *futhark_mc_segmap_task_236088_iter;
    int64_t futhark_mc_segmap_task_236088_total_time;
    int64_t futhark_mc_segmap_task_236088_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236100_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236100_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236100_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236100_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236100_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236100_total_iter;
    int64_t *futhark_mc_segred_task_236095_total_runtime;
    int *futhark_mc_segred_task_236095_runs;
    int64_t *futhark_mc_segred_task_236095_iter;
    int64_t futhark_mc_segred_task_236095_total_time;
    int64_t futhark_mc_segred_task_236095_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236106_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236106_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236106_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236106_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236106_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236106_total_iter;
    int64_t *futhark_mc_segred_task_236102_total_runtime;
    int *futhark_mc_segred_task_236102_runs;
    int64_t *futhark_mc_segred_task_236102_iter;
    int64_t futhark_mc_segred_task_236102_total_time;
    int64_t futhark_mc_segred_task_236102_total_iter;
    int64_t *futhark_mc_segmap_parloop_236093_total_runtime;
    int *futhark_mc_segmap_parloop_236093_runs;
    int64_t *futhark_mc_segmap_parloop_236093_iter;
    int64_t futhark_mc_segmap_parloop_236093_total_total_runtime;
    int futhark_mc_segmap_parloop_236093_total_runs;
    int64_t futhark_mc_segmap_parloop_236093_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236091_total_runtime;
    int *futhark_mc_segmap_nested_task_236091_runs;
    int64_t *futhark_mc_segmap_nested_task_236091_iter;
    int64_t *futhark_mc_segmap_parloop_236084_total_runtime;
    int *futhark_mc_segmap_parloop_236084_runs;
    int64_t *futhark_mc_segmap_parloop_236084_iter;
    int64_t futhark_mc_segmap_parloop_236084_total_total_runtime;
    int futhark_mc_segmap_parloop_236084_total_runs;
    int64_t futhark_mc_segmap_parloop_236084_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236082_total_runtime;
    int *futhark_mc_segmap_nested_task_236082_runs;
    int64_t *futhark_mc_segmap_nested_task_236082_iter;
    int64_t *futhark_mc_segmap_parloop_236110_total_runtime;
    int *futhark_mc_segmap_parloop_236110_runs;
    int64_t *futhark_mc_segmap_parloop_236110_iter;
    int64_t futhark_mc_segmap_parloop_236110_total_total_runtime;
    int futhark_mc_segmap_parloop_236110_total_runs;
    int64_t futhark_mc_segmap_parloop_236110_total_iter;
    int64_t *futhark_mc_segmap_task_236108_total_runtime;
    int *futhark_mc_segmap_task_236108_runs;
    int64_t *futhark_mc_segmap_task_236108_iter;
    int64_t futhark_mc_segmap_task_236108_total_time;
    int64_t futhark_mc_segmap_task_236108_total_iter;
    int64_t *futhark_mc_segmap_parloop_236121_total_runtime;
    int *futhark_mc_segmap_parloop_236121_runs;
    int64_t *futhark_mc_segmap_parloop_236121_iter;
    int64_t futhark_mc_segmap_parloop_236121_total_total_runtime;
    int futhark_mc_segmap_parloop_236121_total_runs;
    int64_t futhark_mc_segmap_parloop_236121_total_iter;
    int64_t *futhark_mc_segmap_task_236119_total_runtime;
    int *futhark_mc_segmap_task_236119_runs;
    int64_t *futhark_mc_segmap_task_236119_iter;
    int64_t futhark_mc_segmap_task_236119_total_time;
    int64_t futhark_mc_segmap_task_236119_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236133_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236133_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236133_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236133_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236133_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236133_total_iter;
    int64_t *futhark_mc_segred_task_236126_total_runtime;
    int *futhark_mc_segred_task_236126_runs;
    int64_t *futhark_mc_segred_task_236126_iter;
    int64_t futhark_mc_segred_task_236126_total_time;
    int64_t futhark_mc_segred_task_236126_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236139_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236139_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236139_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236139_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236139_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236139_total_iter;
    int64_t *futhark_mc_segred_task_236135_total_runtime;
    int *futhark_mc_segred_task_236135_runs;
    int64_t *futhark_mc_segred_task_236135_iter;
    int64_t futhark_mc_segred_task_236135_total_time;
    int64_t futhark_mc_segred_task_236135_total_iter;
    int64_t *futhark_mc_segmap_parloop_236124_total_runtime;
    int *futhark_mc_segmap_parloop_236124_runs;
    int64_t *futhark_mc_segmap_parloop_236124_iter;
    int64_t futhark_mc_segmap_parloop_236124_total_total_runtime;
    int futhark_mc_segmap_parloop_236124_total_runs;
    int64_t futhark_mc_segmap_parloop_236124_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236122_total_runtime;
    int *futhark_mc_segmap_nested_task_236122_runs;
    int64_t *futhark_mc_segmap_nested_task_236122_iter;
    int64_t *futhark_mc_segmap_parloop_236115_total_runtime;
    int *futhark_mc_segmap_parloop_236115_runs;
    int64_t *futhark_mc_segmap_parloop_236115_iter;
    int64_t futhark_mc_segmap_parloop_236115_total_total_runtime;
    int futhark_mc_segmap_parloop_236115_total_runs;
    int64_t futhark_mc_segmap_parloop_236115_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236113_total_runtime;
    int *futhark_mc_segmap_nested_task_236113_runs;
    int64_t *futhark_mc_segmap_nested_task_236113_iter;
    int64_t *futhark_mc_segmap_parloop_236143_total_runtime;
    int *futhark_mc_segmap_parloop_236143_runs;
    int64_t *futhark_mc_segmap_parloop_236143_iter;
    int64_t futhark_mc_segmap_parloop_236143_total_total_runtime;
    int futhark_mc_segmap_parloop_236143_total_runs;
    int64_t futhark_mc_segmap_parloop_236143_total_iter;
    int64_t *futhark_mc_segmap_task_236141_total_runtime;
    int *futhark_mc_segmap_task_236141_runs;
    int64_t *futhark_mc_segmap_task_236141_iter;
    int64_t futhark_mc_segmap_task_236141_total_time;
    int64_t futhark_mc_segmap_task_236141_total_iter;
    int64_t *futhark_mc_segmap_parloop_236153_total_runtime;
    int *futhark_mc_segmap_parloop_236153_runs;
    int64_t *futhark_mc_segmap_parloop_236153_iter;
    int64_t futhark_mc_segmap_parloop_236153_total_total_runtime;
    int futhark_mc_segmap_parloop_236153_total_runs;
    int64_t futhark_mc_segmap_parloop_236153_total_iter;
    int64_t *futhark_mc_segmap_task_236151_total_runtime;
    int *futhark_mc_segmap_task_236151_runs;
    int64_t *futhark_mc_segmap_task_236151_iter;
    int64_t futhark_mc_segmap_task_236151_total_time;
    int64_t futhark_mc_segmap_task_236151_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236163_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236163_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236163_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236163_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236163_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236163_total_iter;
    int64_t *futhark_mc_segred_task_236160_total_runtime;
    int *futhark_mc_segred_task_236160_runs;
    int64_t *futhark_mc_segred_task_236160_iter;
    int64_t futhark_mc_segred_task_236160_total_time;
    int64_t futhark_mc_segred_task_236160_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236168_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236168_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236168_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236168_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236168_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236168_total_iter;
    int64_t *futhark_mc_segred_task_236165_total_runtime;
    int *futhark_mc_segred_task_236165_runs;
    int64_t *futhark_mc_segred_task_236165_iter;
    int64_t futhark_mc_segred_task_236165_total_time;
    int64_t futhark_mc_segred_task_236165_total_iter;
    int64_t *futhark_mc_segmap_parloop_236157_total_runtime;
    int *futhark_mc_segmap_parloop_236157_runs;
    int64_t *futhark_mc_segmap_parloop_236157_iter;
    int64_t futhark_mc_segmap_parloop_236157_total_total_runtime;
    int futhark_mc_segmap_parloop_236157_total_runs;
    int64_t futhark_mc_segmap_parloop_236157_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236155_total_runtime;
    int *futhark_mc_segmap_nested_task_236155_runs;
    int64_t *futhark_mc_segmap_nested_task_236155_iter;
    int64_t *futhark_mc_segmap_parloop_236148_total_runtime;
    int *futhark_mc_segmap_parloop_236148_runs;
    int64_t *futhark_mc_segmap_parloop_236148_iter;
    int64_t futhark_mc_segmap_parloop_236148_total_total_runtime;
    int futhark_mc_segmap_parloop_236148_total_runs;
    int64_t futhark_mc_segmap_parloop_236148_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236146_total_runtime;
    int *futhark_mc_segmap_nested_task_236146_runs;
    int64_t *futhark_mc_segmap_nested_task_236146_iter;
    int64_t *futhark_mc_segmap_parloop_236172_total_runtime;
    int *futhark_mc_segmap_parloop_236172_runs;
    int64_t *futhark_mc_segmap_parloop_236172_iter;
    int64_t futhark_mc_segmap_parloop_236172_total_total_runtime;
    int futhark_mc_segmap_parloop_236172_total_runs;
    int64_t futhark_mc_segmap_parloop_236172_total_iter;
    int64_t *futhark_mc_segmap_task_236170_total_runtime;
    int *futhark_mc_segmap_task_236170_runs;
    int64_t *futhark_mc_segmap_task_236170_iter;
    int64_t futhark_mc_segmap_task_236170_total_time;
    int64_t futhark_mc_segmap_task_236170_total_iter;
    int64_t *futhark_mc_segmap_parloop_236185_total_runtime;
    int *futhark_mc_segmap_parloop_236185_runs;
    int64_t *futhark_mc_segmap_parloop_236185_iter;
    int64_t futhark_mc_segmap_parloop_236185_total_total_runtime;
    int futhark_mc_segmap_parloop_236185_total_runs;
    int64_t futhark_mc_segmap_parloop_236185_total_iter;
    int64_t *futhark_mc_segmap_task_236183_total_runtime;
    int *futhark_mc_segmap_task_236183_runs;
    int64_t *futhark_mc_segmap_task_236183_iter;
    int64_t futhark_mc_segmap_task_236183_total_time;
    int64_t futhark_mc_segmap_task_236183_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236199_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236199_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236199_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236199_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236199_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236199_total_iter;
    int64_t *futhark_mc_segred_task_236194_total_runtime;
    int *futhark_mc_segred_task_236194_runs;
    int64_t *futhark_mc_segred_task_236194_iter;
    int64_t futhark_mc_segred_task_236194_total_time;
    int64_t futhark_mc_segred_task_236194_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236205_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236205_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236205_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236205_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236205_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236205_total_iter;
    int64_t *futhark_mc_segred_task_236201_total_runtime;
    int *futhark_mc_segred_task_236201_runs;
    int64_t *futhark_mc_segred_task_236201_iter;
    int64_t futhark_mc_segred_task_236201_total_time;
    int64_t futhark_mc_segred_task_236201_total_iter;
    int64_t *futhark_mc_segmap_parloop_236190_total_runtime;
    int *futhark_mc_segmap_parloop_236190_runs;
    int64_t *futhark_mc_segmap_parloop_236190_iter;
    int64_t futhark_mc_segmap_parloop_236190_total_total_runtime;
    int futhark_mc_segmap_parloop_236190_total_runs;
    int64_t futhark_mc_segmap_parloop_236190_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236188_total_runtime;
    int *futhark_mc_segmap_nested_task_236188_runs;
    int64_t *futhark_mc_segmap_nested_task_236188_iter;
    int64_t *futhark_mc_segmap_parloop_236179_total_runtime;
    int *futhark_mc_segmap_parloop_236179_runs;
    int64_t *futhark_mc_segmap_parloop_236179_iter;
    int64_t futhark_mc_segmap_parloop_236179_total_total_runtime;
    int futhark_mc_segmap_parloop_236179_total_runs;
    int64_t futhark_mc_segmap_parloop_236179_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236177_total_runtime;
    int *futhark_mc_segmap_nested_task_236177_runs;
    int64_t *futhark_mc_segmap_nested_task_236177_iter;
    int64_t *futhark_mc_segmap_parloop_236209_total_runtime;
    int *futhark_mc_segmap_parloop_236209_runs;
    int64_t *futhark_mc_segmap_parloop_236209_iter;
    int64_t futhark_mc_segmap_parloop_236209_total_total_runtime;
    int futhark_mc_segmap_parloop_236209_total_runs;
    int64_t futhark_mc_segmap_parloop_236209_total_iter;
    int64_t *futhark_mc_segmap_task_236207_total_runtime;
    int *futhark_mc_segmap_task_236207_runs;
    int64_t *futhark_mc_segmap_task_236207_iter;
    int64_t futhark_mc_segmap_task_236207_total_time;
    int64_t futhark_mc_segmap_task_236207_total_iter;
    int64_t *futhark_mc_segmap_parloop_236224_total_runtime;
    int *futhark_mc_segmap_parloop_236224_runs;
    int64_t *futhark_mc_segmap_parloop_236224_iter;
    int64_t futhark_mc_segmap_parloop_236224_total_total_runtime;
    int futhark_mc_segmap_parloop_236224_total_runs;
    int64_t futhark_mc_segmap_parloop_236224_total_iter;
    int64_t *futhark_mc_segmap_task_236222_total_runtime;
    int *futhark_mc_segmap_task_236222_runs;
    int64_t *futhark_mc_segmap_task_236222_iter;
    int64_t futhark_mc_segmap_task_236222_total_time;
    int64_t futhark_mc_segmap_task_236222_total_iter;
    int64_t *futhark_mc_segmap_parloop_236239_total_runtime;
    int *futhark_mc_segmap_parloop_236239_runs;
    int64_t *futhark_mc_segmap_parloop_236239_iter;
    int64_t futhark_mc_segmap_parloop_236239_total_total_runtime;
    int futhark_mc_segmap_parloop_236239_total_runs;
    int64_t futhark_mc_segmap_parloop_236239_total_iter;
    int64_t *futhark_mc_segmap_task_236237_total_runtime;
    int *futhark_mc_segmap_task_236237_runs;
    int64_t *futhark_mc_segmap_task_236237_iter;
    int64_t futhark_mc_segmap_task_236237_total_time;
    int64_t futhark_mc_segmap_task_236237_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236248_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236248_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236248_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236248_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236248_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236248_total_iter;
    int64_t *futhark_mc_segred_task_236241_total_runtime;
    int *futhark_mc_segred_task_236241_runs;
    int64_t *futhark_mc_segred_task_236241_iter;
    int64_t futhark_mc_segred_task_236241_total_time;
    int64_t futhark_mc_segred_task_236241_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236254_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236254_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236254_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236254_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236254_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236254_total_iter;
    int64_t *futhark_mc_segred_task_236250_total_runtime;
    int *futhark_mc_segred_task_236250_runs;
    int64_t *futhark_mc_segred_task_236250_iter;
    int64_t futhark_mc_segred_task_236250_total_time;
    int64_t futhark_mc_segred_task_236250_total_iter;
    int64_t *futhark_mc_segmap_parloop_236231_total_runtime;
    int *futhark_mc_segmap_parloop_236231_runs;
    int64_t *futhark_mc_segmap_parloop_236231_iter;
    int64_t futhark_mc_segmap_parloop_236231_total_total_runtime;
    int futhark_mc_segmap_parloop_236231_total_runs;
    int64_t futhark_mc_segmap_parloop_236231_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236229_total_runtime;
    int *futhark_mc_segmap_nested_task_236229_runs;
    int64_t *futhark_mc_segmap_nested_task_236229_iter;
    int64_t *futhark_mc_segmap_parloop_236218_total_runtime;
    int *futhark_mc_segmap_parloop_236218_runs;
    int64_t *futhark_mc_segmap_parloop_236218_iter;
    int64_t futhark_mc_segmap_parloop_236218_total_total_runtime;
    int futhark_mc_segmap_parloop_236218_total_runs;
    int64_t futhark_mc_segmap_parloop_236218_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236216_total_runtime;
    int *futhark_mc_segmap_nested_task_236216_runs;
    int64_t *futhark_mc_segmap_nested_task_236216_iter;
    int64_t *futhark_mc_segmap_parloop_236258_total_runtime;
    int *futhark_mc_segmap_parloop_236258_runs;
    int64_t *futhark_mc_segmap_parloop_236258_iter;
    int64_t futhark_mc_segmap_parloop_236258_total_total_runtime;
    int futhark_mc_segmap_parloop_236258_total_runs;
    int64_t futhark_mc_segmap_parloop_236258_total_iter;
    int64_t *futhark_mc_segmap_task_236256_total_runtime;
    int *futhark_mc_segmap_task_236256_runs;
    int64_t *futhark_mc_segmap_task_236256_iter;
    int64_t futhark_mc_segmap_task_236256_total_time;
    int64_t futhark_mc_segmap_task_236256_total_iter;
    int64_t *futhark_mc_segmap_parloop_236267_total_runtime;
    int *futhark_mc_segmap_parloop_236267_runs;
    int64_t *futhark_mc_segmap_parloop_236267_iter;
    int64_t futhark_mc_segmap_parloop_236267_total_total_runtime;
    int futhark_mc_segmap_parloop_236267_total_runs;
    int64_t futhark_mc_segmap_parloop_236267_total_iter;
    int64_t *futhark_mc_segmap_task_236265_total_runtime;
    int *futhark_mc_segmap_task_236265_runs;
    int64_t *futhark_mc_segmap_task_236265_iter;
    int64_t futhark_mc_segmap_task_236265_total_time;
    int64_t futhark_mc_segmap_task_236265_total_iter;
    int64_t *futhark_mc_segmap_parloop_236262_total_runtime;
    int *futhark_mc_segmap_parloop_236262_runs;
    int64_t *futhark_mc_segmap_parloop_236262_iter;
    int64_t futhark_mc_segmap_parloop_236262_total_total_runtime;
    int futhark_mc_segmap_parloop_236262_total_runs;
    int64_t futhark_mc_segmap_parloop_236262_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236260_total_runtime;
    int *futhark_mc_segmap_nested_task_236260_runs;
    int64_t *futhark_mc_segmap_nested_task_236260_iter;
    int64_t *futhark_mc_segmap_parloop_236271_total_runtime;
    int *futhark_mc_segmap_parloop_236271_runs;
    int64_t *futhark_mc_segmap_parloop_236271_iter;
    int64_t futhark_mc_segmap_parloop_236271_total_total_runtime;
    int futhark_mc_segmap_parloop_236271_total_runs;
    int64_t futhark_mc_segmap_parloop_236271_total_iter;
    int64_t *futhark_mc_segmap_task_236269_total_runtime;
    int *futhark_mc_segmap_task_236269_runs;
    int64_t *futhark_mc_segmap_task_236269_iter;
    int64_t futhark_mc_segmap_task_236269_total_time;
    int64_t futhark_mc_segmap_task_236269_total_iter;
    int64_t *futhark_mc_segmap_parloop_236280_total_runtime;
    int *futhark_mc_segmap_parloop_236280_runs;
    int64_t *futhark_mc_segmap_parloop_236280_iter;
    int64_t futhark_mc_segmap_parloop_236280_total_total_runtime;
    int futhark_mc_segmap_parloop_236280_total_runs;
    int64_t futhark_mc_segmap_parloop_236280_total_iter;
    int64_t *futhark_mc_segmap_task_236278_total_runtime;
    int *futhark_mc_segmap_task_236278_runs;
    int64_t *futhark_mc_segmap_task_236278_iter;
    int64_t futhark_mc_segmap_task_236278_total_time;
    int64_t futhark_mc_segmap_task_236278_total_iter;
    int64_t *futhark_mc_segmap_parloop_236275_total_runtime;
    int *futhark_mc_segmap_parloop_236275_runs;
    int64_t *futhark_mc_segmap_parloop_236275_iter;
    int64_t futhark_mc_segmap_parloop_236275_total_total_runtime;
    int futhark_mc_segmap_parloop_236275_total_runs;
    int64_t futhark_mc_segmap_parloop_236275_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236273_total_runtime;
    int *futhark_mc_segmap_nested_task_236273_runs;
    int64_t *futhark_mc_segmap_nested_task_236273_iter;
    int64_t *futhark_mc_segmap_parloop_236284_total_runtime;
    int *futhark_mc_segmap_parloop_236284_runs;
    int64_t *futhark_mc_segmap_parloop_236284_iter;
    int64_t futhark_mc_segmap_parloop_236284_total_total_runtime;
    int futhark_mc_segmap_parloop_236284_total_runs;
    int64_t futhark_mc_segmap_parloop_236284_total_iter;
    int64_t *futhark_mc_segmap_task_236282_total_runtime;
    int *futhark_mc_segmap_task_236282_runs;
    int64_t *futhark_mc_segmap_task_236282_iter;
    int64_t futhark_mc_segmap_task_236282_total_time;
    int64_t futhark_mc_segmap_task_236282_total_iter;
    int64_t *futhark_mc_segmap_parloop_236299_total_runtime;
    int *futhark_mc_segmap_parloop_236299_runs;
    int64_t *futhark_mc_segmap_parloop_236299_iter;
    int64_t futhark_mc_segmap_parloop_236299_total_total_runtime;
    int futhark_mc_segmap_parloop_236299_total_runs;
    int64_t futhark_mc_segmap_parloop_236299_total_iter;
    int64_t *futhark_mc_segmap_task_236297_total_runtime;
    int *futhark_mc_segmap_task_236297_runs;
    int64_t *futhark_mc_segmap_task_236297_iter;
    int64_t futhark_mc_segmap_task_236297_total_time;
    int64_t futhark_mc_segmap_task_236297_total_iter;
    int64_t *futhark_mc_segmap_parloop_236303_total_runtime;
    int *futhark_mc_segmap_parloop_236303_runs;
    int64_t *futhark_mc_segmap_parloop_236303_iter;
    int64_t futhark_mc_segmap_parloop_236303_total_total_runtime;
    int futhark_mc_segmap_parloop_236303_total_runs;
    int64_t futhark_mc_segmap_parloop_236303_total_iter;
    int64_t *futhark_mc_segmap_task_236301_total_runtime;
    int *futhark_mc_segmap_task_236301_runs;
    int64_t *futhark_mc_segmap_task_236301_iter;
    int64_t futhark_mc_segmap_task_236301_total_time;
    int64_t futhark_mc_segmap_task_236301_total_iter;
    int64_t *futhark_mc_segmap_parloop_236307_total_runtime;
    int *futhark_mc_segmap_parloop_236307_runs;
    int64_t *futhark_mc_segmap_parloop_236307_iter;
    int64_t futhark_mc_segmap_parloop_236307_total_total_runtime;
    int futhark_mc_segmap_parloop_236307_total_runs;
    int64_t futhark_mc_segmap_parloop_236307_total_iter;
    int64_t *futhark_mc_segmap_task_236305_total_runtime;
    int *futhark_mc_segmap_task_236305_runs;
    int64_t *futhark_mc_segmap_task_236305_iter;
    int64_t futhark_mc_segmap_task_236305_total_time;
    int64_t futhark_mc_segmap_task_236305_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236315_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236315_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236315_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236315_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236315_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236315_total_iter;
    int64_t *futhark_mc_segred_task_236312_total_runtime;
    int *futhark_mc_segred_task_236312_runs;
    int64_t *futhark_mc_segred_task_236312_iter;
    int64_t futhark_mc_segred_task_236312_total_time;
    int64_t futhark_mc_segred_task_236312_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236320_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236320_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236320_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236320_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236320_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236320_total_iter;
    int64_t *futhark_mc_segred_task_236317_total_runtime;
    int *futhark_mc_segred_task_236317_runs;
    int64_t *futhark_mc_segred_task_236317_iter;
    int64_t futhark_mc_segred_task_236317_total_time;
    int64_t futhark_mc_segred_task_236317_total_iter;
    int64_t *futhark_mc_segmap_parloop_236310_total_runtime;
    int *futhark_mc_segmap_parloop_236310_runs;
    int64_t *futhark_mc_segmap_parloop_236310_iter;
    int64_t futhark_mc_segmap_parloop_236310_total_total_runtime;
    int futhark_mc_segmap_parloop_236310_total_runs;
    int64_t futhark_mc_segmap_parloop_236310_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236308_total_runtime;
    int *futhark_mc_segmap_nested_task_236308_runs;
    int64_t *futhark_mc_segmap_nested_task_236308_iter;
    int64_t *futhark_mc_segmap_parloop_236291_total_runtime;
    int *futhark_mc_segmap_parloop_236291_runs;
    int64_t *futhark_mc_segmap_parloop_236291_iter;
    int64_t futhark_mc_segmap_parloop_236291_total_total_runtime;
    int futhark_mc_segmap_parloop_236291_total_runs;
    int64_t futhark_mc_segmap_parloop_236291_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236289_total_runtime;
    int *futhark_mc_segmap_nested_task_236289_runs;
    int64_t *futhark_mc_segmap_nested_task_236289_iter;
    int64_t *futhark_mc_segmap_parloop_236324_total_runtime;
    int *futhark_mc_segmap_parloop_236324_runs;
    int64_t *futhark_mc_segmap_parloop_236324_iter;
    int64_t futhark_mc_segmap_parloop_236324_total_total_runtime;
    int futhark_mc_segmap_parloop_236324_total_runs;
    int64_t futhark_mc_segmap_parloop_236324_total_iter;
    int64_t *futhark_mc_segmap_task_236322_total_runtime;
    int *futhark_mc_segmap_task_236322_runs;
    int64_t *futhark_mc_segmap_task_236322_iter;
    int64_t futhark_mc_segmap_task_236322_total_time;
    int64_t futhark_mc_segmap_task_236322_total_iter;
    int64_t *futhark_mc_segmap_parloop_236341_total_runtime;
    int *futhark_mc_segmap_parloop_236341_runs;
    int64_t *futhark_mc_segmap_parloop_236341_iter;
    int64_t futhark_mc_segmap_parloop_236341_total_total_runtime;
    int futhark_mc_segmap_parloop_236341_total_runs;
    int64_t futhark_mc_segmap_parloop_236341_total_iter;
    int64_t *futhark_mc_segmap_task_236339_total_runtime;
    int *futhark_mc_segmap_task_236339_runs;
    int64_t *futhark_mc_segmap_task_236339_iter;
    int64_t futhark_mc_segmap_task_236339_total_time;
    int64_t futhark_mc_segmap_task_236339_total_iter;
    int64_t *futhark_mc_segmap_parloop_236345_total_runtime;
    int *futhark_mc_segmap_parloop_236345_runs;
    int64_t *futhark_mc_segmap_parloop_236345_iter;
    int64_t futhark_mc_segmap_parloop_236345_total_total_runtime;
    int futhark_mc_segmap_parloop_236345_total_runs;
    int64_t futhark_mc_segmap_parloop_236345_total_iter;
    int64_t *futhark_mc_segmap_task_236343_total_runtime;
    int *futhark_mc_segmap_task_236343_runs;
    int64_t *futhark_mc_segmap_task_236343_iter;
    int64_t futhark_mc_segmap_task_236343_total_time;
    int64_t futhark_mc_segmap_task_236343_total_iter;
    int64_t *futhark_mc_segmap_parloop_236349_total_runtime;
    int *futhark_mc_segmap_parloop_236349_runs;
    int64_t *futhark_mc_segmap_parloop_236349_iter;
    int64_t futhark_mc_segmap_parloop_236349_total_total_runtime;
    int futhark_mc_segmap_parloop_236349_total_runs;
    int64_t futhark_mc_segmap_parloop_236349_total_iter;
    int64_t *futhark_mc_segmap_task_236347_total_runtime;
    int *futhark_mc_segmap_task_236347_runs;
    int64_t *futhark_mc_segmap_task_236347_iter;
    int64_t futhark_mc_segmap_task_236347_total_time;
    int64_t futhark_mc_segmap_task_236347_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236359_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236359_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236359_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236359_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236359_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236359_total_iter;
    int64_t *futhark_mc_segred_task_236354_total_runtime;
    int *futhark_mc_segred_task_236354_runs;
    int64_t *futhark_mc_segred_task_236354_iter;
    int64_t futhark_mc_segred_task_236354_total_time;
    int64_t futhark_mc_segred_task_236354_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236365_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236365_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236365_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236365_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236365_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236365_total_iter;
    int64_t *futhark_mc_segred_task_236361_total_runtime;
    int *futhark_mc_segred_task_236361_runs;
    int64_t *futhark_mc_segred_task_236361_iter;
    int64_t futhark_mc_segred_task_236361_total_time;
    int64_t futhark_mc_segred_task_236361_total_iter;
    int64_t *futhark_mc_segmap_parloop_236352_total_runtime;
    int *futhark_mc_segmap_parloop_236352_runs;
    int64_t *futhark_mc_segmap_parloop_236352_iter;
    int64_t futhark_mc_segmap_parloop_236352_total_total_runtime;
    int futhark_mc_segmap_parloop_236352_total_runs;
    int64_t futhark_mc_segmap_parloop_236352_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236350_total_runtime;
    int *futhark_mc_segmap_nested_task_236350_runs;
    int64_t *futhark_mc_segmap_nested_task_236350_iter;
    int64_t *futhark_mc_segmap_parloop_236332_total_runtime;
    int *futhark_mc_segmap_parloop_236332_runs;
    int64_t *futhark_mc_segmap_parloop_236332_iter;
    int64_t futhark_mc_segmap_parloop_236332_total_total_runtime;
    int futhark_mc_segmap_parloop_236332_total_runs;
    int64_t futhark_mc_segmap_parloop_236332_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236330_total_runtime;
    int *futhark_mc_segmap_nested_task_236330_runs;
    int64_t *futhark_mc_segmap_nested_task_236330_iter;
    int64_t *futhark_mc_segmap_parloop_236369_total_runtime;
    int *futhark_mc_segmap_parloop_236369_runs;
    int64_t *futhark_mc_segmap_parloop_236369_iter;
    int64_t futhark_mc_segmap_parloop_236369_total_total_runtime;
    int futhark_mc_segmap_parloop_236369_total_runs;
    int64_t futhark_mc_segmap_parloop_236369_total_iter;
    int64_t *futhark_mc_segmap_task_236367_total_runtime;
    int *futhark_mc_segmap_task_236367_runs;
    int64_t *futhark_mc_segmap_task_236367_iter;
    int64_t futhark_mc_segmap_task_236367_total_time;
    int64_t futhark_mc_segmap_task_236367_total_iter;
    int64_t *futhark_mc_segmap_parloop_236386_total_runtime;
    int *futhark_mc_segmap_parloop_236386_runs;
    int64_t *futhark_mc_segmap_parloop_236386_iter;
    int64_t futhark_mc_segmap_parloop_236386_total_total_runtime;
    int futhark_mc_segmap_parloop_236386_total_runs;
    int64_t futhark_mc_segmap_parloop_236386_total_iter;
    int64_t *futhark_mc_segmap_task_236384_total_runtime;
    int *futhark_mc_segmap_task_236384_runs;
    int64_t *futhark_mc_segmap_task_236384_iter;
    int64_t futhark_mc_segmap_task_236384_total_time;
    int64_t futhark_mc_segmap_task_236384_total_iter;
    int64_t *futhark_mc_segmap_parloop_236390_total_runtime;
    int *futhark_mc_segmap_parloop_236390_runs;
    int64_t *futhark_mc_segmap_parloop_236390_iter;
    int64_t futhark_mc_segmap_parloop_236390_total_total_runtime;
    int futhark_mc_segmap_parloop_236390_total_runs;
    int64_t futhark_mc_segmap_parloop_236390_total_iter;
    int64_t *futhark_mc_segmap_task_236388_total_runtime;
    int *futhark_mc_segmap_task_236388_runs;
    int64_t *futhark_mc_segmap_task_236388_iter;
    int64_t futhark_mc_segmap_task_236388_total_time;
    int64_t futhark_mc_segmap_task_236388_total_iter;
    int64_t *futhark_mc_segmap_parloop_236394_total_runtime;
    int *futhark_mc_segmap_parloop_236394_runs;
    int64_t *futhark_mc_segmap_parloop_236394_iter;
    int64_t futhark_mc_segmap_parloop_236394_total_total_runtime;
    int futhark_mc_segmap_parloop_236394_total_runs;
    int64_t futhark_mc_segmap_parloop_236394_total_iter;
    int64_t *futhark_mc_segmap_task_236392_total_runtime;
    int *futhark_mc_segmap_task_236392_runs;
    int64_t *futhark_mc_segmap_task_236392_iter;
    int64_t futhark_mc_segmap_task_236392_total_time;
    int64_t futhark_mc_segmap_task_236392_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236406_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236406_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236406_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236406_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236406_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236406_total_iter;
    int64_t *futhark_mc_segred_task_236399_total_runtime;
    int *futhark_mc_segred_task_236399_runs;
    int64_t *futhark_mc_segred_task_236399_iter;
    int64_t futhark_mc_segred_task_236399_total_time;
    int64_t futhark_mc_segred_task_236399_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236412_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236412_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236412_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236412_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236412_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236412_total_iter;
    int64_t *futhark_mc_segred_task_236408_total_runtime;
    int *futhark_mc_segred_task_236408_runs;
    int64_t *futhark_mc_segred_task_236408_iter;
    int64_t futhark_mc_segred_task_236408_total_time;
    int64_t futhark_mc_segred_task_236408_total_iter;
    int64_t *futhark_mc_segmap_parloop_236397_total_runtime;
    int *futhark_mc_segmap_parloop_236397_runs;
    int64_t *futhark_mc_segmap_parloop_236397_iter;
    int64_t futhark_mc_segmap_parloop_236397_total_total_runtime;
    int futhark_mc_segmap_parloop_236397_total_runs;
    int64_t futhark_mc_segmap_parloop_236397_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236395_total_runtime;
    int *futhark_mc_segmap_nested_task_236395_runs;
    int64_t *futhark_mc_segmap_nested_task_236395_iter;
    int64_t *futhark_mc_segmap_parloop_236377_total_runtime;
    int *futhark_mc_segmap_parloop_236377_runs;
    int64_t *futhark_mc_segmap_parloop_236377_iter;
    int64_t futhark_mc_segmap_parloop_236377_total_total_runtime;
    int futhark_mc_segmap_parloop_236377_total_runs;
    int64_t futhark_mc_segmap_parloop_236377_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236375_total_runtime;
    int *futhark_mc_segmap_nested_task_236375_runs;
    int64_t *futhark_mc_segmap_nested_task_236375_iter;
    int64_t *futhark_mc_segmap_parloop_236416_total_runtime;
    int *futhark_mc_segmap_parloop_236416_runs;
    int64_t *futhark_mc_segmap_parloop_236416_iter;
    int64_t futhark_mc_segmap_parloop_236416_total_total_runtime;
    int futhark_mc_segmap_parloop_236416_total_runs;
    int64_t futhark_mc_segmap_parloop_236416_total_iter;
    int64_t *futhark_mc_segmap_task_236414_total_runtime;
    int *futhark_mc_segmap_task_236414_runs;
    int64_t *futhark_mc_segmap_task_236414_iter;
    int64_t futhark_mc_segmap_task_236414_total_time;
    int64_t futhark_mc_segmap_task_236414_total_iter;
    int64_t *futhark_mc_segmap_parloop_236432_total_runtime;
    int *futhark_mc_segmap_parloop_236432_runs;
    int64_t *futhark_mc_segmap_parloop_236432_iter;
    int64_t futhark_mc_segmap_parloop_236432_total_total_runtime;
    int futhark_mc_segmap_parloop_236432_total_runs;
    int64_t futhark_mc_segmap_parloop_236432_total_iter;
    int64_t *futhark_mc_segmap_task_236430_total_runtime;
    int *futhark_mc_segmap_task_236430_runs;
    int64_t *futhark_mc_segmap_task_236430_iter;
    int64_t futhark_mc_segmap_task_236430_total_time;
    int64_t futhark_mc_segmap_task_236430_total_iter;
    int64_t *futhark_mc_segmap_parloop_236436_total_runtime;
    int *futhark_mc_segmap_parloop_236436_runs;
    int64_t *futhark_mc_segmap_parloop_236436_iter;
    int64_t futhark_mc_segmap_parloop_236436_total_total_runtime;
    int futhark_mc_segmap_parloop_236436_total_runs;
    int64_t futhark_mc_segmap_parloop_236436_total_iter;
    int64_t *futhark_mc_segmap_task_236434_total_runtime;
    int *futhark_mc_segmap_task_236434_runs;
    int64_t *futhark_mc_segmap_task_236434_iter;
    int64_t futhark_mc_segmap_task_236434_total_time;
    int64_t futhark_mc_segmap_task_236434_total_iter;
    int64_t *futhark_mc_segmap_parloop_236440_total_runtime;
    int *futhark_mc_segmap_parloop_236440_runs;
    int64_t *futhark_mc_segmap_parloop_236440_iter;
    int64_t futhark_mc_segmap_parloop_236440_total_total_runtime;
    int futhark_mc_segmap_parloop_236440_total_runs;
    int64_t futhark_mc_segmap_parloop_236440_total_iter;
    int64_t *futhark_mc_segmap_task_236438_total_runtime;
    int *futhark_mc_segmap_task_236438_runs;
    int64_t *futhark_mc_segmap_task_236438_iter;
    int64_t futhark_mc_segmap_task_236438_total_time;
    int64_t futhark_mc_segmap_task_236438_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236450_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236450_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236450_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236450_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236450_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236450_total_iter;
    int64_t *futhark_mc_segred_task_236447_total_runtime;
    int *futhark_mc_segred_task_236447_runs;
    int64_t *futhark_mc_segred_task_236447_iter;
    int64_t futhark_mc_segred_task_236447_total_time;
    int64_t futhark_mc_segred_task_236447_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236455_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236455_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236455_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236455_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236455_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236455_total_iter;
    int64_t *futhark_mc_segred_task_236452_total_runtime;
    int *futhark_mc_segred_task_236452_runs;
    int64_t *futhark_mc_segred_task_236452_iter;
    int64_t futhark_mc_segred_task_236452_total_time;
    int64_t futhark_mc_segred_task_236452_total_iter;
    int64_t *futhark_mc_segmap_parloop_236444_total_runtime;
    int *futhark_mc_segmap_parloop_236444_runs;
    int64_t *futhark_mc_segmap_parloop_236444_iter;
    int64_t futhark_mc_segmap_parloop_236444_total_total_runtime;
    int futhark_mc_segmap_parloop_236444_total_runs;
    int64_t futhark_mc_segmap_parloop_236444_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236442_total_runtime;
    int *futhark_mc_segmap_nested_task_236442_runs;
    int64_t *futhark_mc_segmap_nested_task_236442_iter;
    int64_t *futhark_mc_segmap_parloop_236424_total_runtime;
    int *futhark_mc_segmap_parloop_236424_runs;
    int64_t *futhark_mc_segmap_parloop_236424_iter;
    int64_t futhark_mc_segmap_parloop_236424_total_total_runtime;
    int futhark_mc_segmap_parloop_236424_total_runs;
    int64_t futhark_mc_segmap_parloop_236424_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236422_total_runtime;
    int *futhark_mc_segmap_nested_task_236422_runs;
    int64_t *futhark_mc_segmap_nested_task_236422_iter;
    int64_t *futhark_mc_segmap_parloop_236459_total_runtime;
    int *futhark_mc_segmap_parloop_236459_runs;
    int64_t *futhark_mc_segmap_parloop_236459_iter;
    int64_t futhark_mc_segmap_parloop_236459_total_total_runtime;
    int futhark_mc_segmap_parloop_236459_total_runs;
    int64_t futhark_mc_segmap_parloop_236459_total_iter;
    int64_t *futhark_mc_segmap_task_236457_total_runtime;
    int *futhark_mc_segmap_task_236457_runs;
    int64_t *futhark_mc_segmap_task_236457_iter;
    int64_t futhark_mc_segmap_task_236457_total_time;
    int64_t futhark_mc_segmap_task_236457_total_iter;
    int64_t *futhark_mc_segmap_parloop_236478_total_runtime;
    int *futhark_mc_segmap_parloop_236478_runs;
    int64_t *futhark_mc_segmap_parloop_236478_iter;
    int64_t futhark_mc_segmap_parloop_236478_total_total_runtime;
    int futhark_mc_segmap_parloop_236478_total_runs;
    int64_t futhark_mc_segmap_parloop_236478_total_iter;
    int64_t *futhark_mc_segmap_task_236476_total_runtime;
    int *futhark_mc_segmap_task_236476_runs;
    int64_t *futhark_mc_segmap_task_236476_iter;
    int64_t futhark_mc_segmap_task_236476_total_time;
    int64_t futhark_mc_segmap_task_236476_total_iter;
    int64_t *futhark_mc_segmap_parloop_236482_total_runtime;
    int *futhark_mc_segmap_parloop_236482_runs;
    int64_t *futhark_mc_segmap_parloop_236482_iter;
    int64_t futhark_mc_segmap_parloop_236482_total_total_runtime;
    int futhark_mc_segmap_parloop_236482_total_runs;
    int64_t futhark_mc_segmap_parloop_236482_total_iter;
    int64_t *futhark_mc_segmap_task_236480_total_runtime;
    int *futhark_mc_segmap_task_236480_runs;
    int64_t *futhark_mc_segmap_task_236480_iter;
    int64_t futhark_mc_segmap_task_236480_total_time;
    int64_t futhark_mc_segmap_task_236480_total_iter;
    int64_t *futhark_mc_segmap_parloop_236486_total_runtime;
    int *futhark_mc_segmap_parloop_236486_runs;
    int64_t *futhark_mc_segmap_parloop_236486_iter;
    int64_t futhark_mc_segmap_parloop_236486_total_total_runtime;
    int futhark_mc_segmap_parloop_236486_total_runs;
    int64_t futhark_mc_segmap_parloop_236486_total_iter;
    int64_t *futhark_mc_segmap_task_236484_total_runtime;
    int *futhark_mc_segmap_task_236484_runs;
    int64_t *futhark_mc_segmap_task_236484_iter;
    int64_t futhark_mc_segmap_task_236484_total_time;
    int64_t futhark_mc_segmap_task_236484_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236500_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236500_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236500_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236500_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236500_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236500_total_iter;
    int64_t *futhark_mc_segred_task_236495_total_runtime;
    int *futhark_mc_segred_task_236495_runs;
    int64_t *futhark_mc_segred_task_236495_iter;
    int64_t futhark_mc_segred_task_236495_total_time;
    int64_t futhark_mc_segred_task_236495_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236506_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236506_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236506_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236506_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236506_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236506_total_iter;
    int64_t *futhark_mc_segred_task_236502_total_runtime;
    int *futhark_mc_segred_task_236502_runs;
    int64_t *futhark_mc_segred_task_236502_iter;
    int64_t futhark_mc_segred_task_236502_total_time;
    int64_t futhark_mc_segred_task_236502_total_iter;
    int64_t *futhark_mc_segmap_parloop_236491_total_runtime;
    int *futhark_mc_segmap_parloop_236491_runs;
    int64_t *futhark_mc_segmap_parloop_236491_iter;
    int64_t futhark_mc_segmap_parloop_236491_total_total_runtime;
    int futhark_mc_segmap_parloop_236491_total_runs;
    int64_t futhark_mc_segmap_parloop_236491_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236489_total_runtime;
    int *futhark_mc_segmap_nested_task_236489_runs;
    int64_t *futhark_mc_segmap_nested_task_236489_iter;
    int64_t *futhark_mc_segmap_parloop_236469_total_runtime;
    int *futhark_mc_segmap_parloop_236469_runs;
    int64_t *futhark_mc_segmap_parloop_236469_iter;
    int64_t futhark_mc_segmap_parloop_236469_total_total_runtime;
    int futhark_mc_segmap_parloop_236469_total_runs;
    int64_t futhark_mc_segmap_parloop_236469_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236467_total_runtime;
    int *futhark_mc_segmap_nested_task_236467_runs;
    int64_t *futhark_mc_segmap_nested_task_236467_iter;
    int64_t *futhark_mc_segmap_parloop_236510_total_runtime;
    int *futhark_mc_segmap_parloop_236510_runs;
    int64_t *futhark_mc_segmap_parloop_236510_iter;
    int64_t futhark_mc_segmap_parloop_236510_total_total_runtime;
    int futhark_mc_segmap_parloop_236510_total_runs;
    int64_t futhark_mc_segmap_parloop_236510_total_iter;
    int64_t *futhark_mc_segmap_task_236508_total_runtime;
    int *futhark_mc_segmap_task_236508_runs;
    int64_t *futhark_mc_segmap_task_236508_iter;
    int64_t futhark_mc_segmap_task_236508_total_time;
    int64_t futhark_mc_segmap_task_236508_total_iter;
    int64_t *futhark_mc_segmap_parloop_236531_total_runtime;
    int *futhark_mc_segmap_parloop_236531_runs;
    int64_t *futhark_mc_segmap_parloop_236531_iter;
    int64_t futhark_mc_segmap_parloop_236531_total_total_runtime;
    int futhark_mc_segmap_parloop_236531_total_runs;
    int64_t futhark_mc_segmap_parloop_236531_total_iter;
    int64_t *futhark_mc_segmap_task_236529_total_runtime;
    int *futhark_mc_segmap_task_236529_runs;
    int64_t *futhark_mc_segmap_task_236529_iter;
    int64_t futhark_mc_segmap_task_236529_total_time;
    int64_t futhark_mc_segmap_task_236529_total_iter;
    int64_t *futhark_mc_segmap_parloop_236535_total_runtime;
    int *futhark_mc_segmap_parloop_236535_runs;
    int64_t *futhark_mc_segmap_parloop_236535_iter;
    int64_t futhark_mc_segmap_parloop_236535_total_total_runtime;
    int futhark_mc_segmap_parloop_236535_total_runs;
    int64_t futhark_mc_segmap_parloop_236535_total_iter;
    int64_t *futhark_mc_segmap_task_236533_total_runtime;
    int *futhark_mc_segmap_task_236533_runs;
    int64_t *futhark_mc_segmap_task_236533_iter;
    int64_t futhark_mc_segmap_task_236533_total_time;
    int64_t futhark_mc_segmap_task_236533_total_iter;
    int64_t *futhark_mc_segmap_parloop_236539_total_runtime;
    int *futhark_mc_segmap_parloop_236539_runs;
    int64_t *futhark_mc_segmap_parloop_236539_iter;
    int64_t futhark_mc_segmap_parloop_236539_total_total_runtime;
    int futhark_mc_segmap_parloop_236539_total_runs;
    int64_t futhark_mc_segmap_parloop_236539_total_iter;
    int64_t *futhark_mc_segmap_task_236537_total_runtime;
    int *futhark_mc_segmap_task_236537_runs;
    int64_t *futhark_mc_segmap_task_236537_iter;
    int64_t futhark_mc_segmap_task_236537_total_time;
    int64_t futhark_mc_segmap_task_236537_total_iter;
    int64_t *futhark_mc_segmap_parloop_236554_total_runtime;
    int *futhark_mc_segmap_parloop_236554_runs;
    int64_t *futhark_mc_segmap_parloop_236554_iter;
    int64_t futhark_mc_segmap_parloop_236554_total_total_runtime;
    int futhark_mc_segmap_parloop_236554_total_runs;
    int64_t futhark_mc_segmap_parloop_236554_total_iter;
    int64_t *futhark_mc_segmap_task_236552_total_runtime;
    int *futhark_mc_segmap_task_236552_runs;
    int64_t *futhark_mc_segmap_task_236552_iter;
    int64_t futhark_mc_segmap_task_236552_total_time;
    int64_t futhark_mc_segmap_task_236552_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236563_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236563_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236563_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236563_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236563_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236563_total_iter;
    int64_t *futhark_mc_segred_task_236556_total_runtime;
    int *futhark_mc_segred_task_236556_runs;
    int64_t *futhark_mc_segred_task_236556_iter;
    int64_t futhark_mc_segred_task_236556_total_time;
    int64_t futhark_mc_segred_task_236556_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236569_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236569_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236569_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236569_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236569_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236569_total_iter;
    int64_t *futhark_mc_segred_task_236565_total_runtime;
    int *futhark_mc_segred_task_236565_runs;
    int64_t *futhark_mc_segred_task_236565_iter;
    int64_t futhark_mc_segred_task_236565_total_time;
    int64_t futhark_mc_segred_task_236565_total_iter;
    int64_t *futhark_mc_segmap_parloop_236546_total_runtime;
    int *futhark_mc_segmap_parloop_236546_runs;
    int64_t *futhark_mc_segmap_parloop_236546_iter;
    int64_t futhark_mc_segmap_parloop_236546_total_total_runtime;
    int futhark_mc_segmap_parloop_236546_total_runs;
    int64_t futhark_mc_segmap_parloop_236546_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236544_total_runtime;
    int *futhark_mc_segmap_nested_task_236544_runs;
    int64_t *futhark_mc_segmap_nested_task_236544_iter;
    int64_t *futhark_mc_segmap_parloop_236522_total_runtime;
    int *futhark_mc_segmap_parloop_236522_runs;
    int64_t *futhark_mc_segmap_parloop_236522_iter;
    int64_t futhark_mc_segmap_parloop_236522_total_total_runtime;
    int futhark_mc_segmap_parloop_236522_total_runs;
    int64_t futhark_mc_segmap_parloop_236522_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236520_total_runtime;
    int *futhark_mc_segmap_nested_task_236520_runs;
    int64_t *futhark_mc_segmap_nested_task_236520_iter;
    int64_t *futhark_mc_segmap_parloop_236573_total_runtime;
    int *futhark_mc_segmap_parloop_236573_runs;
    int64_t *futhark_mc_segmap_parloop_236573_iter;
    int64_t futhark_mc_segmap_parloop_236573_total_total_runtime;
    int futhark_mc_segmap_parloop_236573_total_runs;
    int64_t futhark_mc_segmap_parloop_236573_total_iter;
    int64_t *futhark_mc_segmap_task_236571_total_runtime;
    int *futhark_mc_segmap_task_236571_runs;
    int64_t *futhark_mc_segmap_task_236571_iter;
    int64_t futhark_mc_segmap_task_236571_total_time;
    int64_t futhark_mc_segmap_task_236571_total_iter;
    int64_t *futhark_mc_segmap_parloop_236582_total_runtime;
    int *futhark_mc_segmap_parloop_236582_runs;
    int64_t *futhark_mc_segmap_parloop_236582_iter;
    int64_t futhark_mc_segmap_parloop_236582_total_total_runtime;
    int futhark_mc_segmap_parloop_236582_total_runs;
    int64_t futhark_mc_segmap_parloop_236582_total_iter;
    int64_t *futhark_mc_segmap_task_236580_total_runtime;
    int *futhark_mc_segmap_task_236580_runs;
    int64_t *futhark_mc_segmap_task_236580_iter;
    int64_t futhark_mc_segmap_task_236580_total_time;
    int64_t futhark_mc_segmap_task_236580_total_iter;
    int64_t *futhark_mc_segmap_parloop_236577_total_runtime;
    int *futhark_mc_segmap_parloop_236577_runs;
    int64_t *futhark_mc_segmap_parloop_236577_iter;
    int64_t futhark_mc_segmap_parloop_236577_total_total_runtime;
    int futhark_mc_segmap_parloop_236577_total_runs;
    int64_t futhark_mc_segmap_parloop_236577_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236575_total_runtime;
    int *futhark_mc_segmap_nested_task_236575_runs;
    int64_t *futhark_mc_segmap_nested_task_236575_iter;
    int64_t *futhark_mc_segmap_parloop_236586_total_runtime;
    int *futhark_mc_segmap_parloop_236586_runs;
    int64_t *futhark_mc_segmap_parloop_236586_iter;
    int64_t futhark_mc_segmap_parloop_236586_total_total_runtime;
    int futhark_mc_segmap_parloop_236586_total_runs;
    int64_t futhark_mc_segmap_parloop_236586_total_iter;
    int64_t *futhark_mc_segmap_task_236584_total_runtime;
    int *futhark_mc_segmap_task_236584_runs;
    int64_t *futhark_mc_segmap_task_236584_iter;
    int64_t futhark_mc_segmap_task_236584_total_time;
    int64_t futhark_mc_segmap_task_236584_total_iter;
    int64_t *futhark_mc_segmap_parloop_236597_total_runtime;
    int *futhark_mc_segmap_parloop_236597_runs;
    int64_t *futhark_mc_segmap_parloop_236597_iter;
    int64_t futhark_mc_segmap_parloop_236597_total_total_runtime;
    int futhark_mc_segmap_parloop_236597_total_runs;
    int64_t futhark_mc_segmap_parloop_236597_total_iter;
    int64_t *futhark_mc_segmap_task_236595_total_runtime;
    int *futhark_mc_segmap_task_236595_runs;
    int64_t *futhark_mc_segmap_task_236595_iter;
    int64_t futhark_mc_segmap_task_236595_total_time;
    int64_t futhark_mc_segmap_task_236595_total_iter;
    int64_t *futhark_mc_segmap_parloop_236601_total_runtime;
    int *futhark_mc_segmap_parloop_236601_runs;
    int64_t *futhark_mc_segmap_parloop_236601_iter;
    int64_t futhark_mc_segmap_parloop_236601_total_total_runtime;
    int futhark_mc_segmap_parloop_236601_total_runs;
    int64_t futhark_mc_segmap_parloop_236601_total_iter;
    int64_t *futhark_mc_segmap_task_236599_total_runtime;
    int *futhark_mc_segmap_task_236599_runs;
    int64_t *futhark_mc_segmap_task_236599_iter;
    int64_t futhark_mc_segmap_task_236599_total_time;
    int64_t futhark_mc_segmap_task_236599_total_iter;
    int64_t *futhark_mc_segmap_parloop_236591_total_runtime;
    int *futhark_mc_segmap_parloop_236591_runs;
    int64_t *futhark_mc_segmap_parloop_236591_iter;
    int64_t futhark_mc_segmap_parloop_236591_total_total_runtime;
    int futhark_mc_segmap_parloop_236591_total_runs;
    int64_t futhark_mc_segmap_parloop_236591_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236589_total_runtime;
    int *futhark_mc_segmap_nested_task_236589_runs;
    int64_t *futhark_mc_segmap_nested_task_236589_iter;
    int64_t *futhark_mc_segmap_parloop_236605_total_runtime;
    int *futhark_mc_segmap_parloop_236605_runs;
    int64_t *futhark_mc_segmap_parloop_236605_iter;
    int64_t futhark_mc_segmap_parloop_236605_total_total_runtime;
    int futhark_mc_segmap_parloop_236605_total_runs;
    int64_t futhark_mc_segmap_parloop_236605_total_iter;
    int64_t *futhark_mc_segmap_task_236603_total_runtime;
    int *futhark_mc_segmap_task_236603_runs;
    int64_t *futhark_mc_segmap_task_236603_iter;
    int64_t futhark_mc_segmap_task_236603_total_time;
    int64_t futhark_mc_segmap_task_236603_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_236626_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_236626_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_236626_iter;
    int64_t futhark_mc_scan_stage_1_parloop_236626_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_236626_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_236626_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_236628_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_236628_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_236628_iter;
    int64_t futhark_mc_scan_stage_3_parloop_236628_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_236628_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_236628_total_iter;
    int64_t *futhark_mc_segscan_task_236620_total_runtime;
    int *futhark_mc_segscan_task_236620_runs;
    int64_t *futhark_mc_segscan_task_236620_iter;
    int64_t futhark_mc_segscan_task_236620_total_time;
    int64_t futhark_mc_segscan_task_236620_total_iter;
    int64_t *futhark_mc_segmap_parloop_236632_total_runtime;
    int *futhark_mc_segmap_parloop_236632_runs;
    int64_t *futhark_mc_segmap_parloop_236632_iter;
    int64_t futhark_mc_segmap_parloop_236632_total_total_runtime;
    int futhark_mc_segmap_parloop_236632_total_runs;
    int64_t futhark_mc_segmap_parloop_236632_total_iter;
    int64_t *futhark_mc_segmap_task_236630_total_runtime;
    int *futhark_mc_segmap_task_236630_runs;
    int64_t *futhark_mc_segmap_task_236630_iter;
    int64_t futhark_mc_segmap_task_236630_total_time;
    int64_t futhark_mc_segmap_task_236630_total_iter;
    int64_t *futhark_mc_segmap_parloop_236613_total_runtime;
    int *futhark_mc_segmap_parloop_236613_runs;
    int64_t *futhark_mc_segmap_parloop_236613_iter;
    int64_t futhark_mc_segmap_parloop_236613_total_total_runtime;
    int futhark_mc_segmap_parloop_236613_total_runs;
    int64_t futhark_mc_segmap_parloop_236613_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236611_total_runtime;
    int *futhark_mc_segmap_nested_task_236611_runs;
    int64_t *futhark_mc_segmap_nested_task_236611_iter;
    int64_t *futhark_mc_segmap_parloop_236636_total_runtime;
    int *futhark_mc_segmap_parloop_236636_runs;
    int64_t *futhark_mc_segmap_parloop_236636_iter;
    int64_t futhark_mc_segmap_parloop_236636_total_total_runtime;
    int futhark_mc_segmap_parloop_236636_total_runs;
    int64_t futhark_mc_segmap_parloop_236636_total_iter;
    int64_t *futhark_mc_segmap_task_236634_total_runtime;
    int *futhark_mc_segmap_task_236634_runs;
    int64_t *futhark_mc_segmap_task_236634_iter;
    int64_t futhark_mc_segmap_task_236634_total_time;
    int64_t futhark_mc_segmap_task_236634_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236644_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236644_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236644_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236644_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236644_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236644_total_iter;
    int64_t *futhark_mc_segred_task_236641_total_runtime;
    int *futhark_mc_segred_task_236641_runs;
    int64_t *futhark_mc_segred_task_236641_iter;
    int64_t futhark_mc_segred_task_236641_total_time;
    int64_t futhark_mc_segred_task_236641_total_iter;
    int64_t *futhark_mc_segmap_parloop_236639_total_runtime;
    int *futhark_mc_segmap_parloop_236639_runs;
    int64_t *futhark_mc_segmap_parloop_236639_iter;
    int64_t futhark_mc_segmap_parloop_236639_total_total_runtime;
    int futhark_mc_segmap_parloop_236639_total_runs;
    int64_t futhark_mc_segmap_parloop_236639_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236637_total_runtime;
    int *futhark_mc_segmap_nested_task_236637_runs;
    int64_t *futhark_mc_segmap_nested_task_236637_iter;
    int64_t *futhark_mc_segmap_parloop_236648_total_runtime;
    int *futhark_mc_segmap_parloop_236648_runs;
    int64_t *futhark_mc_segmap_parloop_236648_iter;
    int64_t futhark_mc_segmap_parloop_236648_total_total_runtime;
    int futhark_mc_segmap_parloop_236648_total_runs;
    int64_t futhark_mc_segmap_parloop_236648_total_iter;
    int64_t *futhark_mc_segmap_task_236646_total_runtime;
    int *futhark_mc_segmap_task_236646_runs;
    int64_t *futhark_mc_segmap_task_236646_iter;
    int64_t futhark_mc_segmap_task_236646_total_time;
    int64_t futhark_mc_segmap_task_236646_total_iter;
    int64_t *futhark_mc_segmap_parloop_236657_total_runtime;
    int *futhark_mc_segmap_parloop_236657_runs;
    int64_t *futhark_mc_segmap_parloop_236657_iter;
    int64_t futhark_mc_segmap_parloop_236657_total_total_runtime;
    int futhark_mc_segmap_parloop_236657_total_runs;
    int64_t futhark_mc_segmap_parloop_236657_total_iter;
    int64_t *futhark_mc_segmap_task_236655_total_runtime;
    int *futhark_mc_segmap_task_236655_runs;
    int64_t *futhark_mc_segmap_task_236655_iter;
    int64_t futhark_mc_segmap_task_236655_total_time;
    int64_t futhark_mc_segmap_task_236655_total_iter;
    int64_t *futhark_mc_segmap_parloop_236652_total_runtime;
    int *futhark_mc_segmap_parloop_236652_runs;
    int64_t *futhark_mc_segmap_parloop_236652_iter;
    int64_t futhark_mc_segmap_parloop_236652_total_total_runtime;
    int futhark_mc_segmap_parloop_236652_total_runs;
    int64_t futhark_mc_segmap_parloop_236652_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236650_total_runtime;
    int *futhark_mc_segmap_nested_task_236650_runs;
    int64_t *futhark_mc_segmap_nested_task_236650_iter;
    int64_t *futhark_mc_segmap_parloop_236666_total_runtime;
    int *futhark_mc_segmap_parloop_236666_runs;
    int64_t *futhark_mc_segmap_parloop_236666_iter;
    int64_t futhark_mc_segmap_parloop_236666_total_total_runtime;
    int futhark_mc_segmap_parloop_236666_total_runs;
    int64_t futhark_mc_segmap_parloop_236666_total_iter;
    int64_t *futhark_mc_segmap_task_236664_total_runtime;
    int *futhark_mc_segmap_task_236664_runs;
    int64_t *futhark_mc_segmap_task_236664_iter;
    int64_t futhark_mc_segmap_task_236664_total_time;
    int64_t futhark_mc_segmap_task_236664_total_iter;
    int64_t *futhark_mc_segmap_parloop_236661_total_runtime;
    int *futhark_mc_segmap_parloop_236661_runs;
    int64_t *futhark_mc_segmap_parloop_236661_iter;
    int64_t futhark_mc_segmap_parloop_236661_total_total_runtime;
    int futhark_mc_segmap_parloop_236661_total_runs;
    int64_t futhark_mc_segmap_parloop_236661_total_iter;
    int64_t *futhark_mc_segmap_task_236659_total_runtime;
    int *futhark_mc_segmap_task_236659_runs;
    int64_t *futhark_mc_segmap_task_236659_iter;
    int64_t futhark_mc_segmap_task_236659_total_time;
    int64_t futhark_mc_segmap_task_236659_total_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_segred_stage_1_parloop_235420_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235420_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235420_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235420_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235420_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235420_total_iter = 0;
    ctx->futhark_mc_segred_task_235417_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235417_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235417_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235417_total_time = 0;
    ctx->futhark_mc_segred_task_235417_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235429_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235429_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235429_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235429_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235429_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235429_total_iter = 0;
    ctx->futhark_mc_segred_task_235426_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235426_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235426_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235426_total_time = 0;
    ctx->futhark_mc_segred_task_235426_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235424_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235424_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235424_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235424_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235424_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235424_total_iter = 0;
    ctx->futhark_mc_segred_nested_task_235421_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235421_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235421_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235415_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235415_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235415_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235415_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235415_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235415_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235434_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235434_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235434_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235434_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235434_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235434_total_iter = 0;
    ctx->futhark_mc_segred_task_235431_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235431_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235431_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235431_total_time = 0;
    ctx->futhark_mc_segred_task_235431_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235443_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235443_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235443_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235443_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235443_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235443_total_iter = 0;
    ctx->futhark_mc_segred_task_235440_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235440_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235440_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235440_total_time = 0;
    ctx->futhark_mc_segred_task_235440_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235438_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235438_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235438_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235438_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235438_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235438_total_iter = 0;
    ctx->futhark_mc_segred_nested_task_235435_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235435_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235435_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235450_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235450_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235450_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235450_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235450_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235450_total_iter = 0;
    ctx->futhark_mc_segred_task_235447_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235447_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235447_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235447_total_time = 0;
    ctx->futhark_mc_segred_task_235447_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235459_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235459_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235459_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235459_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235459_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235459_total_iter = 0;
    ctx->futhark_mc_segred_task_235456_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235456_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235456_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235456_total_time = 0;
    ctx->futhark_mc_segred_task_235456_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235454_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235454_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235454_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235454_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235454_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235454_total_iter = 0;
    ctx->futhark_mc_segred_nested_task_235451_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235451_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235451_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235445_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235445_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235445_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235445_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235445_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235445_total_iter = 0;
    ctx->futhark_mc_segscan_task_235412_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235412_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235412_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235412_total_time = 0;
    ctx->futhark_mc_segscan_task_235412_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235463_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235463_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235463_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235463_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235463_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235463_total_iter = 0;
    ctx->futhark_mc_segmap_task_235461_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235461_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235461_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235461_total_time = 0;
    ctx->futhark_mc_segmap_task_235461_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235467_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235467_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235467_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235467_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235467_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235467_total_iter = 0;
    ctx->futhark_mc_segmap_task_235465_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235465_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235465_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235465_total_time = 0;
    ctx->futhark_mc_segmap_task_235465_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235479_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235479_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235479_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235479_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235479_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235479_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235481_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235481_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235481_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235481_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235481_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235481_total_iter = 0;
    ctx->futhark_mc_segscan_task_235476_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235476_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235476_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235476_total_time = 0;
    ctx->futhark_mc_segscan_task_235476_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235485_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235485_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235485_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235485_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235485_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235485_total_iter = 0;
    ctx->futhark_mc_segmap_task_235483_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235483_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235483_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235483_total_time = 0;
    ctx->futhark_mc_segmap_task_235483_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235472_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235472_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235472_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235472_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235472_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235472_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235470_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235470_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235470_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235489_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235489_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235489_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235489_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235489_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235489_total_iter = 0;
    ctx->futhark_mc_segmap_task_235487_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235487_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235487_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235487_total_time = 0;
    ctx->futhark_mc_segmap_task_235487_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235498_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235498_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235498_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235498_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235498_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235498_total_iter = 0;
    ctx->futhark_mc_segmap_task_235496_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235496_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235496_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235496_total_time = 0;
    ctx->futhark_mc_segmap_task_235496_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235507_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235507_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235507_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235507_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235507_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235507_total_iter = 0;
    ctx->futhark_mc_segmap_task_235505_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235505_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235505_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235505_total_time = 0;
    ctx->futhark_mc_segmap_task_235505_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235502_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235502_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235502_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235502_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235502_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235502_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235500_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235500_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235500_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235493_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235493_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235493_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235493_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235493_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235493_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235491_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235491_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235491_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235511_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235511_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235511_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235511_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235511_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235511_total_iter = 0;
    ctx->futhark_mc_segmap_task_235509_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235509_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235509_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235509_total_time = 0;
    ctx->futhark_mc_segmap_task_235509_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235524_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235524_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235524_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235524_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235524_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235524_total_iter = 0;
    ctx->futhark_mc_segmap_task_235522_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235522_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235522_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235522_total_time = 0;
    ctx->futhark_mc_segmap_task_235522_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235536_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235536_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235536_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235536_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235536_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235536_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235538_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235538_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235538_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235538_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235538_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235538_total_iter = 0;
    ctx->futhark_mc_segscan_task_235533_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235533_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235533_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235533_total_time = 0;
    ctx->futhark_mc_segscan_task_235533_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235542_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235542_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235542_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235542_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235542_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235542_total_iter = 0;
    ctx->futhark_mc_segmap_task_235540_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235540_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235540_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235540_total_time = 0;
    ctx->futhark_mc_segmap_task_235540_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235529_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235529_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235529_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235529_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235529_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235529_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235527_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235527_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235527_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235518_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235518_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235518_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235518_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235518_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235518_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235516_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235516_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235516_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235546_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235546_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235546_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235546_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235546_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235546_total_iter = 0;
    ctx->futhark_mc_segmap_task_235544_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235544_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235544_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235544_total_time = 0;
    ctx->futhark_mc_segmap_task_235544_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235558_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235558_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235558_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235558_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235558_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235558_total_iter = 0;
    ctx->futhark_mc_segmap_task_235556_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235556_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235556_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235556_total_time = 0;
    ctx->futhark_mc_segmap_task_235556_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235571_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235571_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235571_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235571_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235571_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235571_total_iter = 0;
    ctx->futhark_mc_segmap_task_235569_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235569_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235569_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235569_total_time = 0;
    ctx->futhark_mc_segmap_task_235569_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235575_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235575_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235575_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235575_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235575_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235575_total_iter = 0;
    ctx->futhark_mc_segmap_task_235573_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235573_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235573_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235573_total_time = 0;
    ctx->futhark_mc_segmap_task_235573_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235564_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235564_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235564_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235564_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235564_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235564_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235562_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235562_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235562_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235552_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235552_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235552_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235552_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235552_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235552_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235550_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235550_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235550_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235579_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235579_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235579_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235579_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235579_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235579_total_iter = 0;
    ctx->futhark_mc_segmap_task_235577_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235577_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235577_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235577_total_time = 0;
    ctx->futhark_mc_segmap_task_235577_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235592_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235592_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235592_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235592_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235592_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235592_total_iter = 0;
    ctx->futhark_mc_segmap_task_235590_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235590_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235590_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235590_total_time = 0;
    ctx->futhark_mc_segmap_task_235590_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235596_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235596_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235596_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235596_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235596_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235596_total_iter = 0;
    ctx->futhark_mc_segmap_task_235594_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235594_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235594_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235594_total_time = 0;
    ctx->futhark_mc_segmap_task_235594_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235585_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235585_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235585_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235585_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235585_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235585_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235583_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235583_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235583_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235600_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235600_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235600_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235600_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235600_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235600_total_iter = 0;
    ctx->futhark_mc_segmap_task_235598_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235598_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235598_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235598_total_time = 0;
    ctx->futhark_mc_segmap_task_235598_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235613_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235613_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235613_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235613_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235613_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235613_total_iter = 0;
    ctx->futhark_mc_segmap_task_235611_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235611_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235611_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235611_total_time = 0;
    ctx->futhark_mc_segmap_task_235611_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235617_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235617_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235617_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235617_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235617_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235617_total_iter = 0;
    ctx->futhark_mc_segmap_task_235615_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235615_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235615_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235615_total_time = 0;
    ctx->futhark_mc_segmap_task_235615_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235606_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235606_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235606_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235606_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235606_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235606_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235604_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235604_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235604_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235621_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235621_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235621_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235621_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235621_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235621_total_iter = 0;
    ctx->futhark_mc_segmap_task_235619_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235619_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235619_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235619_total_time = 0;
    ctx->futhark_mc_segmap_task_235619_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235630_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235630_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235630_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235630_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235630_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235630_total_iter = 0;
    ctx->futhark_mc_segmap_task_235628_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235628_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235628_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235628_total_time = 0;
    ctx->futhark_mc_segmap_task_235628_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235625_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235625_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235625_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235625_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235625_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235625_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235623_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235623_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235623_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235634_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235634_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235634_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235634_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235634_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235634_total_iter = 0;
    ctx->futhark_mc_segmap_task_235632_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235632_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235632_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235632_total_time = 0;
    ctx->futhark_mc_segmap_task_235632_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235645_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235645_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235645_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235645_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235645_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235645_total_iter = 0;
    ctx->futhark_mc_segmap_task_235643_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235643_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235643_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235643_total_time = 0;
    ctx->futhark_mc_segmap_task_235643_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235656_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235656_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235656_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235656_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235656_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235656_total_iter = 0;
    ctx->futhark_mc_segmap_task_235654_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235654_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235654_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235654_total_time = 0;
    ctx->futhark_mc_segmap_task_235654_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235650_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235650_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235650_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235650_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235650_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235650_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235648_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235648_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235648_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235639_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235639_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235639_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235639_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235639_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235639_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235637_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235637_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235637_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235660_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235660_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235660_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235660_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235660_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235660_total_iter = 0;
    ctx->futhark_mc_segmap_task_235658_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235658_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235658_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235658_total_time = 0;
    ctx->futhark_mc_segmap_task_235658_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235669_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235669_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235669_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235669_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235669_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235669_total_iter = 0;
    ctx->futhark_mc_segmap_task_235667_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235667_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235667_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235667_total_time = 0;
    ctx->futhark_mc_segmap_task_235667_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235678_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235678_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235678_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235678_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235678_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235678_total_iter = 0;
    ctx->futhark_mc_segmap_task_235676_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235676_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235676_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235676_total_time = 0;
    ctx->futhark_mc_segmap_task_235676_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235686_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235686_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235686_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235686_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235686_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235686_total_iter = 0;
    ctx->futhark_mc_segred_task_235683_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235683_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235683_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235683_total_time = 0;
    ctx->futhark_mc_segred_task_235683_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235691_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235691_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235691_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235691_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235691_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235691_total_iter = 0;
    ctx->futhark_mc_segred_task_235688_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235688_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235688_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235688_total_time = 0;
    ctx->futhark_mc_segred_task_235688_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235681_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235681_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235681_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235681_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235681_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235681_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235679_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235679_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235679_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235673_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235673_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235673_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235673_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235673_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235673_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235671_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235671_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235671_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235664_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235664_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235664_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235664_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235664_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235664_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235662_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235662_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235662_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235695_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235695_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235695_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235695_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235695_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235695_total_iter = 0;
    ctx->futhark_mc_segmap_task_235693_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235693_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235693_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235693_total_time = 0;
    ctx->futhark_mc_segmap_task_235693_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235706_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235706_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235706_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235706_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235706_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235706_total_iter = 0;
    ctx->futhark_mc_segmap_task_235704_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235704_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235704_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235704_total_time = 0;
    ctx->futhark_mc_segmap_task_235704_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235717_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235717_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235717_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235717_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235717_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235717_total_iter = 0;
    ctx->futhark_mc_segmap_task_235715_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235715_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235715_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235715_total_time = 0;
    ctx->futhark_mc_segmap_task_235715_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235727_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235727_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235727_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235727_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235727_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235727_total_iter = 0;
    ctx->futhark_mc_segred_task_235722_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235722_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235722_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235722_total_time = 0;
    ctx->futhark_mc_segred_task_235722_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235733_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235733_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235733_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235733_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235733_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235733_total_iter = 0;
    ctx->futhark_mc_segred_task_235729_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235729_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235729_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235729_total_time = 0;
    ctx->futhark_mc_segred_task_235729_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235720_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235720_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235720_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235720_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235720_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235720_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235718_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235718_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235718_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235711_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235711_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235711_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235711_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235711_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235711_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235709_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235709_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235709_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235700_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235700_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235700_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235700_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235700_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235700_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235698_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235698_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235698_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235737_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235737_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235737_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235737_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235737_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235737_total_iter = 0;
    ctx->futhark_mc_segmap_task_235735_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235735_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235735_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235735_total_time = 0;
    ctx->futhark_mc_segmap_task_235735_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235748_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235748_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235748_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235748_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235748_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235748_total_iter = 0;
    ctx->futhark_mc_segmap_task_235746_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235746_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235746_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235746_total_time = 0;
    ctx->futhark_mc_segmap_task_235746_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235759_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235759_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235759_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235759_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235759_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235759_total_iter = 0;
    ctx->futhark_mc_segmap_task_235757_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235757_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235757_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235757_total_time = 0;
    ctx->futhark_mc_segmap_task_235757_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235771_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235771_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235771_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235771_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235771_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235771_total_iter = 0;
    ctx->futhark_mc_segred_task_235764_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235764_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235764_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235764_total_time = 0;
    ctx->futhark_mc_segred_task_235764_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235777_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235777_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235777_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235777_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235777_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235777_total_iter = 0;
    ctx->futhark_mc_segred_task_235773_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235773_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235773_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235773_total_time = 0;
    ctx->futhark_mc_segred_task_235773_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235762_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235762_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235762_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235762_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235762_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235762_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235760_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235760_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235760_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235753_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235753_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235753_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235753_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235753_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235753_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235751_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235751_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235751_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235742_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235742_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235742_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235742_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235742_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235742_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235740_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235740_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235740_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235781_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235781_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235781_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235781_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235781_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235781_total_iter = 0;
    ctx->futhark_mc_segmap_task_235779_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235779_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235779_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235779_total_time = 0;
    ctx->futhark_mc_segmap_task_235779_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235791_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235791_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235791_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235791_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235791_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235791_total_iter = 0;
    ctx->futhark_mc_segmap_task_235789_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235789_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235789_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235789_total_time = 0;
    ctx->futhark_mc_segmap_task_235789_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235801_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235801_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235801_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235801_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235801_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235801_total_iter = 0;
    ctx->futhark_mc_segmap_task_235799_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235799_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235799_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235799_total_time = 0;
    ctx->futhark_mc_segmap_task_235799_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235811_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235811_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235811_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235811_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235811_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235811_total_iter = 0;
    ctx->futhark_mc_segred_task_235808_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235808_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235808_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235808_total_time = 0;
    ctx->futhark_mc_segred_task_235808_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235816_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235816_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235816_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235816_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235816_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235816_total_iter = 0;
    ctx->futhark_mc_segred_task_235813_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235813_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235813_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235813_total_time = 0;
    ctx->futhark_mc_segred_task_235813_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235805_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235805_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235805_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235805_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235805_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235805_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235803_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235803_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235803_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235796_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235796_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235796_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235796_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235796_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235796_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235794_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235794_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235794_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235786_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235786_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235786_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235786_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235786_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235786_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235784_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235784_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235784_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235820_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235820_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235820_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235820_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235820_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235820_total_iter = 0;
    ctx->futhark_mc_segmap_task_235818_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235818_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235818_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235818_total_time = 0;
    ctx->futhark_mc_segmap_task_235818_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235833_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235833_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235833_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235833_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235833_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235833_total_iter = 0;
    ctx->futhark_mc_segmap_task_235831_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235831_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235831_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235831_total_time = 0;
    ctx->futhark_mc_segmap_task_235831_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235846_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235846_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235846_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235846_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235846_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235846_total_iter = 0;
    ctx->futhark_mc_segmap_task_235844_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235844_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235844_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235844_total_time = 0;
    ctx->futhark_mc_segmap_task_235844_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235860_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235860_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235860_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235860_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235860_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235860_total_iter = 0;
    ctx->futhark_mc_segred_task_235855_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235855_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235855_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235855_total_time = 0;
    ctx->futhark_mc_segred_task_235855_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235866_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235866_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235866_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235866_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235866_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235866_total_iter = 0;
    ctx->futhark_mc_segred_task_235862_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235862_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235862_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235862_total_time = 0;
    ctx->futhark_mc_segred_task_235862_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235851_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235851_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235851_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235851_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235851_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235851_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235849_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235849_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235849_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235840_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235840_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235840_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235840_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235840_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235840_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235838_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235838_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235838_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235827_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235827_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235827_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235827_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235827_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235827_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235825_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235825_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235825_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235870_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235870_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235870_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235870_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235870_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235870_total_iter = 0;
    ctx->futhark_mc_segmap_task_235868_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235868_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235868_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235868_total_time = 0;
    ctx->futhark_mc_segmap_task_235868_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235885_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235885_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235885_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235885_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235885_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235885_total_iter = 0;
    ctx->futhark_mc_segmap_task_235883_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235883_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235883_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235883_total_time = 0;
    ctx->futhark_mc_segmap_task_235883_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235900_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235900_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235900_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235900_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235900_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235900_total_iter = 0;
    ctx->futhark_mc_segmap_task_235898_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235898_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235898_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235898_total_time = 0;
    ctx->futhark_mc_segmap_task_235898_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235915_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235915_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235915_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235915_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235915_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235915_total_iter = 0;
    ctx->futhark_mc_segmap_task_235913_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235913_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235913_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235913_total_time = 0;
    ctx->futhark_mc_segmap_task_235913_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235924_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235924_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235924_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235924_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235924_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235924_total_iter = 0;
    ctx->futhark_mc_segred_task_235917_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235917_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235917_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235917_total_time = 0;
    ctx->futhark_mc_segred_task_235917_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235930_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235930_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235930_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235930_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235930_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235930_total_iter = 0;
    ctx->futhark_mc_segred_task_235926_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235926_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235926_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235926_total_time = 0;
    ctx->futhark_mc_segred_task_235926_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235907_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235907_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235907_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235907_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235907_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235907_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235905_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235905_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235905_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235894_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235894_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235894_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235894_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235894_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235894_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235892_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235892_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235892_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235879_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235879_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235879_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235879_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235879_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235879_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235877_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235877_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235877_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235934_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235934_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235934_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235934_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235934_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235934_total_iter = 0;
    ctx->futhark_mc_segmap_task_235932_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235932_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235932_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235932_total_time = 0;
    ctx->futhark_mc_segmap_task_235932_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235943_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235943_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235943_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235943_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235943_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235943_total_iter = 0;
    ctx->futhark_mc_segmap_task_235941_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235941_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235941_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235941_total_time = 0;
    ctx->futhark_mc_segmap_task_235941_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235952_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235952_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235952_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235952_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235952_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235952_total_iter = 0;
    ctx->futhark_mc_segmap_task_235950_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235950_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235950_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235950_total_time = 0;
    ctx->futhark_mc_segmap_task_235950_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235947_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235947_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235947_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235947_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235947_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235947_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235945_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235945_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235945_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235938_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235938_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235938_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235938_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235938_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235938_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235936_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235936_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235936_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235956_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235956_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235956_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235956_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235956_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235956_total_iter = 0;
    ctx->futhark_mc_segmap_task_235954_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235954_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235954_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235954_total_time = 0;
    ctx->futhark_mc_segmap_task_235954_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235965_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235965_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235965_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235965_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235965_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235965_total_iter = 0;
    ctx->futhark_mc_segmap_task_235963_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235963_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235963_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235963_total_time = 0;
    ctx->futhark_mc_segmap_task_235963_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235960_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235960_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235960_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235960_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235960_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235960_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235958_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235958_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235958_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235969_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235969_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235969_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235969_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235969_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235969_total_iter = 0;
    ctx->futhark_mc_segmap_task_235967_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235967_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235967_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235967_total_time = 0;
    ctx->futhark_mc_segmap_task_235967_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235977_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235977_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235977_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235977_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235977_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235977_total_iter = 0;
    ctx->futhark_mc_segred_task_235974_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235974_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235974_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235974_total_time = 0;
    ctx->futhark_mc_segred_task_235974_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235972_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235972_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235972_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235972_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235972_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235972_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235970_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235970_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235970_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235981_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235981_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235981_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235981_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235981_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235981_total_iter = 0;
    ctx->futhark_mc_segmap_task_235979_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235979_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235979_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235979_total_time = 0;
    ctx->futhark_mc_segmap_task_235979_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235991_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235991_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235991_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235991_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235991_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235991_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235993_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235993_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235993_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235993_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235993_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235993_total_iter = 0;
    ctx->futhark_mc_segscan_task_235988_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235988_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235988_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235988_total_time = 0;
    ctx->futhark_mc_segscan_task_235988_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235985_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235985_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235985_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235985_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235985_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235985_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235983_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235983_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235983_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235997_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235997_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235997_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235997_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235997_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235997_total_iter = 0;
    ctx->futhark_mc_segmap_task_235995_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235995_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235995_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235995_total_time = 0;
    ctx->futhark_mc_segmap_task_235995_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236005_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236005_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236005_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236005_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236005_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236005_total_iter = 0;
    ctx->futhark_mc_segred_task_236002_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236002_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236002_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236002_total_time = 0;
    ctx->futhark_mc_segred_task_236002_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236000_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236000_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236000_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236000_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236000_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236000_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235998_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235998_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235998_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236009_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236009_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236009_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236009_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236009_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236009_total_iter = 0;
    ctx->futhark_mc_segmap_task_236007_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236007_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236007_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236007_total_time = 0;
    ctx->futhark_mc_segmap_task_236007_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236019_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236019_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236019_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236019_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236019_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236019_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236021_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236021_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236021_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236021_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236021_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236021_total_iter = 0;
    ctx->futhark_mc_segscan_task_236016_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236016_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236016_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236016_total_time = 0;
    ctx->futhark_mc_segscan_task_236016_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236013_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236013_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236013_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236013_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236013_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236013_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236011_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236011_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236011_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236025_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236025_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236025_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236025_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236025_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236025_total_iter = 0;
    ctx->futhark_mc_segmap_task_236023_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236023_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236023_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236023_total_time = 0;
    ctx->futhark_mc_segmap_task_236023_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236033_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236033_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236033_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236033_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236033_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236033_total_iter = 0;
    ctx->futhark_mc_segred_task_236030_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236030_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236030_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236030_total_time = 0;
    ctx->futhark_mc_segred_task_236030_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236028_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236028_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236028_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236028_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236028_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236028_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236026_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236026_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236026_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236037_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236037_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236037_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236037_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236037_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236037_total_iter = 0;
    ctx->futhark_mc_segmap_task_236035_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236035_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236035_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236035_total_time = 0;
    ctx->futhark_mc_segmap_task_236035_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236047_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236047_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236047_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236047_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236047_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236047_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236049_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236049_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236049_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236049_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236049_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236049_total_iter = 0;
    ctx->futhark_mc_segscan_task_236044_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236044_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236044_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236044_total_time = 0;
    ctx->futhark_mc_segscan_task_236044_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236041_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236041_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236041_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236041_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236041_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236041_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236039_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236039_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236039_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236053_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236053_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236053_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236053_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236053_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236053_total_iter = 0;
    ctx->futhark_mc_segmap_task_236051_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236051_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236051_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236051_total_time = 0;
    ctx->futhark_mc_segmap_task_236051_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236062_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236062_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236062_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236062_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236062_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236062_total_iter = 0;
    ctx->futhark_mc_segmap_task_236060_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236060_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236060_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236060_total_time = 0;
    ctx->futhark_mc_segmap_task_236060_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236070_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236070_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236070_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236070_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236070_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236070_total_iter = 0;
    ctx->futhark_mc_segred_task_236067_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236067_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236067_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236067_total_time = 0;
    ctx->futhark_mc_segred_task_236067_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236075_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236075_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236075_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236075_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236075_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236075_total_iter = 0;
    ctx->futhark_mc_segred_task_236072_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236072_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236072_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236072_total_time = 0;
    ctx->futhark_mc_segred_task_236072_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236065_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236065_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236065_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236065_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236065_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236065_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236063_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236063_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236063_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236057_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236057_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236057_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236057_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236057_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236057_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236055_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236055_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236055_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236079_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236079_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236079_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236079_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236079_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236079_total_iter = 0;
    ctx->futhark_mc_segmap_task_236077_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236077_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236077_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236077_total_time = 0;
    ctx->futhark_mc_segmap_task_236077_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236090_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236090_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236090_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236090_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236090_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236090_total_iter = 0;
    ctx->futhark_mc_segmap_task_236088_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236088_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236088_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236088_total_time = 0;
    ctx->futhark_mc_segmap_task_236088_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236100_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236100_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236100_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236100_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236100_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236100_total_iter = 0;
    ctx->futhark_mc_segred_task_236095_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236095_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236095_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236095_total_time = 0;
    ctx->futhark_mc_segred_task_236095_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236106_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236106_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236106_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236106_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236106_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236106_total_iter = 0;
    ctx->futhark_mc_segred_task_236102_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236102_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236102_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236102_total_time = 0;
    ctx->futhark_mc_segred_task_236102_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236093_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236093_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236093_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236093_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236093_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236093_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236091_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236091_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236091_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236084_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236084_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236084_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236084_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236084_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236084_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236082_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236082_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236082_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236110_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236110_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236110_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236110_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236110_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236110_total_iter = 0;
    ctx->futhark_mc_segmap_task_236108_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236108_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236108_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236108_total_time = 0;
    ctx->futhark_mc_segmap_task_236108_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236121_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236121_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236121_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236121_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236121_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236121_total_iter = 0;
    ctx->futhark_mc_segmap_task_236119_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236119_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236119_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236119_total_time = 0;
    ctx->futhark_mc_segmap_task_236119_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236133_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236133_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236133_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236133_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236133_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236133_total_iter = 0;
    ctx->futhark_mc_segred_task_236126_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236126_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236126_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236126_total_time = 0;
    ctx->futhark_mc_segred_task_236126_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236139_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236139_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236139_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236139_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236139_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236139_total_iter = 0;
    ctx->futhark_mc_segred_task_236135_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236135_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236135_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236135_total_time = 0;
    ctx->futhark_mc_segred_task_236135_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236124_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236124_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236124_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236124_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236124_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236124_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236122_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236122_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236122_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236115_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236115_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236115_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236115_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236115_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236115_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236113_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236113_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236113_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236143_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236143_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236143_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236143_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236143_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236143_total_iter = 0;
    ctx->futhark_mc_segmap_task_236141_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236141_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236141_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236141_total_time = 0;
    ctx->futhark_mc_segmap_task_236141_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236153_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236153_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236153_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236153_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236153_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236153_total_iter = 0;
    ctx->futhark_mc_segmap_task_236151_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236151_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236151_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236151_total_time = 0;
    ctx->futhark_mc_segmap_task_236151_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236163_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236163_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236163_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236163_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236163_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236163_total_iter = 0;
    ctx->futhark_mc_segred_task_236160_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236160_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236160_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236160_total_time = 0;
    ctx->futhark_mc_segred_task_236160_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236168_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236168_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236168_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236168_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236168_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236168_total_iter = 0;
    ctx->futhark_mc_segred_task_236165_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236165_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236165_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236165_total_time = 0;
    ctx->futhark_mc_segred_task_236165_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236157_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236157_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236157_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236157_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236157_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236157_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236155_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236155_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236155_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236148_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236148_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236148_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236148_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236148_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236148_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236146_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236146_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236146_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236172_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236172_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236172_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236172_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236172_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236172_total_iter = 0;
    ctx->futhark_mc_segmap_task_236170_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236170_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236170_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236170_total_time = 0;
    ctx->futhark_mc_segmap_task_236170_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236185_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236185_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236185_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236185_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236185_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236185_total_iter = 0;
    ctx->futhark_mc_segmap_task_236183_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236183_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236183_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236183_total_time = 0;
    ctx->futhark_mc_segmap_task_236183_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236199_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236199_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236199_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236199_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236199_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236199_total_iter = 0;
    ctx->futhark_mc_segred_task_236194_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236194_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236194_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236194_total_time = 0;
    ctx->futhark_mc_segred_task_236194_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236205_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236205_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236205_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236205_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236205_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236205_total_iter = 0;
    ctx->futhark_mc_segred_task_236201_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236201_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236201_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236201_total_time = 0;
    ctx->futhark_mc_segred_task_236201_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236190_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236190_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236190_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236190_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236190_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236190_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236188_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236188_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236188_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236179_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236179_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236179_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236179_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236179_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236179_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236177_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236177_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236177_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236209_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236209_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236209_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236209_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236209_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236209_total_iter = 0;
    ctx->futhark_mc_segmap_task_236207_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236207_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236207_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236207_total_time = 0;
    ctx->futhark_mc_segmap_task_236207_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236224_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236224_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236224_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236224_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236224_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236224_total_iter = 0;
    ctx->futhark_mc_segmap_task_236222_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236222_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236222_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236222_total_time = 0;
    ctx->futhark_mc_segmap_task_236222_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236239_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236239_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236239_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236239_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236239_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236239_total_iter = 0;
    ctx->futhark_mc_segmap_task_236237_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236237_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236237_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236237_total_time = 0;
    ctx->futhark_mc_segmap_task_236237_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236248_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236248_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236248_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236248_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236248_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236248_total_iter = 0;
    ctx->futhark_mc_segred_task_236241_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236241_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236241_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236241_total_time = 0;
    ctx->futhark_mc_segred_task_236241_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236254_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236254_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236254_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236254_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236254_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236254_total_iter = 0;
    ctx->futhark_mc_segred_task_236250_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236250_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236250_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236250_total_time = 0;
    ctx->futhark_mc_segred_task_236250_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236231_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236231_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236231_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236231_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236231_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236231_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236229_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236229_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236229_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236218_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236218_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236218_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236218_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236218_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236218_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236216_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236216_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236216_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236258_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236258_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236258_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236258_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236258_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236258_total_iter = 0;
    ctx->futhark_mc_segmap_task_236256_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236256_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236256_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236256_total_time = 0;
    ctx->futhark_mc_segmap_task_236256_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236267_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236267_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236267_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236267_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236267_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236267_total_iter = 0;
    ctx->futhark_mc_segmap_task_236265_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236265_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236265_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236265_total_time = 0;
    ctx->futhark_mc_segmap_task_236265_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236262_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236262_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236262_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236262_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236262_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236262_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236260_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236260_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236260_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236271_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236271_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236271_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236271_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236271_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236271_total_iter = 0;
    ctx->futhark_mc_segmap_task_236269_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236269_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236269_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236269_total_time = 0;
    ctx->futhark_mc_segmap_task_236269_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236280_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236280_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236280_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236280_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236280_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236280_total_iter = 0;
    ctx->futhark_mc_segmap_task_236278_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236278_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236278_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236278_total_time = 0;
    ctx->futhark_mc_segmap_task_236278_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236275_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236275_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236275_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236275_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236275_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236275_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236273_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236273_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236273_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236284_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236284_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236284_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236284_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236284_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236284_total_iter = 0;
    ctx->futhark_mc_segmap_task_236282_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236282_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236282_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236282_total_time = 0;
    ctx->futhark_mc_segmap_task_236282_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236299_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236299_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236299_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236299_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236299_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236299_total_iter = 0;
    ctx->futhark_mc_segmap_task_236297_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236297_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236297_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236297_total_time = 0;
    ctx->futhark_mc_segmap_task_236297_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236303_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236303_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236303_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236303_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236303_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236303_total_iter = 0;
    ctx->futhark_mc_segmap_task_236301_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236301_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236301_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236301_total_time = 0;
    ctx->futhark_mc_segmap_task_236301_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236307_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236307_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236307_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236307_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236307_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236307_total_iter = 0;
    ctx->futhark_mc_segmap_task_236305_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236305_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236305_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236305_total_time = 0;
    ctx->futhark_mc_segmap_task_236305_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236315_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236315_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236315_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236315_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236315_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236315_total_iter = 0;
    ctx->futhark_mc_segred_task_236312_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236312_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236312_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236312_total_time = 0;
    ctx->futhark_mc_segred_task_236312_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236320_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236320_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236320_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236320_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236320_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236320_total_iter = 0;
    ctx->futhark_mc_segred_task_236317_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236317_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236317_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236317_total_time = 0;
    ctx->futhark_mc_segred_task_236317_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236310_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236310_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236310_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236310_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236310_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236310_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236308_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236308_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236308_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236291_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236291_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236291_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236291_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236291_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236291_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236289_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236289_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236289_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236324_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236324_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236324_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236324_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236324_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236324_total_iter = 0;
    ctx->futhark_mc_segmap_task_236322_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236322_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236322_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236322_total_time = 0;
    ctx->futhark_mc_segmap_task_236322_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236341_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236341_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236341_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236341_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236341_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236341_total_iter = 0;
    ctx->futhark_mc_segmap_task_236339_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236339_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236339_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236339_total_time = 0;
    ctx->futhark_mc_segmap_task_236339_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236345_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236345_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236345_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236345_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236345_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236345_total_iter = 0;
    ctx->futhark_mc_segmap_task_236343_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236343_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236343_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236343_total_time = 0;
    ctx->futhark_mc_segmap_task_236343_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236349_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236349_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236349_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236349_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236349_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236349_total_iter = 0;
    ctx->futhark_mc_segmap_task_236347_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236347_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236347_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236347_total_time = 0;
    ctx->futhark_mc_segmap_task_236347_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236359_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236359_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236359_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236359_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236359_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236359_total_iter = 0;
    ctx->futhark_mc_segred_task_236354_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236354_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236354_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236354_total_time = 0;
    ctx->futhark_mc_segred_task_236354_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236365_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236365_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236365_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236365_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236365_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236365_total_iter = 0;
    ctx->futhark_mc_segred_task_236361_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236361_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236361_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236361_total_time = 0;
    ctx->futhark_mc_segred_task_236361_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236352_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236352_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236352_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236352_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236352_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236352_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236350_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236350_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236350_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236332_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236332_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236332_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236332_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236332_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236332_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236330_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236330_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236330_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236369_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236369_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236369_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236369_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236369_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236369_total_iter = 0;
    ctx->futhark_mc_segmap_task_236367_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236367_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236367_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236367_total_time = 0;
    ctx->futhark_mc_segmap_task_236367_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236386_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236386_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236386_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236386_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236386_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236386_total_iter = 0;
    ctx->futhark_mc_segmap_task_236384_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236384_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236384_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236384_total_time = 0;
    ctx->futhark_mc_segmap_task_236384_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236390_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236390_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236390_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236390_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236390_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236390_total_iter = 0;
    ctx->futhark_mc_segmap_task_236388_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236388_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236388_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236388_total_time = 0;
    ctx->futhark_mc_segmap_task_236388_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236394_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236394_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236394_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236394_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236394_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236394_total_iter = 0;
    ctx->futhark_mc_segmap_task_236392_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236392_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236392_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236392_total_time = 0;
    ctx->futhark_mc_segmap_task_236392_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236406_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236406_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236406_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236406_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236406_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236406_total_iter = 0;
    ctx->futhark_mc_segred_task_236399_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236399_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236399_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236399_total_time = 0;
    ctx->futhark_mc_segred_task_236399_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236412_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236412_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236412_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236412_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236412_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236412_total_iter = 0;
    ctx->futhark_mc_segred_task_236408_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236408_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236408_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236408_total_time = 0;
    ctx->futhark_mc_segred_task_236408_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236397_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236397_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236397_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236397_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236397_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236397_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236395_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236395_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236395_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236377_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236377_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236377_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236377_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236377_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236377_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236375_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236375_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236375_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236416_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236416_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236416_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236416_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236416_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236416_total_iter = 0;
    ctx->futhark_mc_segmap_task_236414_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236414_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236414_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236414_total_time = 0;
    ctx->futhark_mc_segmap_task_236414_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236432_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236432_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236432_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236432_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236432_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236432_total_iter = 0;
    ctx->futhark_mc_segmap_task_236430_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236430_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236430_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236430_total_time = 0;
    ctx->futhark_mc_segmap_task_236430_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236436_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236436_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236436_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236436_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236436_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236436_total_iter = 0;
    ctx->futhark_mc_segmap_task_236434_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236434_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236434_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236434_total_time = 0;
    ctx->futhark_mc_segmap_task_236434_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236440_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236440_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236440_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236440_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236440_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236440_total_iter = 0;
    ctx->futhark_mc_segmap_task_236438_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236438_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236438_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236438_total_time = 0;
    ctx->futhark_mc_segmap_task_236438_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236450_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236450_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236450_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236450_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236450_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236450_total_iter = 0;
    ctx->futhark_mc_segred_task_236447_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236447_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236447_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236447_total_time = 0;
    ctx->futhark_mc_segred_task_236447_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236455_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236455_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236455_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236455_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236455_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236455_total_iter = 0;
    ctx->futhark_mc_segred_task_236452_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236452_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236452_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236452_total_time = 0;
    ctx->futhark_mc_segred_task_236452_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236444_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236444_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236444_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236444_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236444_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236444_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236442_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236442_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236442_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236424_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236424_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236424_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236424_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236424_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236424_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236422_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236422_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236422_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236459_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236459_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236459_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236459_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236459_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236459_total_iter = 0;
    ctx->futhark_mc_segmap_task_236457_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236457_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236457_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236457_total_time = 0;
    ctx->futhark_mc_segmap_task_236457_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236478_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236478_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236478_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236478_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236478_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236478_total_iter = 0;
    ctx->futhark_mc_segmap_task_236476_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236476_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236476_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236476_total_time = 0;
    ctx->futhark_mc_segmap_task_236476_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236482_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236482_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236482_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236482_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236482_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236482_total_iter = 0;
    ctx->futhark_mc_segmap_task_236480_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236480_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236480_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236480_total_time = 0;
    ctx->futhark_mc_segmap_task_236480_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236486_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236486_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236486_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236486_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236486_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236486_total_iter = 0;
    ctx->futhark_mc_segmap_task_236484_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236484_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236484_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236484_total_time = 0;
    ctx->futhark_mc_segmap_task_236484_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236500_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236500_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236500_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236500_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236500_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236500_total_iter = 0;
    ctx->futhark_mc_segred_task_236495_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236495_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236495_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236495_total_time = 0;
    ctx->futhark_mc_segred_task_236495_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236506_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236506_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236506_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236506_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236506_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236506_total_iter = 0;
    ctx->futhark_mc_segred_task_236502_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236502_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236502_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236502_total_time = 0;
    ctx->futhark_mc_segred_task_236502_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236491_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236491_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236491_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236491_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236491_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236491_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236489_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236489_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236489_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236469_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236469_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236469_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236469_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236469_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236469_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236467_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236467_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236467_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236510_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236510_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236510_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236510_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236510_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236510_total_iter = 0;
    ctx->futhark_mc_segmap_task_236508_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236508_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236508_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236508_total_time = 0;
    ctx->futhark_mc_segmap_task_236508_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236531_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236531_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236531_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236531_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236531_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236531_total_iter = 0;
    ctx->futhark_mc_segmap_task_236529_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236529_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236529_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236529_total_time = 0;
    ctx->futhark_mc_segmap_task_236529_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236535_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236535_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236535_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236535_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236535_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236535_total_iter = 0;
    ctx->futhark_mc_segmap_task_236533_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236533_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236533_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236533_total_time = 0;
    ctx->futhark_mc_segmap_task_236533_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236539_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236539_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236539_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236539_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236539_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236539_total_iter = 0;
    ctx->futhark_mc_segmap_task_236537_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236537_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236537_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236537_total_time = 0;
    ctx->futhark_mc_segmap_task_236537_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236554_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236554_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236554_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236554_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236554_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236554_total_iter = 0;
    ctx->futhark_mc_segmap_task_236552_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236552_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236552_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236552_total_time = 0;
    ctx->futhark_mc_segmap_task_236552_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236563_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236563_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236563_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236563_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236563_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236563_total_iter = 0;
    ctx->futhark_mc_segred_task_236556_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236556_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236556_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236556_total_time = 0;
    ctx->futhark_mc_segred_task_236556_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236569_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236569_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236569_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236569_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236569_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236569_total_iter = 0;
    ctx->futhark_mc_segred_task_236565_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236565_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236565_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236565_total_time = 0;
    ctx->futhark_mc_segred_task_236565_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236546_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236546_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236546_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236546_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236546_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236546_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236544_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236544_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236544_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236522_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236522_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236522_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236522_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236522_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236522_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236520_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236520_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236520_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236573_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236573_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236573_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236573_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236573_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236573_total_iter = 0;
    ctx->futhark_mc_segmap_task_236571_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236571_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236571_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236571_total_time = 0;
    ctx->futhark_mc_segmap_task_236571_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236582_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236582_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236582_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236582_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236582_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236582_total_iter = 0;
    ctx->futhark_mc_segmap_task_236580_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236580_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236580_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236580_total_time = 0;
    ctx->futhark_mc_segmap_task_236580_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236577_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236577_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236577_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236577_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236577_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236577_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236575_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236575_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236575_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236586_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236586_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236586_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236586_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236586_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236586_total_iter = 0;
    ctx->futhark_mc_segmap_task_236584_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236584_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236584_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236584_total_time = 0;
    ctx->futhark_mc_segmap_task_236584_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236597_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236597_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236597_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236597_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236597_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236597_total_iter = 0;
    ctx->futhark_mc_segmap_task_236595_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236595_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236595_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236595_total_time = 0;
    ctx->futhark_mc_segmap_task_236595_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236601_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236601_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236601_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236601_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236601_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236601_total_iter = 0;
    ctx->futhark_mc_segmap_task_236599_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236599_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236599_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236599_total_time = 0;
    ctx->futhark_mc_segmap_task_236599_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236591_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236591_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236591_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236591_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236591_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236591_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236589_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236589_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236589_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236605_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236605_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236605_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236605_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236605_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236605_total_iter = 0;
    ctx->futhark_mc_segmap_task_236603_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236603_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236603_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236603_total_time = 0;
    ctx->futhark_mc_segmap_task_236603_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236626_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236626_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236626_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236626_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236626_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236626_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236628_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236628_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236628_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236628_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236628_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236628_total_iter = 0;
    ctx->futhark_mc_segscan_task_236620_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236620_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236620_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236620_total_time = 0;
    ctx->futhark_mc_segscan_task_236620_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236632_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236632_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236632_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236632_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236632_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236632_total_iter = 0;
    ctx->futhark_mc_segmap_task_236630_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236630_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236630_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236630_total_time = 0;
    ctx->futhark_mc_segmap_task_236630_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236613_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236613_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236613_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236613_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236613_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236613_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236611_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236611_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236611_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236636_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236636_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236636_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236636_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236636_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236636_total_iter = 0;
    ctx->futhark_mc_segmap_task_236634_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236634_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236634_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236634_total_time = 0;
    ctx->futhark_mc_segmap_task_236634_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236644_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236644_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236644_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236644_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236644_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236644_total_iter = 0;
    ctx->futhark_mc_segred_task_236641_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236641_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236641_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236641_total_time = 0;
    ctx->futhark_mc_segred_task_236641_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236639_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236639_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236639_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236639_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236639_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236639_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236637_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236637_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236637_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236648_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236648_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236648_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236648_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236648_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236648_total_iter = 0;
    ctx->futhark_mc_segmap_task_236646_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236646_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236646_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236646_total_time = 0;
    ctx->futhark_mc_segmap_task_236646_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236657_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236657_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236657_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236657_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236657_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236657_total_iter = 0;
    ctx->futhark_mc_segmap_task_236655_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236655_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236655_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236655_total_time = 0;
    ctx->futhark_mc_segmap_task_236655_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236652_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236652_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236652_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236652_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236652_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236652_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236650_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236650_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236650_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236666_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236666_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236666_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236666_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236666_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236666_total_iter = 0;
    ctx->futhark_mc_segmap_task_236664_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236664_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236664_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236664_total_time = 0;
    ctx->futhark_mc_segmap_task_236664_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236661_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236661_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236661_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236661_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236661_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236661_total_iter = 0;
    ctx->futhark_mc_segmap_task_236659_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236659_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236659_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236659_total_time = 0;
    ctx->futhark_mc_segmap_task_236659_total_iter = 0;
    init_constants(ctx);
    return ctx;
}
void futhark_context_free(struct futhark_context *ctx)
{
    free(ctx->futhark_mc_segred_stage_1_parloop_235420_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235420_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235420_iter);
    free(ctx->futhark_mc_segred_task_235417_total_runtime);
    free(ctx->futhark_mc_segred_task_235417_runs);
    free(ctx->futhark_mc_segred_task_235417_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235429_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235429_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235429_iter);
    free(ctx->futhark_mc_segred_task_235426_total_runtime);
    free(ctx->futhark_mc_segred_task_235426_runs);
    free(ctx->futhark_mc_segred_task_235426_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235424_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235424_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235424_iter);
    free(ctx->futhark_mc_segred_nested_task_235421_total_runtime);
    free(ctx->futhark_mc_segred_nested_task_235421_runs);
    free(ctx->futhark_mc_segred_nested_task_235421_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_235415_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_235415_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_235415_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235434_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235434_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235434_iter);
    free(ctx->futhark_mc_segred_task_235431_total_runtime);
    free(ctx->futhark_mc_segred_task_235431_runs);
    free(ctx->futhark_mc_segred_task_235431_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235443_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235443_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235443_iter);
    free(ctx->futhark_mc_segred_task_235440_total_runtime);
    free(ctx->futhark_mc_segred_task_235440_runs);
    free(ctx->futhark_mc_segred_task_235440_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235438_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235438_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235438_iter);
    free(ctx->futhark_mc_segred_nested_task_235435_total_runtime);
    free(ctx->futhark_mc_segred_nested_task_235435_runs);
    free(ctx->futhark_mc_segred_nested_task_235435_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235450_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235450_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235450_iter);
    free(ctx->futhark_mc_segred_task_235447_total_runtime);
    free(ctx->futhark_mc_segred_task_235447_runs);
    free(ctx->futhark_mc_segred_task_235447_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235459_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235459_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235459_iter);
    free(ctx->futhark_mc_segred_task_235456_total_runtime);
    free(ctx->futhark_mc_segred_task_235456_runs);
    free(ctx->futhark_mc_segred_task_235456_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235454_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235454_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235454_iter);
    free(ctx->futhark_mc_segred_nested_task_235451_total_runtime);
    free(ctx->futhark_mc_segred_nested_task_235451_runs);
    free(ctx->futhark_mc_segred_nested_task_235451_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_235445_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_235445_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_235445_iter);
    free(ctx->futhark_mc_segscan_task_235412_total_runtime);
    free(ctx->futhark_mc_segscan_task_235412_runs);
    free(ctx->futhark_mc_segscan_task_235412_iter);
    free(ctx->futhark_mc_segmap_parloop_235463_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235463_runs);
    free(ctx->futhark_mc_segmap_parloop_235463_iter);
    free(ctx->futhark_mc_segmap_task_235461_total_runtime);
    free(ctx->futhark_mc_segmap_task_235461_runs);
    free(ctx->futhark_mc_segmap_task_235461_iter);
    free(ctx->futhark_mc_segmap_parloop_235467_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235467_runs);
    free(ctx->futhark_mc_segmap_parloop_235467_iter);
    free(ctx->futhark_mc_segmap_task_235465_total_runtime);
    free(ctx->futhark_mc_segmap_task_235465_runs);
    free(ctx->futhark_mc_segmap_task_235465_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_235479_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_235479_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_235479_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_235481_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_235481_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_235481_iter);
    free(ctx->futhark_mc_segscan_task_235476_total_runtime);
    free(ctx->futhark_mc_segscan_task_235476_runs);
    free(ctx->futhark_mc_segscan_task_235476_iter);
    free(ctx->futhark_mc_segmap_parloop_235485_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235485_runs);
    free(ctx->futhark_mc_segmap_parloop_235485_iter);
    free(ctx->futhark_mc_segmap_task_235483_total_runtime);
    free(ctx->futhark_mc_segmap_task_235483_runs);
    free(ctx->futhark_mc_segmap_task_235483_iter);
    free(ctx->futhark_mc_segmap_parloop_235472_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235472_runs);
    free(ctx->futhark_mc_segmap_parloop_235472_iter);
    free(ctx->futhark_mc_segmap_nested_task_235470_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235470_runs);
    free(ctx->futhark_mc_segmap_nested_task_235470_iter);
    free(ctx->futhark_mc_segmap_parloop_235489_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235489_runs);
    free(ctx->futhark_mc_segmap_parloop_235489_iter);
    free(ctx->futhark_mc_segmap_task_235487_total_runtime);
    free(ctx->futhark_mc_segmap_task_235487_runs);
    free(ctx->futhark_mc_segmap_task_235487_iter);
    free(ctx->futhark_mc_segmap_parloop_235498_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235498_runs);
    free(ctx->futhark_mc_segmap_parloop_235498_iter);
    free(ctx->futhark_mc_segmap_task_235496_total_runtime);
    free(ctx->futhark_mc_segmap_task_235496_runs);
    free(ctx->futhark_mc_segmap_task_235496_iter);
    free(ctx->futhark_mc_segmap_parloop_235507_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235507_runs);
    free(ctx->futhark_mc_segmap_parloop_235507_iter);
    free(ctx->futhark_mc_segmap_task_235505_total_runtime);
    free(ctx->futhark_mc_segmap_task_235505_runs);
    free(ctx->futhark_mc_segmap_task_235505_iter);
    free(ctx->futhark_mc_segmap_parloop_235502_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235502_runs);
    free(ctx->futhark_mc_segmap_parloop_235502_iter);
    free(ctx->futhark_mc_segmap_nested_task_235500_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235500_runs);
    free(ctx->futhark_mc_segmap_nested_task_235500_iter);
    free(ctx->futhark_mc_segmap_parloop_235493_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235493_runs);
    free(ctx->futhark_mc_segmap_parloop_235493_iter);
    free(ctx->futhark_mc_segmap_nested_task_235491_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235491_runs);
    free(ctx->futhark_mc_segmap_nested_task_235491_iter);
    free(ctx->futhark_mc_segmap_parloop_235511_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235511_runs);
    free(ctx->futhark_mc_segmap_parloop_235511_iter);
    free(ctx->futhark_mc_segmap_task_235509_total_runtime);
    free(ctx->futhark_mc_segmap_task_235509_runs);
    free(ctx->futhark_mc_segmap_task_235509_iter);
    free(ctx->futhark_mc_segmap_parloop_235524_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235524_runs);
    free(ctx->futhark_mc_segmap_parloop_235524_iter);
    free(ctx->futhark_mc_segmap_task_235522_total_runtime);
    free(ctx->futhark_mc_segmap_task_235522_runs);
    free(ctx->futhark_mc_segmap_task_235522_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_235536_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_235536_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_235536_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_235538_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_235538_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_235538_iter);
    free(ctx->futhark_mc_segscan_task_235533_total_runtime);
    free(ctx->futhark_mc_segscan_task_235533_runs);
    free(ctx->futhark_mc_segscan_task_235533_iter);
    free(ctx->futhark_mc_segmap_parloop_235542_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235542_runs);
    free(ctx->futhark_mc_segmap_parloop_235542_iter);
    free(ctx->futhark_mc_segmap_task_235540_total_runtime);
    free(ctx->futhark_mc_segmap_task_235540_runs);
    free(ctx->futhark_mc_segmap_task_235540_iter);
    free(ctx->futhark_mc_segmap_parloop_235529_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235529_runs);
    free(ctx->futhark_mc_segmap_parloop_235529_iter);
    free(ctx->futhark_mc_segmap_nested_task_235527_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235527_runs);
    free(ctx->futhark_mc_segmap_nested_task_235527_iter);
    free(ctx->futhark_mc_segmap_parloop_235518_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235518_runs);
    free(ctx->futhark_mc_segmap_parloop_235518_iter);
    free(ctx->futhark_mc_segmap_nested_task_235516_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235516_runs);
    free(ctx->futhark_mc_segmap_nested_task_235516_iter);
    free(ctx->futhark_mc_segmap_parloop_235546_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235546_runs);
    free(ctx->futhark_mc_segmap_parloop_235546_iter);
    free(ctx->futhark_mc_segmap_task_235544_total_runtime);
    free(ctx->futhark_mc_segmap_task_235544_runs);
    free(ctx->futhark_mc_segmap_task_235544_iter);
    free(ctx->futhark_mc_segmap_parloop_235558_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235558_runs);
    free(ctx->futhark_mc_segmap_parloop_235558_iter);
    free(ctx->futhark_mc_segmap_task_235556_total_runtime);
    free(ctx->futhark_mc_segmap_task_235556_runs);
    free(ctx->futhark_mc_segmap_task_235556_iter);
    free(ctx->futhark_mc_segmap_parloop_235571_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235571_runs);
    free(ctx->futhark_mc_segmap_parloop_235571_iter);
    free(ctx->futhark_mc_segmap_task_235569_total_runtime);
    free(ctx->futhark_mc_segmap_task_235569_runs);
    free(ctx->futhark_mc_segmap_task_235569_iter);
    free(ctx->futhark_mc_segmap_parloop_235575_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235575_runs);
    free(ctx->futhark_mc_segmap_parloop_235575_iter);
    free(ctx->futhark_mc_segmap_task_235573_total_runtime);
    free(ctx->futhark_mc_segmap_task_235573_runs);
    free(ctx->futhark_mc_segmap_task_235573_iter);
    free(ctx->futhark_mc_segmap_parloop_235564_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235564_runs);
    free(ctx->futhark_mc_segmap_parloop_235564_iter);
    free(ctx->futhark_mc_segmap_nested_task_235562_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235562_runs);
    free(ctx->futhark_mc_segmap_nested_task_235562_iter);
    free(ctx->futhark_mc_segmap_parloop_235552_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235552_runs);
    free(ctx->futhark_mc_segmap_parloop_235552_iter);
    free(ctx->futhark_mc_segmap_nested_task_235550_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235550_runs);
    free(ctx->futhark_mc_segmap_nested_task_235550_iter);
    free(ctx->futhark_mc_segmap_parloop_235579_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235579_runs);
    free(ctx->futhark_mc_segmap_parloop_235579_iter);
    free(ctx->futhark_mc_segmap_task_235577_total_runtime);
    free(ctx->futhark_mc_segmap_task_235577_runs);
    free(ctx->futhark_mc_segmap_task_235577_iter);
    free(ctx->futhark_mc_segmap_parloop_235592_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235592_runs);
    free(ctx->futhark_mc_segmap_parloop_235592_iter);
    free(ctx->futhark_mc_segmap_task_235590_total_runtime);
    free(ctx->futhark_mc_segmap_task_235590_runs);
    free(ctx->futhark_mc_segmap_task_235590_iter);
    free(ctx->futhark_mc_segmap_parloop_235596_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235596_runs);
    free(ctx->futhark_mc_segmap_parloop_235596_iter);
    free(ctx->futhark_mc_segmap_task_235594_total_runtime);
    free(ctx->futhark_mc_segmap_task_235594_runs);
    free(ctx->futhark_mc_segmap_task_235594_iter);
    free(ctx->futhark_mc_segmap_parloop_235585_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235585_runs);
    free(ctx->futhark_mc_segmap_parloop_235585_iter);
    free(ctx->futhark_mc_segmap_nested_task_235583_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235583_runs);
    free(ctx->futhark_mc_segmap_nested_task_235583_iter);
    free(ctx->futhark_mc_segmap_parloop_235600_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235600_runs);
    free(ctx->futhark_mc_segmap_parloop_235600_iter);
    free(ctx->futhark_mc_segmap_task_235598_total_runtime);
    free(ctx->futhark_mc_segmap_task_235598_runs);
    free(ctx->futhark_mc_segmap_task_235598_iter);
    free(ctx->futhark_mc_segmap_parloop_235613_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235613_runs);
    free(ctx->futhark_mc_segmap_parloop_235613_iter);
    free(ctx->futhark_mc_segmap_task_235611_total_runtime);
    free(ctx->futhark_mc_segmap_task_235611_runs);
    free(ctx->futhark_mc_segmap_task_235611_iter);
    free(ctx->futhark_mc_segmap_parloop_235617_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235617_runs);
    free(ctx->futhark_mc_segmap_parloop_235617_iter);
    free(ctx->futhark_mc_segmap_task_235615_total_runtime);
    free(ctx->futhark_mc_segmap_task_235615_runs);
    free(ctx->futhark_mc_segmap_task_235615_iter);
    free(ctx->futhark_mc_segmap_parloop_235606_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235606_runs);
    free(ctx->futhark_mc_segmap_parloop_235606_iter);
    free(ctx->futhark_mc_segmap_nested_task_235604_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235604_runs);
    free(ctx->futhark_mc_segmap_nested_task_235604_iter);
    free(ctx->futhark_mc_segmap_parloop_235621_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235621_runs);
    free(ctx->futhark_mc_segmap_parloop_235621_iter);
    free(ctx->futhark_mc_segmap_task_235619_total_runtime);
    free(ctx->futhark_mc_segmap_task_235619_runs);
    free(ctx->futhark_mc_segmap_task_235619_iter);
    free(ctx->futhark_mc_segmap_parloop_235630_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235630_runs);
    free(ctx->futhark_mc_segmap_parloop_235630_iter);
    free(ctx->futhark_mc_segmap_task_235628_total_runtime);
    free(ctx->futhark_mc_segmap_task_235628_runs);
    free(ctx->futhark_mc_segmap_task_235628_iter);
    free(ctx->futhark_mc_segmap_parloop_235625_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235625_runs);
    free(ctx->futhark_mc_segmap_parloop_235625_iter);
    free(ctx->futhark_mc_segmap_nested_task_235623_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235623_runs);
    free(ctx->futhark_mc_segmap_nested_task_235623_iter);
    free(ctx->futhark_mc_segmap_parloop_235634_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235634_runs);
    free(ctx->futhark_mc_segmap_parloop_235634_iter);
    free(ctx->futhark_mc_segmap_task_235632_total_runtime);
    free(ctx->futhark_mc_segmap_task_235632_runs);
    free(ctx->futhark_mc_segmap_task_235632_iter);
    free(ctx->futhark_mc_segmap_parloop_235645_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235645_runs);
    free(ctx->futhark_mc_segmap_parloop_235645_iter);
    free(ctx->futhark_mc_segmap_task_235643_total_runtime);
    free(ctx->futhark_mc_segmap_task_235643_runs);
    free(ctx->futhark_mc_segmap_task_235643_iter);
    free(ctx->futhark_mc_segmap_parloop_235656_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235656_runs);
    free(ctx->futhark_mc_segmap_parloop_235656_iter);
    free(ctx->futhark_mc_segmap_task_235654_total_runtime);
    free(ctx->futhark_mc_segmap_task_235654_runs);
    free(ctx->futhark_mc_segmap_task_235654_iter);
    free(ctx->futhark_mc_segmap_parloop_235650_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235650_runs);
    free(ctx->futhark_mc_segmap_parloop_235650_iter);
    free(ctx->futhark_mc_segmap_nested_task_235648_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235648_runs);
    free(ctx->futhark_mc_segmap_nested_task_235648_iter);
    free(ctx->futhark_mc_segmap_parloop_235639_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235639_runs);
    free(ctx->futhark_mc_segmap_parloop_235639_iter);
    free(ctx->futhark_mc_segmap_nested_task_235637_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235637_runs);
    free(ctx->futhark_mc_segmap_nested_task_235637_iter);
    free(ctx->futhark_mc_segmap_parloop_235660_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235660_runs);
    free(ctx->futhark_mc_segmap_parloop_235660_iter);
    free(ctx->futhark_mc_segmap_task_235658_total_runtime);
    free(ctx->futhark_mc_segmap_task_235658_runs);
    free(ctx->futhark_mc_segmap_task_235658_iter);
    free(ctx->futhark_mc_segmap_parloop_235669_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235669_runs);
    free(ctx->futhark_mc_segmap_parloop_235669_iter);
    free(ctx->futhark_mc_segmap_task_235667_total_runtime);
    free(ctx->futhark_mc_segmap_task_235667_runs);
    free(ctx->futhark_mc_segmap_task_235667_iter);
    free(ctx->futhark_mc_segmap_parloop_235678_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235678_runs);
    free(ctx->futhark_mc_segmap_parloop_235678_iter);
    free(ctx->futhark_mc_segmap_task_235676_total_runtime);
    free(ctx->futhark_mc_segmap_task_235676_runs);
    free(ctx->futhark_mc_segmap_task_235676_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235686_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235686_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235686_iter);
    free(ctx->futhark_mc_segred_task_235683_total_runtime);
    free(ctx->futhark_mc_segred_task_235683_runs);
    free(ctx->futhark_mc_segred_task_235683_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235691_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235691_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235691_iter);
    free(ctx->futhark_mc_segred_task_235688_total_runtime);
    free(ctx->futhark_mc_segred_task_235688_runs);
    free(ctx->futhark_mc_segred_task_235688_iter);
    free(ctx->futhark_mc_segmap_parloop_235681_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235681_runs);
    free(ctx->futhark_mc_segmap_parloop_235681_iter);
    free(ctx->futhark_mc_segmap_nested_task_235679_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235679_runs);
    free(ctx->futhark_mc_segmap_nested_task_235679_iter);
    free(ctx->futhark_mc_segmap_parloop_235673_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235673_runs);
    free(ctx->futhark_mc_segmap_parloop_235673_iter);
    free(ctx->futhark_mc_segmap_nested_task_235671_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235671_runs);
    free(ctx->futhark_mc_segmap_nested_task_235671_iter);
    free(ctx->futhark_mc_segmap_parloop_235664_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235664_runs);
    free(ctx->futhark_mc_segmap_parloop_235664_iter);
    free(ctx->futhark_mc_segmap_nested_task_235662_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235662_runs);
    free(ctx->futhark_mc_segmap_nested_task_235662_iter);
    free(ctx->futhark_mc_segmap_parloop_235695_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235695_runs);
    free(ctx->futhark_mc_segmap_parloop_235695_iter);
    free(ctx->futhark_mc_segmap_task_235693_total_runtime);
    free(ctx->futhark_mc_segmap_task_235693_runs);
    free(ctx->futhark_mc_segmap_task_235693_iter);
    free(ctx->futhark_mc_segmap_parloop_235706_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235706_runs);
    free(ctx->futhark_mc_segmap_parloop_235706_iter);
    free(ctx->futhark_mc_segmap_task_235704_total_runtime);
    free(ctx->futhark_mc_segmap_task_235704_runs);
    free(ctx->futhark_mc_segmap_task_235704_iter);
    free(ctx->futhark_mc_segmap_parloop_235717_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235717_runs);
    free(ctx->futhark_mc_segmap_parloop_235717_iter);
    free(ctx->futhark_mc_segmap_task_235715_total_runtime);
    free(ctx->futhark_mc_segmap_task_235715_runs);
    free(ctx->futhark_mc_segmap_task_235715_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235727_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235727_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235727_iter);
    free(ctx->futhark_mc_segred_task_235722_total_runtime);
    free(ctx->futhark_mc_segred_task_235722_runs);
    free(ctx->futhark_mc_segred_task_235722_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235733_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235733_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235733_iter);
    free(ctx->futhark_mc_segred_task_235729_total_runtime);
    free(ctx->futhark_mc_segred_task_235729_runs);
    free(ctx->futhark_mc_segred_task_235729_iter);
    free(ctx->futhark_mc_segmap_parloop_235720_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235720_runs);
    free(ctx->futhark_mc_segmap_parloop_235720_iter);
    free(ctx->futhark_mc_segmap_nested_task_235718_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235718_runs);
    free(ctx->futhark_mc_segmap_nested_task_235718_iter);
    free(ctx->futhark_mc_segmap_parloop_235711_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235711_runs);
    free(ctx->futhark_mc_segmap_parloop_235711_iter);
    free(ctx->futhark_mc_segmap_nested_task_235709_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235709_runs);
    free(ctx->futhark_mc_segmap_nested_task_235709_iter);
    free(ctx->futhark_mc_segmap_parloop_235700_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235700_runs);
    free(ctx->futhark_mc_segmap_parloop_235700_iter);
    free(ctx->futhark_mc_segmap_nested_task_235698_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235698_runs);
    free(ctx->futhark_mc_segmap_nested_task_235698_iter);
    free(ctx->futhark_mc_segmap_parloop_235737_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235737_runs);
    free(ctx->futhark_mc_segmap_parloop_235737_iter);
    free(ctx->futhark_mc_segmap_task_235735_total_runtime);
    free(ctx->futhark_mc_segmap_task_235735_runs);
    free(ctx->futhark_mc_segmap_task_235735_iter);
    free(ctx->futhark_mc_segmap_parloop_235748_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235748_runs);
    free(ctx->futhark_mc_segmap_parloop_235748_iter);
    free(ctx->futhark_mc_segmap_task_235746_total_runtime);
    free(ctx->futhark_mc_segmap_task_235746_runs);
    free(ctx->futhark_mc_segmap_task_235746_iter);
    free(ctx->futhark_mc_segmap_parloop_235759_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235759_runs);
    free(ctx->futhark_mc_segmap_parloop_235759_iter);
    free(ctx->futhark_mc_segmap_task_235757_total_runtime);
    free(ctx->futhark_mc_segmap_task_235757_runs);
    free(ctx->futhark_mc_segmap_task_235757_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235771_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235771_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235771_iter);
    free(ctx->futhark_mc_segred_task_235764_total_runtime);
    free(ctx->futhark_mc_segred_task_235764_runs);
    free(ctx->futhark_mc_segred_task_235764_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235777_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235777_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235777_iter);
    free(ctx->futhark_mc_segred_task_235773_total_runtime);
    free(ctx->futhark_mc_segred_task_235773_runs);
    free(ctx->futhark_mc_segred_task_235773_iter);
    free(ctx->futhark_mc_segmap_parloop_235762_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235762_runs);
    free(ctx->futhark_mc_segmap_parloop_235762_iter);
    free(ctx->futhark_mc_segmap_nested_task_235760_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235760_runs);
    free(ctx->futhark_mc_segmap_nested_task_235760_iter);
    free(ctx->futhark_mc_segmap_parloop_235753_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235753_runs);
    free(ctx->futhark_mc_segmap_parloop_235753_iter);
    free(ctx->futhark_mc_segmap_nested_task_235751_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235751_runs);
    free(ctx->futhark_mc_segmap_nested_task_235751_iter);
    free(ctx->futhark_mc_segmap_parloop_235742_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235742_runs);
    free(ctx->futhark_mc_segmap_parloop_235742_iter);
    free(ctx->futhark_mc_segmap_nested_task_235740_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235740_runs);
    free(ctx->futhark_mc_segmap_nested_task_235740_iter);
    free(ctx->futhark_mc_segmap_parloop_235781_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235781_runs);
    free(ctx->futhark_mc_segmap_parloop_235781_iter);
    free(ctx->futhark_mc_segmap_task_235779_total_runtime);
    free(ctx->futhark_mc_segmap_task_235779_runs);
    free(ctx->futhark_mc_segmap_task_235779_iter);
    free(ctx->futhark_mc_segmap_parloop_235791_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235791_runs);
    free(ctx->futhark_mc_segmap_parloop_235791_iter);
    free(ctx->futhark_mc_segmap_task_235789_total_runtime);
    free(ctx->futhark_mc_segmap_task_235789_runs);
    free(ctx->futhark_mc_segmap_task_235789_iter);
    free(ctx->futhark_mc_segmap_parloop_235801_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235801_runs);
    free(ctx->futhark_mc_segmap_parloop_235801_iter);
    free(ctx->futhark_mc_segmap_task_235799_total_runtime);
    free(ctx->futhark_mc_segmap_task_235799_runs);
    free(ctx->futhark_mc_segmap_task_235799_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235811_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235811_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235811_iter);
    free(ctx->futhark_mc_segred_task_235808_total_runtime);
    free(ctx->futhark_mc_segred_task_235808_runs);
    free(ctx->futhark_mc_segred_task_235808_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235816_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235816_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235816_iter);
    free(ctx->futhark_mc_segred_task_235813_total_runtime);
    free(ctx->futhark_mc_segred_task_235813_runs);
    free(ctx->futhark_mc_segred_task_235813_iter);
    free(ctx->futhark_mc_segmap_parloop_235805_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235805_runs);
    free(ctx->futhark_mc_segmap_parloop_235805_iter);
    free(ctx->futhark_mc_segmap_nested_task_235803_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235803_runs);
    free(ctx->futhark_mc_segmap_nested_task_235803_iter);
    free(ctx->futhark_mc_segmap_parloop_235796_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235796_runs);
    free(ctx->futhark_mc_segmap_parloop_235796_iter);
    free(ctx->futhark_mc_segmap_nested_task_235794_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235794_runs);
    free(ctx->futhark_mc_segmap_nested_task_235794_iter);
    free(ctx->futhark_mc_segmap_parloop_235786_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235786_runs);
    free(ctx->futhark_mc_segmap_parloop_235786_iter);
    free(ctx->futhark_mc_segmap_nested_task_235784_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235784_runs);
    free(ctx->futhark_mc_segmap_nested_task_235784_iter);
    free(ctx->futhark_mc_segmap_parloop_235820_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235820_runs);
    free(ctx->futhark_mc_segmap_parloop_235820_iter);
    free(ctx->futhark_mc_segmap_task_235818_total_runtime);
    free(ctx->futhark_mc_segmap_task_235818_runs);
    free(ctx->futhark_mc_segmap_task_235818_iter);
    free(ctx->futhark_mc_segmap_parloop_235833_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235833_runs);
    free(ctx->futhark_mc_segmap_parloop_235833_iter);
    free(ctx->futhark_mc_segmap_task_235831_total_runtime);
    free(ctx->futhark_mc_segmap_task_235831_runs);
    free(ctx->futhark_mc_segmap_task_235831_iter);
    free(ctx->futhark_mc_segmap_parloop_235846_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235846_runs);
    free(ctx->futhark_mc_segmap_parloop_235846_iter);
    free(ctx->futhark_mc_segmap_task_235844_total_runtime);
    free(ctx->futhark_mc_segmap_task_235844_runs);
    free(ctx->futhark_mc_segmap_task_235844_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235860_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235860_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235860_iter);
    free(ctx->futhark_mc_segred_task_235855_total_runtime);
    free(ctx->futhark_mc_segred_task_235855_runs);
    free(ctx->futhark_mc_segred_task_235855_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235866_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235866_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235866_iter);
    free(ctx->futhark_mc_segred_task_235862_total_runtime);
    free(ctx->futhark_mc_segred_task_235862_runs);
    free(ctx->futhark_mc_segred_task_235862_iter);
    free(ctx->futhark_mc_segmap_parloop_235851_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235851_runs);
    free(ctx->futhark_mc_segmap_parloop_235851_iter);
    free(ctx->futhark_mc_segmap_nested_task_235849_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235849_runs);
    free(ctx->futhark_mc_segmap_nested_task_235849_iter);
    free(ctx->futhark_mc_segmap_parloop_235840_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235840_runs);
    free(ctx->futhark_mc_segmap_parloop_235840_iter);
    free(ctx->futhark_mc_segmap_nested_task_235838_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235838_runs);
    free(ctx->futhark_mc_segmap_nested_task_235838_iter);
    free(ctx->futhark_mc_segmap_parloop_235827_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235827_runs);
    free(ctx->futhark_mc_segmap_parloop_235827_iter);
    free(ctx->futhark_mc_segmap_nested_task_235825_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235825_runs);
    free(ctx->futhark_mc_segmap_nested_task_235825_iter);
    free(ctx->futhark_mc_segmap_parloop_235870_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235870_runs);
    free(ctx->futhark_mc_segmap_parloop_235870_iter);
    free(ctx->futhark_mc_segmap_task_235868_total_runtime);
    free(ctx->futhark_mc_segmap_task_235868_runs);
    free(ctx->futhark_mc_segmap_task_235868_iter);
    free(ctx->futhark_mc_segmap_parloop_235885_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235885_runs);
    free(ctx->futhark_mc_segmap_parloop_235885_iter);
    free(ctx->futhark_mc_segmap_task_235883_total_runtime);
    free(ctx->futhark_mc_segmap_task_235883_runs);
    free(ctx->futhark_mc_segmap_task_235883_iter);
    free(ctx->futhark_mc_segmap_parloop_235900_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235900_runs);
    free(ctx->futhark_mc_segmap_parloop_235900_iter);
    free(ctx->futhark_mc_segmap_task_235898_total_runtime);
    free(ctx->futhark_mc_segmap_task_235898_runs);
    free(ctx->futhark_mc_segmap_task_235898_iter);
    free(ctx->futhark_mc_segmap_parloop_235915_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235915_runs);
    free(ctx->futhark_mc_segmap_parloop_235915_iter);
    free(ctx->futhark_mc_segmap_task_235913_total_runtime);
    free(ctx->futhark_mc_segmap_task_235913_runs);
    free(ctx->futhark_mc_segmap_task_235913_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235924_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235924_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235924_iter);
    free(ctx->futhark_mc_segred_task_235917_total_runtime);
    free(ctx->futhark_mc_segred_task_235917_runs);
    free(ctx->futhark_mc_segred_task_235917_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235930_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235930_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235930_iter);
    free(ctx->futhark_mc_segred_task_235926_total_runtime);
    free(ctx->futhark_mc_segred_task_235926_runs);
    free(ctx->futhark_mc_segred_task_235926_iter);
    free(ctx->futhark_mc_segmap_parloop_235907_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235907_runs);
    free(ctx->futhark_mc_segmap_parloop_235907_iter);
    free(ctx->futhark_mc_segmap_nested_task_235905_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235905_runs);
    free(ctx->futhark_mc_segmap_nested_task_235905_iter);
    free(ctx->futhark_mc_segmap_parloop_235894_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235894_runs);
    free(ctx->futhark_mc_segmap_parloop_235894_iter);
    free(ctx->futhark_mc_segmap_nested_task_235892_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235892_runs);
    free(ctx->futhark_mc_segmap_nested_task_235892_iter);
    free(ctx->futhark_mc_segmap_parloop_235879_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235879_runs);
    free(ctx->futhark_mc_segmap_parloop_235879_iter);
    free(ctx->futhark_mc_segmap_nested_task_235877_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235877_runs);
    free(ctx->futhark_mc_segmap_nested_task_235877_iter);
    free(ctx->futhark_mc_segmap_parloop_235934_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235934_runs);
    free(ctx->futhark_mc_segmap_parloop_235934_iter);
    free(ctx->futhark_mc_segmap_task_235932_total_runtime);
    free(ctx->futhark_mc_segmap_task_235932_runs);
    free(ctx->futhark_mc_segmap_task_235932_iter);
    free(ctx->futhark_mc_segmap_parloop_235943_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235943_runs);
    free(ctx->futhark_mc_segmap_parloop_235943_iter);
    free(ctx->futhark_mc_segmap_task_235941_total_runtime);
    free(ctx->futhark_mc_segmap_task_235941_runs);
    free(ctx->futhark_mc_segmap_task_235941_iter);
    free(ctx->futhark_mc_segmap_parloop_235952_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235952_runs);
    free(ctx->futhark_mc_segmap_parloop_235952_iter);
    free(ctx->futhark_mc_segmap_task_235950_total_runtime);
    free(ctx->futhark_mc_segmap_task_235950_runs);
    free(ctx->futhark_mc_segmap_task_235950_iter);
    free(ctx->futhark_mc_segmap_parloop_235947_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235947_runs);
    free(ctx->futhark_mc_segmap_parloop_235947_iter);
    free(ctx->futhark_mc_segmap_nested_task_235945_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235945_runs);
    free(ctx->futhark_mc_segmap_nested_task_235945_iter);
    free(ctx->futhark_mc_segmap_parloop_235938_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235938_runs);
    free(ctx->futhark_mc_segmap_parloop_235938_iter);
    free(ctx->futhark_mc_segmap_nested_task_235936_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235936_runs);
    free(ctx->futhark_mc_segmap_nested_task_235936_iter);
    free(ctx->futhark_mc_segmap_parloop_235956_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235956_runs);
    free(ctx->futhark_mc_segmap_parloop_235956_iter);
    free(ctx->futhark_mc_segmap_task_235954_total_runtime);
    free(ctx->futhark_mc_segmap_task_235954_runs);
    free(ctx->futhark_mc_segmap_task_235954_iter);
    free(ctx->futhark_mc_segmap_parloop_235965_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235965_runs);
    free(ctx->futhark_mc_segmap_parloop_235965_iter);
    free(ctx->futhark_mc_segmap_task_235963_total_runtime);
    free(ctx->futhark_mc_segmap_task_235963_runs);
    free(ctx->futhark_mc_segmap_task_235963_iter);
    free(ctx->futhark_mc_segmap_parloop_235960_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235960_runs);
    free(ctx->futhark_mc_segmap_parloop_235960_iter);
    free(ctx->futhark_mc_segmap_nested_task_235958_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235958_runs);
    free(ctx->futhark_mc_segmap_nested_task_235958_iter);
    free(ctx->futhark_mc_segmap_parloop_235969_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235969_runs);
    free(ctx->futhark_mc_segmap_parloop_235969_iter);
    free(ctx->futhark_mc_segmap_task_235967_total_runtime);
    free(ctx->futhark_mc_segmap_task_235967_runs);
    free(ctx->futhark_mc_segmap_task_235967_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235977_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235977_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235977_iter);
    free(ctx->futhark_mc_segred_task_235974_total_runtime);
    free(ctx->futhark_mc_segred_task_235974_runs);
    free(ctx->futhark_mc_segred_task_235974_iter);
    free(ctx->futhark_mc_segmap_parloop_235972_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235972_runs);
    free(ctx->futhark_mc_segmap_parloop_235972_iter);
    free(ctx->futhark_mc_segmap_nested_task_235970_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235970_runs);
    free(ctx->futhark_mc_segmap_nested_task_235970_iter);
    free(ctx->futhark_mc_segmap_parloop_235981_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235981_runs);
    free(ctx->futhark_mc_segmap_parloop_235981_iter);
    free(ctx->futhark_mc_segmap_task_235979_total_runtime);
    free(ctx->futhark_mc_segmap_task_235979_runs);
    free(ctx->futhark_mc_segmap_task_235979_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_235991_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_235991_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_235991_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_235993_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_235993_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_235993_iter);
    free(ctx->futhark_mc_segscan_task_235988_total_runtime);
    free(ctx->futhark_mc_segscan_task_235988_runs);
    free(ctx->futhark_mc_segscan_task_235988_iter);
    free(ctx->futhark_mc_segmap_parloop_235985_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235985_runs);
    free(ctx->futhark_mc_segmap_parloop_235985_iter);
    free(ctx->futhark_mc_segmap_nested_task_235983_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235983_runs);
    free(ctx->futhark_mc_segmap_nested_task_235983_iter);
    free(ctx->futhark_mc_segmap_parloop_235997_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235997_runs);
    free(ctx->futhark_mc_segmap_parloop_235997_iter);
    free(ctx->futhark_mc_segmap_task_235995_total_runtime);
    free(ctx->futhark_mc_segmap_task_235995_runs);
    free(ctx->futhark_mc_segmap_task_235995_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236005_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236005_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236005_iter);
    free(ctx->futhark_mc_segred_task_236002_total_runtime);
    free(ctx->futhark_mc_segred_task_236002_runs);
    free(ctx->futhark_mc_segred_task_236002_iter);
    free(ctx->futhark_mc_segmap_parloop_236000_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236000_runs);
    free(ctx->futhark_mc_segmap_parloop_236000_iter);
    free(ctx->futhark_mc_segmap_nested_task_235998_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235998_runs);
    free(ctx->futhark_mc_segmap_nested_task_235998_iter);
    free(ctx->futhark_mc_segmap_parloop_236009_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236009_runs);
    free(ctx->futhark_mc_segmap_parloop_236009_iter);
    free(ctx->futhark_mc_segmap_task_236007_total_runtime);
    free(ctx->futhark_mc_segmap_task_236007_runs);
    free(ctx->futhark_mc_segmap_task_236007_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_236019_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_236019_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_236019_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_236021_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_236021_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_236021_iter);
    free(ctx->futhark_mc_segscan_task_236016_total_runtime);
    free(ctx->futhark_mc_segscan_task_236016_runs);
    free(ctx->futhark_mc_segscan_task_236016_iter);
    free(ctx->futhark_mc_segmap_parloop_236013_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236013_runs);
    free(ctx->futhark_mc_segmap_parloop_236013_iter);
    free(ctx->futhark_mc_segmap_nested_task_236011_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236011_runs);
    free(ctx->futhark_mc_segmap_nested_task_236011_iter);
    free(ctx->futhark_mc_segmap_parloop_236025_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236025_runs);
    free(ctx->futhark_mc_segmap_parloop_236025_iter);
    free(ctx->futhark_mc_segmap_task_236023_total_runtime);
    free(ctx->futhark_mc_segmap_task_236023_runs);
    free(ctx->futhark_mc_segmap_task_236023_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236033_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236033_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236033_iter);
    free(ctx->futhark_mc_segred_task_236030_total_runtime);
    free(ctx->futhark_mc_segred_task_236030_runs);
    free(ctx->futhark_mc_segred_task_236030_iter);
    free(ctx->futhark_mc_segmap_parloop_236028_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236028_runs);
    free(ctx->futhark_mc_segmap_parloop_236028_iter);
    free(ctx->futhark_mc_segmap_nested_task_236026_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236026_runs);
    free(ctx->futhark_mc_segmap_nested_task_236026_iter);
    free(ctx->futhark_mc_segmap_parloop_236037_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236037_runs);
    free(ctx->futhark_mc_segmap_parloop_236037_iter);
    free(ctx->futhark_mc_segmap_task_236035_total_runtime);
    free(ctx->futhark_mc_segmap_task_236035_runs);
    free(ctx->futhark_mc_segmap_task_236035_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_236047_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_236047_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_236047_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_236049_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_236049_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_236049_iter);
    free(ctx->futhark_mc_segscan_task_236044_total_runtime);
    free(ctx->futhark_mc_segscan_task_236044_runs);
    free(ctx->futhark_mc_segscan_task_236044_iter);
    free(ctx->futhark_mc_segmap_parloop_236041_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236041_runs);
    free(ctx->futhark_mc_segmap_parloop_236041_iter);
    free(ctx->futhark_mc_segmap_nested_task_236039_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236039_runs);
    free(ctx->futhark_mc_segmap_nested_task_236039_iter);
    free(ctx->futhark_mc_segmap_parloop_236053_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236053_runs);
    free(ctx->futhark_mc_segmap_parloop_236053_iter);
    free(ctx->futhark_mc_segmap_task_236051_total_runtime);
    free(ctx->futhark_mc_segmap_task_236051_runs);
    free(ctx->futhark_mc_segmap_task_236051_iter);
    free(ctx->futhark_mc_segmap_parloop_236062_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236062_runs);
    free(ctx->futhark_mc_segmap_parloop_236062_iter);
    free(ctx->futhark_mc_segmap_task_236060_total_runtime);
    free(ctx->futhark_mc_segmap_task_236060_runs);
    free(ctx->futhark_mc_segmap_task_236060_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236070_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236070_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236070_iter);
    free(ctx->futhark_mc_segred_task_236067_total_runtime);
    free(ctx->futhark_mc_segred_task_236067_runs);
    free(ctx->futhark_mc_segred_task_236067_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236075_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236075_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236075_iter);
    free(ctx->futhark_mc_segred_task_236072_total_runtime);
    free(ctx->futhark_mc_segred_task_236072_runs);
    free(ctx->futhark_mc_segred_task_236072_iter);
    free(ctx->futhark_mc_segmap_parloop_236065_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236065_runs);
    free(ctx->futhark_mc_segmap_parloop_236065_iter);
    free(ctx->futhark_mc_segmap_nested_task_236063_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236063_runs);
    free(ctx->futhark_mc_segmap_nested_task_236063_iter);
    free(ctx->futhark_mc_segmap_parloop_236057_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236057_runs);
    free(ctx->futhark_mc_segmap_parloop_236057_iter);
    free(ctx->futhark_mc_segmap_nested_task_236055_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236055_runs);
    free(ctx->futhark_mc_segmap_nested_task_236055_iter);
    free(ctx->futhark_mc_segmap_parloop_236079_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236079_runs);
    free(ctx->futhark_mc_segmap_parloop_236079_iter);
    free(ctx->futhark_mc_segmap_task_236077_total_runtime);
    free(ctx->futhark_mc_segmap_task_236077_runs);
    free(ctx->futhark_mc_segmap_task_236077_iter);
    free(ctx->futhark_mc_segmap_parloop_236090_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236090_runs);
    free(ctx->futhark_mc_segmap_parloop_236090_iter);
    free(ctx->futhark_mc_segmap_task_236088_total_runtime);
    free(ctx->futhark_mc_segmap_task_236088_runs);
    free(ctx->futhark_mc_segmap_task_236088_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236100_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236100_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236100_iter);
    free(ctx->futhark_mc_segred_task_236095_total_runtime);
    free(ctx->futhark_mc_segred_task_236095_runs);
    free(ctx->futhark_mc_segred_task_236095_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236106_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236106_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236106_iter);
    free(ctx->futhark_mc_segred_task_236102_total_runtime);
    free(ctx->futhark_mc_segred_task_236102_runs);
    free(ctx->futhark_mc_segred_task_236102_iter);
    free(ctx->futhark_mc_segmap_parloop_236093_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236093_runs);
    free(ctx->futhark_mc_segmap_parloop_236093_iter);
    free(ctx->futhark_mc_segmap_nested_task_236091_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236091_runs);
    free(ctx->futhark_mc_segmap_nested_task_236091_iter);
    free(ctx->futhark_mc_segmap_parloop_236084_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236084_runs);
    free(ctx->futhark_mc_segmap_parloop_236084_iter);
    free(ctx->futhark_mc_segmap_nested_task_236082_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236082_runs);
    free(ctx->futhark_mc_segmap_nested_task_236082_iter);
    free(ctx->futhark_mc_segmap_parloop_236110_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236110_runs);
    free(ctx->futhark_mc_segmap_parloop_236110_iter);
    free(ctx->futhark_mc_segmap_task_236108_total_runtime);
    free(ctx->futhark_mc_segmap_task_236108_runs);
    free(ctx->futhark_mc_segmap_task_236108_iter);
    free(ctx->futhark_mc_segmap_parloop_236121_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236121_runs);
    free(ctx->futhark_mc_segmap_parloop_236121_iter);
    free(ctx->futhark_mc_segmap_task_236119_total_runtime);
    free(ctx->futhark_mc_segmap_task_236119_runs);
    free(ctx->futhark_mc_segmap_task_236119_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236133_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236133_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236133_iter);
    free(ctx->futhark_mc_segred_task_236126_total_runtime);
    free(ctx->futhark_mc_segred_task_236126_runs);
    free(ctx->futhark_mc_segred_task_236126_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236139_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236139_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236139_iter);
    free(ctx->futhark_mc_segred_task_236135_total_runtime);
    free(ctx->futhark_mc_segred_task_236135_runs);
    free(ctx->futhark_mc_segred_task_236135_iter);
    free(ctx->futhark_mc_segmap_parloop_236124_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236124_runs);
    free(ctx->futhark_mc_segmap_parloop_236124_iter);
    free(ctx->futhark_mc_segmap_nested_task_236122_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236122_runs);
    free(ctx->futhark_mc_segmap_nested_task_236122_iter);
    free(ctx->futhark_mc_segmap_parloop_236115_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236115_runs);
    free(ctx->futhark_mc_segmap_parloop_236115_iter);
    free(ctx->futhark_mc_segmap_nested_task_236113_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236113_runs);
    free(ctx->futhark_mc_segmap_nested_task_236113_iter);
    free(ctx->futhark_mc_segmap_parloop_236143_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236143_runs);
    free(ctx->futhark_mc_segmap_parloop_236143_iter);
    free(ctx->futhark_mc_segmap_task_236141_total_runtime);
    free(ctx->futhark_mc_segmap_task_236141_runs);
    free(ctx->futhark_mc_segmap_task_236141_iter);
    free(ctx->futhark_mc_segmap_parloop_236153_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236153_runs);
    free(ctx->futhark_mc_segmap_parloop_236153_iter);
    free(ctx->futhark_mc_segmap_task_236151_total_runtime);
    free(ctx->futhark_mc_segmap_task_236151_runs);
    free(ctx->futhark_mc_segmap_task_236151_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236163_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236163_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236163_iter);
    free(ctx->futhark_mc_segred_task_236160_total_runtime);
    free(ctx->futhark_mc_segred_task_236160_runs);
    free(ctx->futhark_mc_segred_task_236160_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236168_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236168_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236168_iter);
    free(ctx->futhark_mc_segred_task_236165_total_runtime);
    free(ctx->futhark_mc_segred_task_236165_runs);
    free(ctx->futhark_mc_segred_task_236165_iter);
    free(ctx->futhark_mc_segmap_parloop_236157_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236157_runs);
    free(ctx->futhark_mc_segmap_parloop_236157_iter);
    free(ctx->futhark_mc_segmap_nested_task_236155_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236155_runs);
    free(ctx->futhark_mc_segmap_nested_task_236155_iter);
    free(ctx->futhark_mc_segmap_parloop_236148_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236148_runs);
    free(ctx->futhark_mc_segmap_parloop_236148_iter);
    free(ctx->futhark_mc_segmap_nested_task_236146_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236146_runs);
    free(ctx->futhark_mc_segmap_nested_task_236146_iter);
    free(ctx->futhark_mc_segmap_parloop_236172_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236172_runs);
    free(ctx->futhark_mc_segmap_parloop_236172_iter);
    free(ctx->futhark_mc_segmap_task_236170_total_runtime);
    free(ctx->futhark_mc_segmap_task_236170_runs);
    free(ctx->futhark_mc_segmap_task_236170_iter);
    free(ctx->futhark_mc_segmap_parloop_236185_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236185_runs);
    free(ctx->futhark_mc_segmap_parloop_236185_iter);
    free(ctx->futhark_mc_segmap_task_236183_total_runtime);
    free(ctx->futhark_mc_segmap_task_236183_runs);
    free(ctx->futhark_mc_segmap_task_236183_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236199_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236199_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236199_iter);
    free(ctx->futhark_mc_segred_task_236194_total_runtime);
    free(ctx->futhark_mc_segred_task_236194_runs);
    free(ctx->futhark_mc_segred_task_236194_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236205_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236205_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236205_iter);
    free(ctx->futhark_mc_segred_task_236201_total_runtime);
    free(ctx->futhark_mc_segred_task_236201_runs);
    free(ctx->futhark_mc_segred_task_236201_iter);
    free(ctx->futhark_mc_segmap_parloop_236190_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236190_runs);
    free(ctx->futhark_mc_segmap_parloop_236190_iter);
    free(ctx->futhark_mc_segmap_nested_task_236188_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236188_runs);
    free(ctx->futhark_mc_segmap_nested_task_236188_iter);
    free(ctx->futhark_mc_segmap_parloop_236179_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236179_runs);
    free(ctx->futhark_mc_segmap_parloop_236179_iter);
    free(ctx->futhark_mc_segmap_nested_task_236177_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236177_runs);
    free(ctx->futhark_mc_segmap_nested_task_236177_iter);
    free(ctx->futhark_mc_segmap_parloop_236209_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236209_runs);
    free(ctx->futhark_mc_segmap_parloop_236209_iter);
    free(ctx->futhark_mc_segmap_task_236207_total_runtime);
    free(ctx->futhark_mc_segmap_task_236207_runs);
    free(ctx->futhark_mc_segmap_task_236207_iter);
    free(ctx->futhark_mc_segmap_parloop_236224_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236224_runs);
    free(ctx->futhark_mc_segmap_parloop_236224_iter);
    free(ctx->futhark_mc_segmap_task_236222_total_runtime);
    free(ctx->futhark_mc_segmap_task_236222_runs);
    free(ctx->futhark_mc_segmap_task_236222_iter);
    free(ctx->futhark_mc_segmap_parloop_236239_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236239_runs);
    free(ctx->futhark_mc_segmap_parloop_236239_iter);
    free(ctx->futhark_mc_segmap_task_236237_total_runtime);
    free(ctx->futhark_mc_segmap_task_236237_runs);
    free(ctx->futhark_mc_segmap_task_236237_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236248_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236248_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236248_iter);
    free(ctx->futhark_mc_segred_task_236241_total_runtime);
    free(ctx->futhark_mc_segred_task_236241_runs);
    free(ctx->futhark_mc_segred_task_236241_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236254_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236254_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236254_iter);
    free(ctx->futhark_mc_segred_task_236250_total_runtime);
    free(ctx->futhark_mc_segred_task_236250_runs);
    free(ctx->futhark_mc_segred_task_236250_iter);
    free(ctx->futhark_mc_segmap_parloop_236231_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236231_runs);
    free(ctx->futhark_mc_segmap_parloop_236231_iter);
    free(ctx->futhark_mc_segmap_nested_task_236229_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236229_runs);
    free(ctx->futhark_mc_segmap_nested_task_236229_iter);
    free(ctx->futhark_mc_segmap_parloop_236218_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236218_runs);
    free(ctx->futhark_mc_segmap_parloop_236218_iter);
    free(ctx->futhark_mc_segmap_nested_task_236216_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236216_runs);
    free(ctx->futhark_mc_segmap_nested_task_236216_iter);
    free(ctx->futhark_mc_segmap_parloop_236258_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236258_runs);
    free(ctx->futhark_mc_segmap_parloop_236258_iter);
    free(ctx->futhark_mc_segmap_task_236256_total_runtime);
    free(ctx->futhark_mc_segmap_task_236256_runs);
    free(ctx->futhark_mc_segmap_task_236256_iter);
    free(ctx->futhark_mc_segmap_parloop_236267_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236267_runs);
    free(ctx->futhark_mc_segmap_parloop_236267_iter);
    free(ctx->futhark_mc_segmap_task_236265_total_runtime);
    free(ctx->futhark_mc_segmap_task_236265_runs);
    free(ctx->futhark_mc_segmap_task_236265_iter);
    free(ctx->futhark_mc_segmap_parloop_236262_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236262_runs);
    free(ctx->futhark_mc_segmap_parloop_236262_iter);
    free(ctx->futhark_mc_segmap_nested_task_236260_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236260_runs);
    free(ctx->futhark_mc_segmap_nested_task_236260_iter);
    free(ctx->futhark_mc_segmap_parloop_236271_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236271_runs);
    free(ctx->futhark_mc_segmap_parloop_236271_iter);
    free(ctx->futhark_mc_segmap_task_236269_total_runtime);
    free(ctx->futhark_mc_segmap_task_236269_runs);
    free(ctx->futhark_mc_segmap_task_236269_iter);
    free(ctx->futhark_mc_segmap_parloop_236280_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236280_runs);
    free(ctx->futhark_mc_segmap_parloop_236280_iter);
    free(ctx->futhark_mc_segmap_task_236278_total_runtime);
    free(ctx->futhark_mc_segmap_task_236278_runs);
    free(ctx->futhark_mc_segmap_task_236278_iter);
    free(ctx->futhark_mc_segmap_parloop_236275_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236275_runs);
    free(ctx->futhark_mc_segmap_parloop_236275_iter);
    free(ctx->futhark_mc_segmap_nested_task_236273_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236273_runs);
    free(ctx->futhark_mc_segmap_nested_task_236273_iter);
    free(ctx->futhark_mc_segmap_parloop_236284_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236284_runs);
    free(ctx->futhark_mc_segmap_parloop_236284_iter);
    free(ctx->futhark_mc_segmap_task_236282_total_runtime);
    free(ctx->futhark_mc_segmap_task_236282_runs);
    free(ctx->futhark_mc_segmap_task_236282_iter);
    free(ctx->futhark_mc_segmap_parloop_236299_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236299_runs);
    free(ctx->futhark_mc_segmap_parloop_236299_iter);
    free(ctx->futhark_mc_segmap_task_236297_total_runtime);
    free(ctx->futhark_mc_segmap_task_236297_runs);
    free(ctx->futhark_mc_segmap_task_236297_iter);
    free(ctx->futhark_mc_segmap_parloop_236303_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236303_runs);
    free(ctx->futhark_mc_segmap_parloop_236303_iter);
    free(ctx->futhark_mc_segmap_task_236301_total_runtime);
    free(ctx->futhark_mc_segmap_task_236301_runs);
    free(ctx->futhark_mc_segmap_task_236301_iter);
    free(ctx->futhark_mc_segmap_parloop_236307_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236307_runs);
    free(ctx->futhark_mc_segmap_parloop_236307_iter);
    free(ctx->futhark_mc_segmap_task_236305_total_runtime);
    free(ctx->futhark_mc_segmap_task_236305_runs);
    free(ctx->futhark_mc_segmap_task_236305_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236315_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236315_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236315_iter);
    free(ctx->futhark_mc_segred_task_236312_total_runtime);
    free(ctx->futhark_mc_segred_task_236312_runs);
    free(ctx->futhark_mc_segred_task_236312_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236320_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236320_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236320_iter);
    free(ctx->futhark_mc_segred_task_236317_total_runtime);
    free(ctx->futhark_mc_segred_task_236317_runs);
    free(ctx->futhark_mc_segred_task_236317_iter);
    free(ctx->futhark_mc_segmap_parloop_236310_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236310_runs);
    free(ctx->futhark_mc_segmap_parloop_236310_iter);
    free(ctx->futhark_mc_segmap_nested_task_236308_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236308_runs);
    free(ctx->futhark_mc_segmap_nested_task_236308_iter);
    free(ctx->futhark_mc_segmap_parloop_236291_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236291_runs);
    free(ctx->futhark_mc_segmap_parloop_236291_iter);
    free(ctx->futhark_mc_segmap_nested_task_236289_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236289_runs);
    free(ctx->futhark_mc_segmap_nested_task_236289_iter);
    free(ctx->futhark_mc_segmap_parloop_236324_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236324_runs);
    free(ctx->futhark_mc_segmap_parloop_236324_iter);
    free(ctx->futhark_mc_segmap_task_236322_total_runtime);
    free(ctx->futhark_mc_segmap_task_236322_runs);
    free(ctx->futhark_mc_segmap_task_236322_iter);
    free(ctx->futhark_mc_segmap_parloop_236341_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236341_runs);
    free(ctx->futhark_mc_segmap_parloop_236341_iter);
    free(ctx->futhark_mc_segmap_task_236339_total_runtime);
    free(ctx->futhark_mc_segmap_task_236339_runs);
    free(ctx->futhark_mc_segmap_task_236339_iter);
    free(ctx->futhark_mc_segmap_parloop_236345_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236345_runs);
    free(ctx->futhark_mc_segmap_parloop_236345_iter);
    free(ctx->futhark_mc_segmap_task_236343_total_runtime);
    free(ctx->futhark_mc_segmap_task_236343_runs);
    free(ctx->futhark_mc_segmap_task_236343_iter);
    free(ctx->futhark_mc_segmap_parloop_236349_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236349_runs);
    free(ctx->futhark_mc_segmap_parloop_236349_iter);
    free(ctx->futhark_mc_segmap_task_236347_total_runtime);
    free(ctx->futhark_mc_segmap_task_236347_runs);
    free(ctx->futhark_mc_segmap_task_236347_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236359_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236359_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236359_iter);
    free(ctx->futhark_mc_segred_task_236354_total_runtime);
    free(ctx->futhark_mc_segred_task_236354_runs);
    free(ctx->futhark_mc_segred_task_236354_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236365_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236365_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236365_iter);
    free(ctx->futhark_mc_segred_task_236361_total_runtime);
    free(ctx->futhark_mc_segred_task_236361_runs);
    free(ctx->futhark_mc_segred_task_236361_iter);
    free(ctx->futhark_mc_segmap_parloop_236352_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236352_runs);
    free(ctx->futhark_mc_segmap_parloop_236352_iter);
    free(ctx->futhark_mc_segmap_nested_task_236350_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236350_runs);
    free(ctx->futhark_mc_segmap_nested_task_236350_iter);
    free(ctx->futhark_mc_segmap_parloop_236332_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236332_runs);
    free(ctx->futhark_mc_segmap_parloop_236332_iter);
    free(ctx->futhark_mc_segmap_nested_task_236330_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236330_runs);
    free(ctx->futhark_mc_segmap_nested_task_236330_iter);
    free(ctx->futhark_mc_segmap_parloop_236369_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236369_runs);
    free(ctx->futhark_mc_segmap_parloop_236369_iter);
    free(ctx->futhark_mc_segmap_task_236367_total_runtime);
    free(ctx->futhark_mc_segmap_task_236367_runs);
    free(ctx->futhark_mc_segmap_task_236367_iter);
    free(ctx->futhark_mc_segmap_parloop_236386_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236386_runs);
    free(ctx->futhark_mc_segmap_parloop_236386_iter);
    free(ctx->futhark_mc_segmap_task_236384_total_runtime);
    free(ctx->futhark_mc_segmap_task_236384_runs);
    free(ctx->futhark_mc_segmap_task_236384_iter);
    free(ctx->futhark_mc_segmap_parloop_236390_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236390_runs);
    free(ctx->futhark_mc_segmap_parloop_236390_iter);
    free(ctx->futhark_mc_segmap_task_236388_total_runtime);
    free(ctx->futhark_mc_segmap_task_236388_runs);
    free(ctx->futhark_mc_segmap_task_236388_iter);
    free(ctx->futhark_mc_segmap_parloop_236394_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236394_runs);
    free(ctx->futhark_mc_segmap_parloop_236394_iter);
    free(ctx->futhark_mc_segmap_task_236392_total_runtime);
    free(ctx->futhark_mc_segmap_task_236392_runs);
    free(ctx->futhark_mc_segmap_task_236392_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236406_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236406_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236406_iter);
    free(ctx->futhark_mc_segred_task_236399_total_runtime);
    free(ctx->futhark_mc_segred_task_236399_runs);
    free(ctx->futhark_mc_segred_task_236399_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236412_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236412_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236412_iter);
    free(ctx->futhark_mc_segred_task_236408_total_runtime);
    free(ctx->futhark_mc_segred_task_236408_runs);
    free(ctx->futhark_mc_segred_task_236408_iter);
    free(ctx->futhark_mc_segmap_parloop_236397_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236397_runs);
    free(ctx->futhark_mc_segmap_parloop_236397_iter);
    free(ctx->futhark_mc_segmap_nested_task_236395_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236395_runs);
    free(ctx->futhark_mc_segmap_nested_task_236395_iter);
    free(ctx->futhark_mc_segmap_parloop_236377_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236377_runs);
    free(ctx->futhark_mc_segmap_parloop_236377_iter);
    free(ctx->futhark_mc_segmap_nested_task_236375_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236375_runs);
    free(ctx->futhark_mc_segmap_nested_task_236375_iter);
    free(ctx->futhark_mc_segmap_parloop_236416_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236416_runs);
    free(ctx->futhark_mc_segmap_parloop_236416_iter);
    free(ctx->futhark_mc_segmap_task_236414_total_runtime);
    free(ctx->futhark_mc_segmap_task_236414_runs);
    free(ctx->futhark_mc_segmap_task_236414_iter);
    free(ctx->futhark_mc_segmap_parloop_236432_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236432_runs);
    free(ctx->futhark_mc_segmap_parloop_236432_iter);
    free(ctx->futhark_mc_segmap_task_236430_total_runtime);
    free(ctx->futhark_mc_segmap_task_236430_runs);
    free(ctx->futhark_mc_segmap_task_236430_iter);
    free(ctx->futhark_mc_segmap_parloop_236436_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236436_runs);
    free(ctx->futhark_mc_segmap_parloop_236436_iter);
    free(ctx->futhark_mc_segmap_task_236434_total_runtime);
    free(ctx->futhark_mc_segmap_task_236434_runs);
    free(ctx->futhark_mc_segmap_task_236434_iter);
    free(ctx->futhark_mc_segmap_parloop_236440_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236440_runs);
    free(ctx->futhark_mc_segmap_parloop_236440_iter);
    free(ctx->futhark_mc_segmap_task_236438_total_runtime);
    free(ctx->futhark_mc_segmap_task_236438_runs);
    free(ctx->futhark_mc_segmap_task_236438_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236450_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236450_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236450_iter);
    free(ctx->futhark_mc_segred_task_236447_total_runtime);
    free(ctx->futhark_mc_segred_task_236447_runs);
    free(ctx->futhark_mc_segred_task_236447_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236455_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236455_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236455_iter);
    free(ctx->futhark_mc_segred_task_236452_total_runtime);
    free(ctx->futhark_mc_segred_task_236452_runs);
    free(ctx->futhark_mc_segred_task_236452_iter);
    free(ctx->futhark_mc_segmap_parloop_236444_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236444_runs);
    free(ctx->futhark_mc_segmap_parloop_236444_iter);
    free(ctx->futhark_mc_segmap_nested_task_236442_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236442_runs);
    free(ctx->futhark_mc_segmap_nested_task_236442_iter);
    free(ctx->futhark_mc_segmap_parloop_236424_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236424_runs);
    free(ctx->futhark_mc_segmap_parloop_236424_iter);
    free(ctx->futhark_mc_segmap_nested_task_236422_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236422_runs);
    free(ctx->futhark_mc_segmap_nested_task_236422_iter);
    free(ctx->futhark_mc_segmap_parloop_236459_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236459_runs);
    free(ctx->futhark_mc_segmap_parloop_236459_iter);
    free(ctx->futhark_mc_segmap_task_236457_total_runtime);
    free(ctx->futhark_mc_segmap_task_236457_runs);
    free(ctx->futhark_mc_segmap_task_236457_iter);
    free(ctx->futhark_mc_segmap_parloop_236478_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236478_runs);
    free(ctx->futhark_mc_segmap_parloop_236478_iter);
    free(ctx->futhark_mc_segmap_task_236476_total_runtime);
    free(ctx->futhark_mc_segmap_task_236476_runs);
    free(ctx->futhark_mc_segmap_task_236476_iter);
    free(ctx->futhark_mc_segmap_parloop_236482_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236482_runs);
    free(ctx->futhark_mc_segmap_parloop_236482_iter);
    free(ctx->futhark_mc_segmap_task_236480_total_runtime);
    free(ctx->futhark_mc_segmap_task_236480_runs);
    free(ctx->futhark_mc_segmap_task_236480_iter);
    free(ctx->futhark_mc_segmap_parloop_236486_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236486_runs);
    free(ctx->futhark_mc_segmap_parloop_236486_iter);
    free(ctx->futhark_mc_segmap_task_236484_total_runtime);
    free(ctx->futhark_mc_segmap_task_236484_runs);
    free(ctx->futhark_mc_segmap_task_236484_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236500_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236500_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236500_iter);
    free(ctx->futhark_mc_segred_task_236495_total_runtime);
    free(ctx->futhark_mc_segred_task_236495_runs);
    free(ctx->futhark_mc_segred_task_236495_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236506_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236506_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236506_iter);
    free(ctx->futhark_mc_segred_task_236502_total_runtime);
    free(ctx->futhark_mc_segred_task_236502_runs);
    free(ctx->futhark_mc_segred_task_236502_iter);
    free(ctx->futhark_mc_segmap_parloop_236491_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236491_runs);
    free(ctx->futhark_mc_segmap_parloop_236491_iter);
    free(ctx->futhark_mc_segmap_nested_task_236489_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236489_runs);
    free(ctx->futhark_mc_segmap_nested_task_236489_iter);
    free(ctx->futhark_mc_segmap_parloop_236469_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236469_runs);
    free(ctx->futhark_mc_segmap_parloop_236469_iter);
    free(ctx->futhark_mc_segmap_nested_task_236467_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236467_runs);
    free(ctx->futhark_mc_segmap_nested_task_236467_iter);
    free(ctx->futhark_mc_segmap_parloop_236510_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236510_runs);
    free(ctx->futhark_mc_segmap_parloop_236510_iter);
    free(ctx->futhark_mc_segmap_task_236508_total_runtime);
    free(ctx->futhark_mc_segmap_task_236508_runs);
    free(ctx->futhark_mc_segmap_task_236508_iter);
    free(ctx->futhark_mc_segmap_parloop_236531_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236531_runs);
    free(ctx->futhark_mc_segmap_parloop_236531_iter);
    free(ctx->futhark_mc_segmap_task_236529_total_runtime);
    free(ctx->futhark_mc_segmap_task_236529_runs);
    free(ctx->futhark_mc_segmap_task_236529_iter);
    free(ctx->futhark_mc_segmap_parloop_236535_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236535_runs);
    free(ctx->futhark_mc_segmap_parloop_236535_iter);
    free(ctx->futhark_mc_segmap_task_236533_total_runtime);
    free(ctx->futhark_mc_segmap_task_236533_runs);
    free(ctx->futhark_mc_segmap_task_236533_iter);
    free(ctx->futhark_mc_segmap_parloop_236539_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236539_runs);
    free(ctx->futhark_mc_segmap_parloop_236539_iter);
    free(ctx->futhark_mc_segmap_task_236537_total_runtime);
    free(ctx->futhark_mc_segmap_task_236537_runs);
    free(ctx->futhark_mc_segmap_task_236537_iter);
    free(ctx->futhark_mc_segmap_parloop_236554_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236554_runs);
    free(ctx->futhark_mc_segmap_parloop_236554_iter);
    free(ctx->futhark_mc_segmap_task_236552_total_runtime);
    free(ctx->futhark_mc_segmap_task_236552_runs);
    free(ctx->futhark_mc_segmap_task_236552_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236563_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236563_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236563_iter);
    free(ctx->futhark_mc_segred_task_236556_total_runtime);
    free(ctx->futhark_mc_segred_task_236556_runs);
    free(ctx->futhark_mc_segred_task_236556_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236569_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236569_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236569_iter);
    free(ctx->futhark_mc_segred_task_236565_total_runtime);
    free(ctx->futhark_mc_segred_task_236565_runs);
    free(ctx->futhark_mc_segred_task_236565_iter);
    free(ctx->futhark_mc_segmap_parloop_236546_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236546_runs);
    free(ctx->futhark_mc_segmap_parloop_236546_iter);
    free(ctx->futhark_mc_segmap_nested_task_236544_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236544_runs);
    free(ctx->futhark_mc_segmap_nested_task_236544_iter);
    free(ctx->futhark_mc_segmap_parloop_236522_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236522_runs);
    free(ctx->futhark_mc_segmap_parloop_236522_iter);
    free(ctx->futhark_mc_segmap_nested_task_236520_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236520_runs);
    free(ctx->futhark_mc_segmap_nested_task_236520_iter);
    free(ctx->futhark_mc_segmap_parloop_236573_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236573_runs);
    free(ctx->futhark_mc_segmap_parloop_236573_iter);
    free(ctx->futhark_mc_segmap_task_236571_total_runtime);
    free(ctx->futhark_mc_segmap_task_236571_runs);
    free(ctx->futhark_mc_segmap_task_236571_iter);
    free(ctx->futhark_mc_segmap_parloop_236582_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236582_runs);
    free(ctx->futhark_mc_segmap_parloop_236582_iter);
    free(ctx->futhark_mc_segmap_task_236580_total_runtime);
    free(ctx->futhark_mc_segmap_task_236580_runs);
    free(ctx->futhark_mc_segmap_task_236580_iter);
    free(ctx->futhark_mc_segmap_parloop_236577_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236577_runs);
    free(ctx->futhark_mc_segmap_parloop_236577_iter);
    free(ctx->futhark_mc_segmap_nested_task_236575_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236575_runs);
    free(ctx->futhark_mc_segmap_nested_task_236575_iter);
    free(ctx->futhark_mc_segmap_parloop_236586_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236586_runs);
    free(ctx->futhark_mc_segmap_parloop_236586_iter);
    free(ctx->futhark_mc_segmap_task_236584_total_runtime);
    free(ctx->futhark_mc_segmap_task_236584_runs);
    free(ctx->futhark_mc_segmap_task_236584_iter);
    free(ctx->futhark_mc_segmap_parloop_236597_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236597_runs);
    free(ctx->futhark_mc_segmap_parloop_236597_iter);
    free(ctx->futhark_mc_segmap_task_236595_total_runtime);
    free(ctx->futhark_mc_segmap_task_236595_runs);
    free(ctx->futhark_mc_segmap_task_236595_iter);
    free(ctx->futhark_mc_segmap_parloop_236601_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236601_runs);
    free(ctx->futhark_mc_segmap_parloop_236601_iter);
    free(ctx->futhark_mc_segmap_task_236599_total_runtime);
    free(ctx->futhark_mc_segmap_task_236599_runs);
    free(ctx->futhark_mc_segmap_task_236599_iter);
    free(ctx->futhark_mc_segmap_parloop_236591_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236591_runs);
    free(ctx->futhark_mc_segmap_parloop_236591_iter);
    free(ctx->futhark_mc_segmap_nested_task_236589_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236589_runs);
    free(ctx->futhark_mc_segmap_nested_task_236589_iter);
    free(ctx->futhark_mc_segmap_parloop_236605_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236605_runs);
    free(ctx->futhark_mc_segmap_parloop_236605_iter);
    free(ctx->futhark_mc_segmap_task_236603_total_runtime);
    free(ctx->futhark_mc_segmap_task_236603_runs);
    free(ctx->futhark_mc_segmap_task_236603_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_236626_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_236626_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_236626_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_236628_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_236628_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_236628_iter);
    free(ctx->futhark_mc_segscan_task_236620_total_runtime);
    free(ctx->futhark_mc_segscan_task_236620_runs);
    free(ctx->futhark_mc_segscan_task_236620_iter);
    free(ctx->futhark_mc_segmap_parloop_236632_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236632_runs);
    free(ctx->futhark_mc_segmap_parloop_236632_iter);
    free(ctx->futhark_mc_segmap_task_236630_total_runtime);
    free(ctx->futhark_mc_segmap_task_236630_runs);
    free(ctx->futhark_mc_segmap_task_236630_iter);
    free(ctx->futhark_mc_segmap_parloop_236613_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236613_runs);
    free(ctx->futhark_mc_segmap_parloop_236613_iter);
    free(ctx->futhark_mc_segmap_nested_task_236611_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236611_runs);
    free(ctx->futhark_mc_segmap_nested_task_236611_iter);
    free(ctx->futhark_mc_segmap_parloop_236636_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236636_runs);
    free(ctx->futhark_mc_segmap_parloop_236636_iter);
    free(ctx->futhark_mc_segmap_task_236634_total_runtime);
    free(ctx->futhark_mc_segmap_task_236634_runs);
    free(ctx->futhark_mc_segmap_task_236634_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236644_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236644_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236644_iter);
    free(ctx->futhark_mc_segred_task_236641_total_runtime);
    free(ctx->futhark_mc_segred_task_236641_runs);
    free(ctx->futhark_mc_segred_task_236641_iter);
    free(ctx->futhark_mc_segmap_parloop_236639_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236639_runs);
    free(ctx->futhark_mc_segmap_parloop_236639_iter);
    free(ctx->futhark_mc_segmap_nested_task_236637_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236637_runs);
    free(ctx->futhark_mc_segmap_nested_task_236637_iter);
    free(ctx->futhark_mc_segmap_parloop_236648_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236648_runs);
    free(ctx->futhark_mc_segmap_parloop_236648_iter);
    free(ctx->futhark_mc_segmap_task_236646_total_runtime);
    free(ctx->futhark_mc_segmap_task_236646_runs);
    free(ctx->futhark_mc_segmap_task_236646_iter);
    free(ctx->futhark_mc_segmap_parloop_236657_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236657_runs);
    free(ctx->futhark_mc_segmap_parloop_236657_iter);
    free(ctx->futhark_mc_segmap_task_236655_total_runtime);
    free(ctx->futhark_mc_segmap_task_236655_runs);
    free(ctx->futhark_mc_segmap_task_236655_iter);
    free(ctx->futhark_mc_segmap_parloop_236652_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236652_runs);
    free(ctx->futhark_mc_segmap_parloop_236652_iter);
    free(ctx->futhark_mc_segmap_nested_task_236650_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236650_runs);
    free(ctx->futhark_mc_segmap_nested_task_236650_iter);
    free(ctx->futhark_mc_segmap_parloop_236666_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236666_runs);
    free(ctx->futhark_mc_segmap_parloop_236666_iter);
    free(ctx->futhark_mc_segmap_task_236664_total_runtime);
    free(ctx->futhark_mc_segmap_task_236664_runs);
    free(ctx->futhark_mc_segmap_task_236664_iter);
    free(ctx->futhark_mc_segmap_parloop_236661_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236661_runs);
    free(ctx->futhark_mc_segmap_parloop_236661_iter);
    free(ctx->futhark_mc_segmap_task_236659_total_runtime);
    free(ctx->futhark_mc_segmap_task_236659_runs);
    free(ctx->futhark_mc_segmap_task_236659_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_segred_stage_1_parloop_235420 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_235420_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235420_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235420_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235420_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235420_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235420_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235420_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235420_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235420_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235420_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235420_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235420_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235420_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_235420_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235420_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235420_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235420_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235420_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235420_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235420_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235420_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235420_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235420_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235420_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235420_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235420_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235420_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235429 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_235429_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235429_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235429_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235429_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235429_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235429_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235429_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235429_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235429_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235429_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235429_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235429_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235429_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_235429_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235429_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235429_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235429_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235429_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235429_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235429_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235429_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235429_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235429_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235429_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235429_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235429_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235429_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235426            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235426_runs[i],
                    (long) ctx->futhark_mc_segred_task_235426_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235426_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235426_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235426_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235426_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235426_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235426_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235426_iter[i],
                    (long) ctx->futhark_mc_segred_task_235426_iter[i] /
                    (ctx->futhark_mc_segred_task_235426_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235426_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235424 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_235424_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235424_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235424_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235424_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235424_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235424_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235424_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235424_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235424_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235424_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235424_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235424_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235424_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_235424_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235424_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235424_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235424_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235424_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235424_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235424_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235424_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235424_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235424_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235424_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235424_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235424_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235424_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235417            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235417_runs[i],
                    (long) ctx->futhark_mc_segred_task_235417_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235417_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235417_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235417_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235417_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235417_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235417_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235417_iter[i],
                    (long) ctx->futhark_mc_segred_task_235417_iter[i] /
                    (ctx->futhark_mc_segred_task_235417_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235417_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_nested_task_235421     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_nested_task_235421_runs[i],
                    (long) ctx->futhark_mc_segred_nested_task_235421_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235421_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235421_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_nested_task_235421_total_runtime[i],
                    (double) ctx->futhark_mc_segred_nested_task_235421_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235421_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_nested_task_235421_iter[i]),
                    (long) ctx->futhark_mc_segred_nested_task_235421_iter[i],
                    (long) ctx->futhark_mc_segred_nested_task_235421_iter[i] /
                    (ctx->futhark_mc_segred_nested_task_235421_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235421_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_235415   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_235415_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235415_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235415_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235415_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235415_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_235415_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235415_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235415_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235415_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235415_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235415_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235415_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_235415_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_235415_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235415_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235415_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235415_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235415_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_235415_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235415_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235415_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235415_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235415_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_235415_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235415_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_235415_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_235415_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235434 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_235434_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235434_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235434_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235434_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235434_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235434_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235434_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235434_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235434_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235434_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235434_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235434_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235434_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_235434_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235434_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235434_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235434_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235434_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235434_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235434_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235434_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235434_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235434_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235434_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235434_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235434_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235434_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235443 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_235443_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235443_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235443_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235443_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235443_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235443_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235443_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235443_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235443_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235443_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235443_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235443_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235443_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_235443_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235443_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235443_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235443_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235443_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235443_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235443_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235443_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235443_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235443_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235443_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235443_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235443_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235443_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235440            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235440_runs[i],
                    (long) ctx->futhark_mc_segred_task_235440_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235440_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235440_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235440_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235440_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235440_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235440_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235440_iter[i],
                    (long) ctx->futhark_mc_segred_task_235440_iter[i] /
                    (ctx->futhark_mc_segred_task_235440_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235440_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235438 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_235438_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235438_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235438_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235438_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235438_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235438_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235438_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235438_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235438_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235438_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235438_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235438_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235438_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_235438_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235438_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235438_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235438_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235438_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235438_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235438_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235438_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235438_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235438_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235438_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235438_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235438_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235438_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235431            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235431_runs[i],
                    (long) ctx->futhark_mc_segred_task_235431_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235431_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235431_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235431_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235431_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235431_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235431_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235431_iter[i],
                    (long) ctx->futhark_mc_segred_task_235431_iter[i] /
                    (ctx->futhark_mc_segred_task_235431_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235431_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_nested_task_235435     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_nested_task_235435_runs[i],
                    (long) ctx->futhark_mc_segred_nested_task_235435_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235435_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235435_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_nested_task_235435_total_runtime[i],
                    (double) ctx->futhark_mc_segred_nested_task_235435_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235435_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_nested_task_235435_iter[i]),
                    (long) ctx->futhark_mc_segred_nested_task_235435_iter[i],
                    (long) ctx->futhark_mc_segred_nested_task_235435_iter[i] /
                    (ctx->futhark_mc_segred_nested_task_235435_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235435_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235450 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_235450_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235450_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235450_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235450_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235450_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235450_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235450_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235450_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235450_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235450_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235450_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235450_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235450_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_235450_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235450_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235450_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235450_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235450_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235450_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235450_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235450_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235450_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235450_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235450_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235450_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235450_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235450_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235459 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_235459_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235459_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235459_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235459_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235459_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235459_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235459_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235459_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235459_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235459_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235459_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235459_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235459_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_235459_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235459_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235459_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235459_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235459_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235459_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235459_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235459_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235459_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235459_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235459_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235459_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235459_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235459_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235456            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235456_runs[i],
                    (long) ctx->futhark_mc_segred_task_235456_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235456_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235456_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235456_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235456_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235456_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235456_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235456_iter[i],
                    (long) ctx->futhark_mc_segred_task_235456_iter[i] /
                    (ctx->futhark_mc_segred_task_235456_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235456_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235454 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_235454_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235454_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235454_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235454_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235454_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235454_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235454_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235454_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235454_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235454_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235454_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235454_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235454_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_235454_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235454_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235454_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235454_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235454_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235454_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235454_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235454_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235454_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235454_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235454_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235454_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235454_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235454_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235447            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235447_runs[i],
                    (long) ctx->futhark_mc_segred_task_235447_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235447_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235447_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235447_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235447_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235447_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235447_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235447_iter[i],
                    (long) ctx->futhark_mc_segred_task_235447_iter[i] /
                    (ctx->futhark_mc_segred_task_235447_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235447_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_nested_task_235451     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_nested_task_235451_runs[i],
                    (long) ctx->futhark_mc_segred_nested_task_235451_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235451_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235451_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_nested_task_235451_total_runtime[i],
                    (double) ctx->futhark_mc_segred_nested_task_235451_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235451_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_nested_task_235451_iter[i]),
                    (long) ctx->futhark_mc_segred_nested_task_235451_iter[i],
                    (long) ctx->futhark_mc_segred_nested_task_235451_iter[i] /
                    (ctx->futhark_mc_segred_nested_task_235451_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235451_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_235445   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_235445_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235445_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235445_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235445_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235445_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_235445_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235445_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235445_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235445_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235445_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235445_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235445_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_235445_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_235445_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235445_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235445_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235445_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235445_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_235445_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235445_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235445_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235445_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235445_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_235445_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235445_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_235445_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_235445_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_235412           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_235412_runs[i],
                    (long) ctx->futhark_mc_segscan_task_235412_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235412_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235412_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_235412_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_235412_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235412_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_235412_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_235412_iter[i],
                    (long) ctx->futhark_mc_segscan_task_235412_iter[i] /
                    (ctx->futhark_mc_segscan_task_235412_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235412_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235463         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235463_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235463_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235463_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235463_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235463_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235463_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235463_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235463_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235463_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235463_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235463_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235463_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235463_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235463_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235463_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235463_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235463_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235463_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235463_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235463_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235463_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235463_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235463_total_iter /
                (ctx->futhark_mc_segmap_parloop_235463_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235463_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235463_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235463_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235461            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235461_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235461_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235461_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235461_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235461_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235461_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235461_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235461_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235461_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235461_iter[i] /
                    (ctx->futhark_mc_segmap_task_235461_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235461_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235467         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235467_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235467_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235467_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235467_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235467_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235467_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235467_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235467_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235467_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235467_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235467_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235467_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235467_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235467_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235467_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235467_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235467_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235467_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235467_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235467_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235467_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235467_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235467_total_iter /
                (ctx->futhark_mc_segmap_parloop_235467_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235467_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235467_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235467_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_235479   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_235479_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235479_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235479_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235479_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235479_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_235479_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235479_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235479_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235479_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235479_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235479_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235479_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_235479_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_235479_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235479_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235479_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235479_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235479_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_235479_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235479_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235479_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235479_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235479_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_235479_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235479_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_235479_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_235479_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_235481   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_235481_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235481_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235481_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235481_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235481_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_235481_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235481_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235481_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235481_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235481_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235481_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235481_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_235481_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_235481_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235481_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235481_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235481_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235481_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_235481_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235481_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235481_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235481_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235481_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_235481_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235481_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_235481_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_235481_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_235476           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_235476_runs[i],
                    (long) ctx->futhark_mc_segscan_task_235476_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235476_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235476_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_235476_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_235476_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235476_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_235476_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_235476_iter[i],
                    (long) ctx->futhark_mc_segscan_task_235476_iter[i] /
                    (ctx->futhark_mc_segscan_task_235476_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235476_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235485         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235485_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235485_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235485_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235485_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235485_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235485_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235485_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235485_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235485_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235485_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235485_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235485_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235485_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235485_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235485_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235485_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235485_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235485_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235485_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235485_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235485_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235485_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235485_total_iter /
                (ctx->futhark_mc_segmap_parloop_235485_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235485_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235485_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235485_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235483            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235483_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235483_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235483_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235483_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235483_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235483_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235483_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235483_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235483_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235483_iter[i] /
                    (ctx->futhark_mc_segmap_task_235483_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235483_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235472         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235472_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235472_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235472_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235472_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235472_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235472_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235472_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235472_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235472_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235472_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235472_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235472_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235472_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235472_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235472_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235472_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235472_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235472_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235472_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235472_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235472_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235472_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235472_total_iter /
                (ctx->futhark_mc_segmap_parloop_235472_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235472_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235472_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235472_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235465            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235465_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235465_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235465_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235465_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235465_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235465_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235465_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235465_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235465_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235465_iter[i] /
                    (ctx->futhark_mc_segmap_task_235465_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235465_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235470     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235470_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235470_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235470_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235470_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235470_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235470_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235470_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235470_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235470_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235470_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235470_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235470_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235489         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235489_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235489_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235489_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235489_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235489_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235489_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235489_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235489_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235489_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235489_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235489_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235489_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235489_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235489_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235489_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235489_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235489_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235489_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235489_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235489_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235489_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235489_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235489_total_iter /
                (ctx->futhark_mc_segmap_parloop_235489_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235489_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235489_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235489_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235498         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235498_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235498_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235498_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235498_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235498_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235498_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235498_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235498_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235498_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235498_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235498_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235498_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235498_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235498_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235498_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235498_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235498_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235498_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235498_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235498_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235498_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235498_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235498_total_iter /
                (ctx->futhark_mc_segmap_parloop_235498_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235498_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235498_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235498_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235507         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235507_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235507_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235507_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235507_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235507_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235507_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235507_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235507_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235507_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235507_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235507_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235507_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235507_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235507_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235507_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235507_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235507_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235507_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235507_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235507_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235507_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235507_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235507_total_iter /
                (ctx->futhark_mc_segmap_parloop_235507_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235507_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235507_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235507_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235505            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235505_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235505_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235505_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235505_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235505_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235505_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235505_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235505_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235505_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235505_iter[i] /
                    (ctx->futhark_mc_segmap_task_235505_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235505_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235502         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235502_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235502_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235502_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235502_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235502_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235502_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235502_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235502_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235502_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235502_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235502_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235502_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235502_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235502_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235502_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235502_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235502_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235502_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235502_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235502_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235502_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235502_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235502_total_iter /
                (ctx->futhark_mc_segmap_parloop_235502_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235502_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235502_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235502_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235496            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235496_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235496_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235496_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235496_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235496_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235496_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235496_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235496_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235496_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235496_iter[i] /
                    (ctx->futhark_mc_segmap_task_235496_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235496_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235500     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235500_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235500_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235500_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235500_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235500_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235500_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235500_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235500_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235500_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235500_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235500_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235500_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235493         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235493_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235493_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235493_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235493_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235493_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235493_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235493_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235493_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235493_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235493_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235493_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235493_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235493_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235493_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235493_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235493_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235493_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235493_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235493_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235493_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235493_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235493_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235493_total_iter /
                (ctx->futhark_mc_segmap_parloop_235493_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235493_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235493_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235493_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235487            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235487_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235487_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235487_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235487_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235487_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235487_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235487_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235487_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235487_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235487_iter[i] /
                    (ctx->futhark_mc_segmap_task_235487_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235487_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235491     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235491_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235491_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235491_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235491_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235491_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235491_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235491_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235491_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235491_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235491_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235491_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235491_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235511         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235511_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235511_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235511_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235511_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235511_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235511_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235511_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235511_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235511_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235511_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235511_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235511_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235511_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235511_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235511_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235511_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235511_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235511_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235511_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235511_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235511_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235511_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235511_total_iter /
                (ctx->futhark_mc_segmap_parloop_235511_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235511_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235511_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235511_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235524         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235524_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235524_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235524_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235524_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235524_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235524_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235524_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235524_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235524_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235524_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235524_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235524_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235524_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235524_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235524_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235524_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235524_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235524_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235524_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235524_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235524_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235524_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235524_total_iter /
                (ctx->futhark_mc_segmap_parloop_235524_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235524_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235524_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235524_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_235536   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_235536_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235536_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235536_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235536_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235536_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_235536_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235536_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235536_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235536_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235536_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235536_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235536_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_235536_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_235536_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235536_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235536_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235536_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235536_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_235536_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235536_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235536_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235536_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235536_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_235536_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235536_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_235536_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_235536_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_235538   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_235538_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235538_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235538_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235538_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235538_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_235538_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235538_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235538_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235538_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235538_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235538_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235538_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_235538_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_235538_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235538_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235538_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235538_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235538_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_235538_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235538_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235538_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235538_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235538_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_235538_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235538_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_235538_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_235538_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_235533           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_235533_runs[i],
                    (long) ctx->futhark_mc_segscan_task_235533_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235533_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235533_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_235533_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_235533_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235533_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_235533_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_235533_iter[i],
                    (long) ctx->futhark_mc_segscan_task_235533_iter[i] /
                    (ctx->futhark_mc_segscan_task_235533_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235533_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235542         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235542_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235542_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235542_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235542_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235542_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235542_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235542_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235542_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235542_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235542_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235542_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235542_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235542_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235542_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235542_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235542_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235542_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235542_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235542_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235542_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235542_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235542_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235542_total_iter /
                (ctx->futhark_mc_segmap_parloop_235542_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235542_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235542_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235542_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235540            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235540_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235540_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235540_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235540_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235540_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235540_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235540_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235540_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235540_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235540_iter[i] /
                    (ctx->futhark_mc_segmap_task_235540_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235540_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235529         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235529_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235529_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235529_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235529_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235529_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235529_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235529_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235529_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235529_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235529_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235529_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235529_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235529_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235529_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235529_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235529_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235529_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235529_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235529_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235529_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235529_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235529_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235529_total_iter /
                (ctx->futhark_mc_segmap_parloop_235529_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235529_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235529_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235529_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235522            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235522_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235522_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235522_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235522_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235522_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235522_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235522_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235522_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235522_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235522_iter[i] /
                    (ctx->futhark_mc_segmap_task_235522_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235522_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235527     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235527_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235527_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235527_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235527_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235527_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235527_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235527_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235527_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235527_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235527_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235527_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235527_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235518         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235518_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235518_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235518_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235518_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235518_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235518_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235518_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235518_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235518_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235518_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235518_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235518_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235518_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235518_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235518_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235518_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235518_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235518_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235518_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235518_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235518_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235518_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235518_total_iter /
                (ctx->futhark_mc_segmap_parloop_235518_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235518_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235518_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235518_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235509            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235509_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235509_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235509_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235509_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235509_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235509_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235509_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235509_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235509_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235509_iter[i] /
                    (ctx->futhark_mc_segmap_task_235509_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235509_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235516     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235516_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235516_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235516_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235516_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235516_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235516_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235516_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235516_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235516_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235516_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235516_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235516_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235546         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235546_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235546_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235546_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235546_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235546_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235546_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235546_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235546_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235546_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235546_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235546_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235546_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235546_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235546_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235546_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235546_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235546_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235546_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235546_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235546_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235546_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235546_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235546_total_iter /
                (ctx->futhark_mc_segmap_parloop_235546_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235546_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235546_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235546_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235558         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235558_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235558_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235558_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235558_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235558_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235558_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235558_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235558_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235558_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235558_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235558_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235558_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235558_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235558_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235558_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235558_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235558_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235558_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235558_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235558_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235558_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235558_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235558_total_iter /
                (ctx->futhark_mc_segmap_parloop_235558_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235558_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235558_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235558_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235571         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235571_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235571_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235571_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235571_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235571_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235571_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235571_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235571_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235571_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235571_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235571_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235571_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235571_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235571_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235571_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235571_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235571_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235571_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235571_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235571_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235571_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235571_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235571_total_iter /
                (ctx->futhark_mc_segmap_parloop_235571_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235571_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235571_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235571_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235569            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235569_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235569_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235569_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235569_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235569_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235569_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235569_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235569_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235569_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235569_iter[i] /
                    (ctx->futhark_mc_segmap_task_235569_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235569_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235575         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235575_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235575_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235575_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235575_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235575_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235575_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235575_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235575_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235575_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235575_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235575_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235575_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235575_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235575_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235575_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235575_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235575_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235575_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235575_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235575_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235575_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235575_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235575_total_iter /
                (ctx->futhark_mc_segmap_parloop_235575_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235575_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235575_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235575_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235573            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235573_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235573_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235573_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235573_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235573_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235573_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235573_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235573_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235573_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235573_iter[i] /
                    (ctx->futhark_mc_segmap_task_235573_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235573_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235564         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235564_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235564_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235564_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235564_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235564_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235564_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235564_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235564_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235564_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235564_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235564_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235564_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235564_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235564_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235564_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235564_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235564_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235564_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235564_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235564_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235564_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235564_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235564_total_iter /
                (ctx->futhark_mc_segmap_parloop_235564_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235564_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235564_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235564_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235556            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235556_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235556_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235556_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235556_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235556_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235556_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235556_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235556_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235556_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235556_iter[i] /
                    (ctx->futhark_mc_segmap_task_235556_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235556_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235562     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235562_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235562_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235562_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235562_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235562_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235562_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235562_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235562_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235562_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235562_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235562_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235562_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235552         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235552_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235552_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235552_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235552_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235552_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235552_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235552_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235552_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235552_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235552_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235552_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235552_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235552_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235552_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235552_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235552_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235552_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235552_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235552_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235552_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235552_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235552_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235552_total_iter /
                (ctx->futhark_mc_segmap_parloop_235552_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235552_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235552_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235552_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235544            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235544_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235544_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235544_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235544_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235544_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235544_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235544_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235544_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235544_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235544_iter[i] /
                    (ctx->futhark_mc_segmap_task_235544_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235544_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235550     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235550_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235550_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235550_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235550_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235550_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235550_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235550_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235550_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235550_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235550_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235550_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235550_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235579         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235579_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235579_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235579_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235579_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235579_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235579_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235579_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235579_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235579_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235579_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235579_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235579_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235579_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235579_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235579_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235579_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235579_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235579_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235579_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235579_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235579_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235579_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235579_total_iter /
                (ctx->futhark_mc_segmap_parloop_235579_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235579_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235579_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235579_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235592         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235592_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235592_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235592_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235592_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235592_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235592_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235592_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235592_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235592_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235592_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235592_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235592_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235592_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235592_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235592_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235592_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235592_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235592_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235592_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235592_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235592_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235592_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235592_total_iter /
                (ctx->futhark_mc_segmap_parloop_235592_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235592_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235592_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235592_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235590            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235590_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235590_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235590_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235590_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235590_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235590_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235590_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235590_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235590_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235590_iter[i] /
                    (ctx->futhark_mc_segmap_task_235590_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235590_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235596         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235596_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235596_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235596_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235596_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235596_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235596_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235596_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235596_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235596_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235596_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235596_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235596_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235596_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235596_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235596_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235596_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235596_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235596_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235596_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235596_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235596_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235596_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235596_total_iter /
                (ctx->futhark_mc_segmap_parloop_235596_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235596_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235596_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235596_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235594            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235594_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235594_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235594_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235594_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235594_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235594_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235594_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235594_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235594_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235594_iter[i] /
                    (ctx->futhark_mc_segmap_task_235594_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235594_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235585         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235585_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235585_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235585_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235585_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235585_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235585_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235585_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235585_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235585_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235585_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235585_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235585_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235585_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235585_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235585_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235585_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235585_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235585_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235585_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235585_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235585_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235585_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235585_total_iter /
                (ctx->futhark_mc_segmap_parloop_235585_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235585_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235585_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235585_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235577            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235577_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235577_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235577_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235577_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235577_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235577_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235577_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235577_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235577_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235577_iter[i] /
                    (ctx->futhark_mc_segmap_task_235577_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235577_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235583     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235583_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235583_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235583_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235583_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235583_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235583_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235583_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235583_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235583_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235583_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235583_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235583_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235600         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235600_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235600_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235600_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235600_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235600_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235600_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235600_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235600_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235600_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235600_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235600_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235600_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235600_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235600_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235600_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235600_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235600_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235600_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235600_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235600_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235600_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235600_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235600_total_iter /
                (ctx->futhark_mc_segmap_parloop_235600_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235600_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235600_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235600_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235613         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235613_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235613_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235613_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235613_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235613_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235613_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235613_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235613_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235613_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235613_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235613_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235613_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235613_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235613_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235613_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235613_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235613_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235613_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235613_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235613_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235613_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235613_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235613_total_iter /
                (ctx->futhark_mc_segmap_parloop_235613_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235613_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235613_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235613_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235611            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235611_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235611_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235611_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235611_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235611_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235611_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235611_iter[i] /
                    (ctx->futhark_mc_segmap_task_235611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235611_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235617         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235617_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235617_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235617_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235617_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235617_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235617_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235617_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235617_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235617_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235617_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235617_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235617_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235617_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235617_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235617_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235617_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235617_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235617_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235617_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235617_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235617_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235617_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235617_total_iter /
                (ctx->futhark_mc_segmap_parloop_235617_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235617_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235617_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235617_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235615            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235615_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235615_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235615_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235615_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235615_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235615_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235615_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235615_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235615_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235615_iter[i] /
                    (ctx->futhark_mc_segmap_task_235615_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235615_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235606         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235606_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235606_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235606_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235606_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235606_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235606_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235606_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235606_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235606_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235606_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235606_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235606_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235606_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235606_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235606_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235606_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235606_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235606_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235606_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235606_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235606_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235606_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235606_total_iter /
                (ctx->futhark_mc_segmap_parloop_235606_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235606_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235606_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235606_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235598            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235598_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235598_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235598_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235598_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235598_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235598_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235598_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235598_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235598_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235598_iter[i] /
                    (ctx->futhark_mc_segmap_task_235598_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235598_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235604     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235604_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235604_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235604_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235604_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235604_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235604_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235604_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235604_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235604_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235604_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235604_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235604_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235621         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235621_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235621_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235621_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235621_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235621_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235621_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235621_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235621_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235621_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235621_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235621_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235621_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235621_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235621_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235621_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235621_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235621_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235621_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235621_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235621_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235621_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235621_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235621_total_iter /
                (ctx->futhark_mc_segmap_parloop_235621_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235621_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235621_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235621_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235630         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235630_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235630_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235630_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235630_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235630_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235630_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235630_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235630_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235630_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235630_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235630_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235630_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235630_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235630_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235630_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235630_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235630_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235630_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235630_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235630_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235630_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235630_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235630_total_iter /
                (ctx->futhark_mc_segmap_parloop_235630_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235630_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235630_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235630_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235628            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235628_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235628_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235628_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235628_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235628_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235628_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235628_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235628_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235628_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235628_iter[i] /
                    (ctx->futhark_mc_segmap_task_235628_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235628_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235625         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235625_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235625_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235625_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235625_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235625_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235625_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235625_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235625_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235625_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235625_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235625_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235625_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235625_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235625_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235625_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235625_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235625_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235625_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235625_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235625_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235625_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235625_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235625_total_iter /
                (ctx->futhark_mc_segmap_parloop_235625_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235625_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235625_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235625_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235619            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235619_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235619_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235619_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235619_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235619_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235619_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235619_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235619_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235619_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235619_iter[i] /
                    (ctx->futhark_mc_segmap_task_235619_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235619_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235623     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235623_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235623_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235623_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235623_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235623_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235623_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235623_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235623_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235623_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235623_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235623_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235623_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235634         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235634_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235634_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235634_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235634_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235634_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235634_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235634_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235634_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235634_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235634_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235634_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235634_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235634_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235634_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235634_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235634_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235634_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235634_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235634_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235634_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235634_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235634_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235634_total_iter /
                (ctx->futhark_mc_segmap_parloop_235634_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235634_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235634_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235634_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235645         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235645_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235645_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235645_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235645_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235645_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235645_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235645_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235645_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235645_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235645_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235645_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235645_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235645_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235645_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235645_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235645_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235645_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235645_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235645_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235645_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235645_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235645_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235645_total_iter /
                (ctx->futhark_mc_segmap_parloop_235645_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235645_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235645_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235645_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235656         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235656_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235656_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235656_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235656_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235656_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235656_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235656_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235656_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235656_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235656_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235656_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235656_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235656_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235656_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235656_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235656_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235656_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235656_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235656_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235656_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235656_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235656_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235656_total_iter /
                (ctx->futhark_mc_segmap_parloop_235656_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235656_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235656_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235656_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235654            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235654_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235654_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235654_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235654_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235654_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235654_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235654_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235654_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235654_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235654_iter[i] /
                    (ctx->futhark_mc_segmap_task_235654_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235654_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235650         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235650_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235650_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235650_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235650_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235650_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235650_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235650_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235650_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235650_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235650_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235650_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235650_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235650_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235650_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235650_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235650_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235650_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235650_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235650_total_iter /
                (ctx->futhark_mc_segmap_parloop_235650_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235650_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235650_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235650_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235643            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235643_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235643_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235643_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235643_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235643_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235643_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235643_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235643_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235643_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235643_iter[i] /
                    (ctx->futhark_mc_segmap_task_235643_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235643_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235648     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235648_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235648_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235648_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235648_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235648_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235648_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235648_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235648_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235639         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235639_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235639_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235639_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235639_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235639_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235639_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235639_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235639_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235639_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235639_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235639_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235639_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235639_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235639_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235639_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235639_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235639_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235639_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235639_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235639_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235639_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235639_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235639_total_iter /
                (ctx->futhark_mc_segmap_parloop_235639_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235639_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235639_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235639_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235632            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235632_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235632_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235632_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235632_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235632_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235632_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235632_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235632_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235632_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235632_iter[i] /
                    (ctx->futhark_mc_segmap_task_235632_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235632_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235637     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235637_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235637_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235637_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235637_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235637_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235637_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235637_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235637_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235637_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235637_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235637_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235637_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235660         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235660_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235660_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235660_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235660_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235660_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235660_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235660_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235660_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235660_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235660_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235660_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235660_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235660_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235660_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235660_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235660_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235660_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235660_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235660_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235660_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235660_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235660_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235660_total_iter /
                (ctx->futhark_mc_segmap_parloop_235660_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235660_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235660_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235660_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235669         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235669_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235669_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235669_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235669_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235669_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235669_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235669_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235669_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235669_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235669_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235669_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235669_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235669_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235669_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235669_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235669_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235669_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235669_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235669_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235669_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235669_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235669_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235669_total_iter /
                (ctx->futhark_mc_segmap_parloop_235669_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235669_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235669_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235669_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235678         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235678_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235678_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235678_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235678_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235678_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235678_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235678_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235678_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235678_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235678_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235678_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235678_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235678_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235678_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235678_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235678_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235678_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235678_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235678_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235678_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235678_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235678_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235678_total_iter /
                (ctx->futhark_mc_segmap_parloop_235678_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235678_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235678_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235678_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235686 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_235686_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235686_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235686_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235686_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235686_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235686_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235686_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235686_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235686_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235686_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235686_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235686_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235686_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_235686_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235686_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235686_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235686_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235686_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235686_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235686_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235686_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235686_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235686_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235686_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235686_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235686_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235686_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235683            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235683_runs[i],
                    (long) ctx->futhark_mc_segred_task_235683_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235683_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235683_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235683_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235683_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235683_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235683_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235683_iter[i],
                    (long) ctx->futhark_mc_segred_task_235683_iter[i] /
                    (ctx->futhark_mc_segred_task_235683_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235683_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235691 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_235691_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235691_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235691_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235691_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235691_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235691_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235691_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235691_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235691_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235691_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235691_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235691_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235691_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_235691_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235691_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235691_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235691_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235691_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235691_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235691_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235691_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235691_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235691_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235691_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235691_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235691_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235691_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235688            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235688_runs[i],
                    (long) ctx->futhark_mc_segred_task_235688_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235688_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235688_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235688_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235688_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235688_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235688_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235688_iter[i],
                    (long) ctx->futhark_mc_segred_task_235688_iter[i] /
                    (ctx->futhark_mc_segred_task_235688_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235688_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235681         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235681_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235681_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235681_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235681_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235681_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235681_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235681_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235681_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235681_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235681_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235681_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235681_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235681_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235681_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235681_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235681_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235681_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235681_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235681_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235681_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235681_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235681_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235681_total_iter /
                (ctx->futhark_mc_segmap_parloop_235681_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235681_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235681_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235681_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235676            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235676_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235676_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235676_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235676_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235676_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235676_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235676_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235676_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235676_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235676_iter[i] /
                    (ctx->futhark_mc_segmap_task_235676_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235676_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235679     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235679_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235679_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235679_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235679_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235679_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235679_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235679_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235679_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235679_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235679_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235679_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235679_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235673         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235673_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235673_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235673_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235673_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235673_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235673_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235673_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235673_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235673_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235673_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235673_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235673_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235673_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235673_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235673_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235673_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235673_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235673_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235673_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235673_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235673_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235673_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235673_total_iter /
                (ctx->futhark_mc_segmap_parloop_235673_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235673_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235673_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235673_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235667            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235667_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235667_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235667_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235667_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235667_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235667_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235667_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235667_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235667_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235667_iter[i] /
                    (ctx->futhark_mc_segmap_task_235667_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235667_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235671     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235671_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235671_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235671_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235671_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235671_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235671_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235671_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235671_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235671_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235671_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235671_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235671_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235664         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235664_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235664_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235664_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235664_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235664_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235664_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235664_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235664_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235664_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235664_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235664_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235664_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235664_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235664_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235664_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235664_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235664_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235664_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235664_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235664_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235664_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235664_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235664_total_iter /
                (ctx->futhark_mc_segmap_parloop_235664_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235664_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235664_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235664_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235658            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235658_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235658_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235658_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235658_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235658_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235658_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235658_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235658_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235658_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235658_iter[i] /
                    (ctx->futhark_mc_segmap_task_235658_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235658_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235662     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235662_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235662_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235662_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235662_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235662_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235662_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235662_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235662_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235662_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235662_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235662_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235662_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235695         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235695_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235695_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235695_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235695_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235695_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235695_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235695_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235695_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235695_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235695_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235695_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235695_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235695_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235695_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235695_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235695_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235695_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235695_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235695_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235695_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235695_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235695_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235695_total_iter /
                (ctx->futhark_mc_segmap_parloop_235695_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235695_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235695_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235695_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235706         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235706_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235706_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235706_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235706_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235706_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235706_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235706_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235706_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235706_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235706_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235706_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235706_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235706_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235706_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235706_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235706_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235706_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235706_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235706_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235706_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235706_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235706_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235706_total_iter /
                (ctx->futhark_mc_segmap_parloop_235706_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235706_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235706_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235706_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235717         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235717_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235717_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235717_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235717_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235717_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235717_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235717_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235717_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235717_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235717_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235717_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235717_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235717_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235717_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235717_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235717_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235717_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235717_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235717_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235717_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235717_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235717_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235717_total_iter /
                (ctx->futhark_mc_segmap_parloop_235717_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235717_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235717_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235717_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235727 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_235727_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235727_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235727_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235727_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235727_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235727_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235727_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235727_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235727_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235727_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235727_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235727_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235727_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_235727_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235727_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235727_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235727_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235727_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235727_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235727_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235727_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235727_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235727_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235727_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235727_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235727_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235727_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235722            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235722_runs[i],
                    (long) ctx->futhark_mc_segred_task_235722_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235722_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235722_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235722_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235722_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235722_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235722_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235722_iter[i],
                    (long) ctx->futhark_mc_segred_task_235722_iter[i] /
                    (ctx->futhark_mc_segred_task_235722_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235722_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235733 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_235733_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235733_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235733_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235733_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235733_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235733_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235733_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235733_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235733_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235733_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235733_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235733_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235733_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_235733_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235733_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235733_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235733_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235733_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235733_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235733_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235733_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235733_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235733_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235733_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235733_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235733_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235733_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235729            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235729_runs[i],
                    (long) ctx->futhark_mc_segred_task_235729_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235729_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235729_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235729_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235729_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235729_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235729_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235729_iter[i],
                    (long) ctx->futhark_mc_segred_task_235729_iter[i] /
                    (ctx->futhark_mc_segred_task_235729_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235729_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235720         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235720_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235720_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235720_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235720_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235720_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235720_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235720_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235720_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235720_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235720_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235720_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235720_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235720_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235720_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235720_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235720_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235720_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235720_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235720_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235720_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235720_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235720_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235720_total_iter /
                (ctx->futhark_mc_segmap_parloop_235720_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235720_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235720_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235720_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235715            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235715_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235715_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235715_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235715_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235715_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235715_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235715_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235715_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235715_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235715_iter[i] /
                    (ctx->futhark_mc_segmap_task_235715_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235715_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235718     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235718_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235718_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235718_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235718_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235718_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235718_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235718_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235718_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235718_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235718_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235718_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235718_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235711         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235711_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235711_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235711_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235711_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235711_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235711_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235711_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235711_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235711_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235711_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235711_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235711_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235711_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235711_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235711_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235711_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235711_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235711_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235711_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235711_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235711_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235711_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235711_total_iter /
                (ctx->futhark_mc_segmap_parloop_235711_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235711_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235711_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235711_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235704            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235704_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235704_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235704_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235704_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235704_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235704_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235704_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235704_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235704_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235704_iter[i] /
                    (ctx->futhark_mc_segmap_task_235704_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235704_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235709     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235709_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235709_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235709_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235709_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235709_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235709_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235709_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235709_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235709_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235709_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235709_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235709_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235700         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235700_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235700_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235700_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235700_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235700_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235700_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235700_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235700_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235700_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235700_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235700_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235700_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235700_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235700_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235700_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235700_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235700_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235700_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235700_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235700_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235700_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235700_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235700_total_iter /
                (ctx->futhark_mc_segmap_parloop_235700_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235700_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235700_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235700_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235693            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235693_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235693_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235693_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235693_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235693_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235693_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235693_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235693_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235693_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235693_iter[i] /
                    (ctx->futhark_mc_segmap_task_235693_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235693_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235698     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235698_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235698_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235698_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235698_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235698_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235698_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235698_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235698_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235698_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235698_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235698_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235698_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235737         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235737_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235737_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235737_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235737_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235737_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235737_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235737_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235737_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235737_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235737_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235737_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235737_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235737_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235737_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235737_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235737_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235737_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235737_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235737_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235737_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235737_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235737_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235737_total_iter /
                (ctx->futhark_mc_segmap_parloop_235737_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235737_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235737_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235737_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235748         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235748_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235748_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235748_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235748_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235748_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235748_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235748_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235748_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235748_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235748_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235748_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235748_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235748_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235748_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235748_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235748_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235748_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235748_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235748_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235748_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235748_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235748_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235748_total_iter /
                (ctx->futhark_mc_segmap_parloop_235748_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235748_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235748_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235748_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235759         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235759_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235759_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235759_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235759_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235759_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235759_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235759_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235759_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235759_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235759_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235759_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235759_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235759_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235759_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235759_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235759_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235759_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235759_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235759_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235759_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235759_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235759_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235759_total_iter /
                (ctx->futhark_mc_segmap_parloop_235759_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235759_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235759_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235759_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235771 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_235771_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235771_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235771_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235771_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235771_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235771_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235771_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235771_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235771_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235771_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235771_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235771_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235771_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_235771_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235771_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235771_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235771_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235771_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235771_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235771_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235771_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235771_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235771_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235771_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235771_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235771_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235771_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235764            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235764_runs[i],
                    (long) ctx->futhark_mc_segred_task_235764_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235764_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235764_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235764_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235764_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235764_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235764_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235764_iter[i],
                    (long) ctx->futhark_mc_segred_task_235764_iter[i] /
                    (ctx->futhark_mc_segred_task_235764_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235764_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235777 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_235777_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235777_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235777_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235777_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235777_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235777_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235777_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235777_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235777_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235777_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235777_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235777_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235777_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_235777_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235777_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235777_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235777_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235777_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235777_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235777_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235777_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235777_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235777_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235777_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235777_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235777_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235777_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235773            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235773_runs[i],
                    (long) ctx->futhark_mc_segred_task_235773_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235773_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235773_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235773_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235773_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235773_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235773_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235773_iter[i],
                    (long) ctx->futhark_mc_segred_task_235773_iter[i] /
                    (ctx->futhark_mc_segred_task_235773_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235773_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235762         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235762_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235762_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235762_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235762_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235762_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235762_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235762_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235762_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235762_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235762_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235762_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235762_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235762_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235762_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235762_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235762_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235762_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235762_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235762_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235762_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235762_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235762_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235762_total_iter /
                (ctx->futhark_mc_segmap_parloop_235762_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235762_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235762_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235762_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235757            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235757_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235757_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235757_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235757_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235757_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235757_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235757_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235757_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235757_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235757_iter[i] /
                    (ctx->futhark_mc_segmap_task_235757_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235757_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235760     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235760_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235760_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235760_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235760_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235760_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235760_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235760_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235760_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235760_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235760_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235760_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235760_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235753         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235753_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235753_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235753_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235753_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235753_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235753_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235753_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235753_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235753_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235753_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235753_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235753_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235753_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235753_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235753_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235753_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235753_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235753_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235753_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235753_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235753_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235753_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235753_total_iter /
                (ctx->futhark_mc_segmap_parloop_235753_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235753_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235753_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235753_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235746            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235746_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235746_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235746_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235746_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235746_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235746_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235746_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235746_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235746_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235746_iter[i] /
                    (ctx->futhark_mc_segmap_task_235746_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235746_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235751     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235751_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235751_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235751_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235751_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235751_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235751_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235751_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235751_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235751_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235751_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235751_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235751_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235742         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235742_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235742_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235742_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235742_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235742_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235742_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235742_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235742_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235742_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235742_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235742_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235742_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235742_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235742_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235742_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235742_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235742_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235742_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235742_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235742_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235742_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235742_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235742_total_iter /
                (ctx->futhark_mc_segmap_parloop_235742_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235742_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235742_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235742_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235735            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235735_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235735_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235735_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235735_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235735_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235735_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235735_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235735_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235735_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235735_iter[i] /
                    (ctx->futhark_mc_segmap_task_235735_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235735_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235740     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235740_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235740_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235740_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235740_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235740_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235740_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235740_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235740_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235740_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235740_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235740_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235740_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235781         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235781_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235781_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235781_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235781_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235781_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235781_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235781_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235781_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235781_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235781_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235781_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235781_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235781_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235781_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235781_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235781_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235781_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235781_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235781_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235781_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235781_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235781_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235781_total_iter /
                (ctx->futhark_mc_segmap_parloop_235781_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235781_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235781_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235781_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235791         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235791_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235791_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235791_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235791_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235791_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235791_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235791_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235791_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235791_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235791_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235791_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235791_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235791_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235791_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235791_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235791_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235791_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235791_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235791_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235791_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235791_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235791_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235791_total_iter /
                (ctx->futhark_mc_segmap_parloop_235791_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235791_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235791_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235791_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235801         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235801_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235801_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235801_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235801_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235801_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235801_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235801_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235801_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235801_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235801_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235801_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235801_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235801_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235801_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235801_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235801_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235801_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235801_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235801_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235801_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235801_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235801_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235801_total_iter /
                (ctx->futhark_mc_segmap_parloop_235801_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235801_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235801_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235801_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235811 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_235811_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235811_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235811_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235811_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235811_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235811_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235811_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235811_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235811_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235811_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235811_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235811_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235811_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_235811_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235811_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235811_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235811_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235811_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235811_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235811_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235811_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235811_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235811_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235811_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235811_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235811_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235811_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235808            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235808_runs[i],
                    (long) ctx->futhark_mc_segred_task_235808_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235808_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235808_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235808_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235808_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235808_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235808_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235808_iter[i],
                    (long) ctx->futhark_mc_segred_task_235808_iter[i] /
                    (ctx->futhark_mc_segred_task_235808_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235808_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235816 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_235816_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235816_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235816_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235816_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235816_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235816_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235816_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235816_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235816_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235816_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235816_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235816_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235816_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_235816_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235816_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235816_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235816_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235816_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235816_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235816_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235816_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235816_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235816_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235816_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235816_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235816_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235816_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235813            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235813_runs[i],
                    (long) ctx->futhark_mc_segred_task_235813_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235813_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235813_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235813_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235813_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235813_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235813_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235813_iter[i],
                    (long) ctx->futhark_mc_segred_task_235813_iter[i] /
                    (ctx->futhark_mc_segred_task_235813_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235813_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235805         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235805_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235805_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235805_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235805_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235805_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235805_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235805_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235805_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235805_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235805_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235805_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235805_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235805_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235805_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235805_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235805_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235805_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235805_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235805_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235805_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235805_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235805_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235805_total_iter /
                (ctx->futhark_mc_segmap_parloop_235805_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235805_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235805_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235805_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235799            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235799_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235799_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235799_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235799_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235799_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235799_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235799_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235799_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235799_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235799_iter[i] /
                    (ctx->futhark_mc_segmap_task_235799_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235799_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235803     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235803_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235803_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235803_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235803_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235803_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235803_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235803_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235803_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235803_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235803_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235803_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235803_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235796         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235796_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235796_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235796_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235796_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235796_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235796_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235796_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235796_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235796_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235796_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235796_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235796_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235796_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235796_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235796_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235796_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235796_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235796_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235796_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235796_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235796_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235796_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235796_total_iter /
                (ctx->futhark_mc_segmap_parloop_235796_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235796_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235796_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235796_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235789            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235789_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235789_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235789_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235789_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235789_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235789_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235789_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235789_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235789_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235789_iter[i] /
                    (ctx->futhark_mc_segmap_task_235789_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235789_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235794     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235794_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235794_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235794_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235794_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235794_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235794_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235794_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235794_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235794_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235794_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235794_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235794_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235786         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235786_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235786_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235786_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235786_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235786_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235786_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235786_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235786_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235786_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235786_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235786_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235786_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235786_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235786_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235786_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235786_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235786_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235786_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235786_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235786_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235786_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235786_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235786_total_iter /
                (ctx->futhark_mc_segmap_parloop_235786_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235786_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235786_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235786_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235779            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235779_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235779_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235779_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235779_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235779_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235779_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235779_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235779_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235779_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235779_iter[i] /
                    (ctx->futhark_mc_segmap_task_235779_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235779_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235784     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235784_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235784_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235784_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235784_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235784_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235784_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235784_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235784_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235784_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235784_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235784_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235784_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235820         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235820_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235820_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235820_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235820_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235820_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235820_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235820_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235820_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235820_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235820_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235820_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235820_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235820_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235820_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235820_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235820_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235820_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235820_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235820_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235820_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235820_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235820_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235820_total_iter /
                (ctx->futhark_mc_segmap_parloop_235820_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235820_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235820_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235820_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235833         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235833_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235833_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235833_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235833_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235833_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235833_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235833_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235833_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235833_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235833_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235833_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235833_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235833_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235833_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235833_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235833_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235833_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235833_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235833_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235833_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235833_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235833_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235833_total_iter /
                (ctx->futhark_mc_segmap_parloop_235833_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235833_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235833_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235833_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235846         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235846_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235846_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235846_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235846_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235846_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235846_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235846_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235846_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235846_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235846_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235846_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235846_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235846_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235846_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235846_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235846_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235846_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235846_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235846_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235846_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235846_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235846_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235846_total_iter /
                (ctx->futhark_mc_segmap_parloop_235846_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235846_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235846_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235846_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235860 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_235860_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235860_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235860_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235860_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235860_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235860_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235860_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235860_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235860_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235860_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235860_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235860_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235860_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_235860_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235860_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235860_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235860_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235860_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235860_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235860_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235860_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235860_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235860_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235860_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235860_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235860_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235860_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235855            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235855_runs[i],
                    (long) ctx->futhark_mc_segred_task_235855_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235855_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235855_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235855_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235855_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235855_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235855_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235855_iter[i],
                    (long) ctx->futhark_mc_segred_task_235855_iter[i] /
                    (ctx->futhark_mc_segred_task_235855_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235855_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235866 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_235866_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235866_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235866_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235866_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235866_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235866_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235866_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235866_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235866_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235866_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235866_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235866_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235866_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_235866_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235866_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235866_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235866_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235866_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235866_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235866_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235866_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235866_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235866_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235866_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235866_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235866_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235866_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235862            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235862_runs[i],
                    (long) ctx->futhark_mc_segred_task_235862_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235862_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235862_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235862_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235862_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235862_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235862_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235862_iter[i],
                    (long) ctx->futhark_mc_segred_task_235862_iter[i] /
                    (ctx->futhark_mc_segred_task_235862_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235862_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235851         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235851_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235851_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235851_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235851_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235851_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235851_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235851_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235851_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235851_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235851_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235851_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235851_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235851_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235851_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235851_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235851_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235851_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235851_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235851_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235851_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235851_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235851_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235851_total_iter /
                (ctx->futhark_mc_segmap_parloop_235851_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235851_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235851_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235851_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235844            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235844_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235844_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235844_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235844_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235844_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235844_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235844_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235844_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235844_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235844_iter[i] /
                    (ctx->futhark_mc_segmap_task_235844_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235844_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235849     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235849_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235849_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235849_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235849_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235849_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235849_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235849_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235849_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235849_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235849_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235849_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235849_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235840         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235840_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235840_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235840_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235840_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235840_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235840_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235840_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235840_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235840_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235840_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235840_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235840_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235840_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235840_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235840_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235840_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235840_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235840_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235840_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235840_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235840_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235840_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235840_total_iter /
                (ctx->futhark_mc_segmap_parloop_235840_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235840_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235840_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235840_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235831            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235831_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235831_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235831_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235831_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235831_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235831_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235831_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235831_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235831_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235831_iter[i] /
                    (ctx->futhark_mc_segmap_task_235831_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235831_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235838     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235838_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235838_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235838_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235838_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235838_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235838_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235838_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235838_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235838_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235838_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235838_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235838_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235827         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235827_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235827_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235827_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235827_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235827_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235827_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235827_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235827_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235827_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235827_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235827_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235827_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235827_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235827_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235827_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235827_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235827_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235827_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235827_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235827_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235827_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235827_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235827_total_iter /
                (ctx->futhark_mc_segmap_parloop_235827_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235827_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235827_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235827_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235818            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235818_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235818_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235818_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235818_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235818_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235818_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235818_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235818_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235818_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235818_iter[i] /
                    (ctx->futhark_mc_segmap_task_235818_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235818_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235825     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235825_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235825_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235825_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235825_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235825_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235825_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235825_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235825_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235825_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235825_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235825_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235825_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235870         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235870_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235870_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235870_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235870_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235870_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235870_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235870_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235870_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235870_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235870_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235870_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235870_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235870_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235870_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235870_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235870_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235870_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235870_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235870_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235870_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235870_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235870_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235870_total_iter /
                (ctx->futhark_mc_segmap_parloop_235870_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235870_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235870_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235870_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235885         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235885_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235885_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235885_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235885_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235885_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235885_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235885_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235885_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235885_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235885_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235885_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235885_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235885_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235885_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235885_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235885_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235885_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235885_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235885_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235885_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235885_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235885_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235885_total_iter /
                (ctx->futhark_mc_segmap_parloop_235885_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235885_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235885_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235885_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235900         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235900_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235900_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235900_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235900_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235900_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235900_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235900_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235900_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235900_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235900_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235900_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235900_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235900_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235900_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235900_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235900_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235900_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235900_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235900_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235900_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235900_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235900_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235900_total_iter /
                (ctx->futhark_mc_segmap_parloop_235900_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235900_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235900_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235900_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235915         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235915_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235915_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235915_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235915_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235915_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235915_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235915_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235915_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235915_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235915_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235915_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235915_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235915_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235915_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235915_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235915_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235915_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235915_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235915_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235915_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235915_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235915_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235915_total_iter /
                (ctx->futhark_mc_segmap_parloop_235915_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235915_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235915_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235915_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235913            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235913_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235913_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235913_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235913_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235913_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235913_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235913_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235913_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235913_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235913_iter[i] /
                    (ctx->futhark_mc_segmap_task_235913_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235913_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235924 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_235924_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235924_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235924_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235924_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235924_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235924_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235924_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235924_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235924_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235924_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235924_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235924_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235924_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_235924_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235924_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235924_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235924_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235924_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235924_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235924_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235924_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235924_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235924_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235924_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235924_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235924_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235924_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235917            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235917_runs[i],
                    (long) ctx->futhark_mc_segred_task_235917_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235917_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235917_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235917_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235917_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235917_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235917_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235917_iter[i],
                    (long) ctx->futhark_mc_segred_task_235917_iter[i] /
                    (ctx->futhark_mc_segred_task_235917_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235917_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235930 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_235930_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235930_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235930_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235930_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235930_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235930_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235930_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235930_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235930_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235930_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235930_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235930_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235930_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_235930_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235930_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235930_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235930_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235930_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235930_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235930_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235930_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235930_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235930_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235930_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235930_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235930_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235930_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235926            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235926_runs[i],
                    (long) ctx->futhark_mc_segred_task_235926_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235926_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235926_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235926_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235926_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235926_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235926_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235926_iter[i],
                    (long) ctx->futhark_mc_segred_task_235926_iter[i] /
                    (ctx->futhark_mc_segred_task_235926_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235926_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235907         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235907_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235907_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235907_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235907_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235907_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235907_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235907_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235907_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235907_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235907_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235907_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235907_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235907_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235907_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235907_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235907_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235907_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235907_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235907_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235907_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235907_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235907_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235907_total_iter /
                (ctx->futhark_mc_segmap_parloop_235907_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235907_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235907_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235907_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235898            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235898_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235898_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235898_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235898_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235898_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235898_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235898_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235898_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235898_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235898_iter[i] /
                    (ctx->futhark_mc_segmap_task_235898_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235898_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235905     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235905_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235905_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235905_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235905_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235905_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235905_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235905_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235905_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235905_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235905_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235905_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235905_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235894         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235894_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235894_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235894_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235894_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235894_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235894_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235894_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235894_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235894_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235894_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235894_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235894_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235894_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235894_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235894_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235894_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235894_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235894_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235894_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235894_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235894_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235894_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235894_total_iter /
                (ctx->futhark_mc_segmap_parloop_235894_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235894_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235894_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235894_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235883            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235883_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235883_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235883_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235883_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235883_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235883_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235883_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235883_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235883_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235883_iter[i] /
                    (ctx->futhark_mc_segmap_task_235883_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235883_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235892     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235892_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235892_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235892_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235892_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235892_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235892_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235892_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235892_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235892_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235892_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235892_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235892_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235879         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235879_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235879_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235879_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235879_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235879_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235879_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235879_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235879_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235879_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235879_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235879_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235879_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235879_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235879_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235879_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235879_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235879_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235879_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235879_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235879_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235879_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235879_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235879_total_iter /
                (ctx->futhark_mc_segmap_parloop_235879_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235879_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235879_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235879_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235868            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235868_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235868_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235868_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235868_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235868_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235868_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235868_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235868_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235868_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235868_iter[i] /
                    (ctx->futhark_mc_segmap_task_235868_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235868_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235877     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235877_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235877_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235877_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235877_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235877_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235877_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235877_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235877_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235877_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235877_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235877_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235877_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235934         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235934_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235934_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235934_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235934_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235934_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235934_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235934_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235934_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235934_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235934_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235934_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235934_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235934_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235934_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235934_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235934_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235934_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235934_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235934_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235934_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235934_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235934_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235934_total_iter /
                (ctx->futhark_mc_segmap_parloop_235934_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235934_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235934_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235934_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235943         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235943_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235943_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235943_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235943_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235943_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235943_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235943_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235943_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235943_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235943_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235943_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235943_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235943_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235943_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235943_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235943_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235943_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235943_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235943_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235943_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235943_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235943_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235943_total_iter /
                (ctx->futhark_mc_segmap_parloop_235943_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235943_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235943_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235943_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235952         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235952_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235952_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235952_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235952_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235952_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235952_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235952_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235952_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235952_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235952_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235952_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235952_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235952_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235952_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235952_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235952_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235952_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235952_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235952_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235952_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235952_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235952_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235952_total_iter /
                (ctx->futhark_mc_segmap_parloop_235952_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235952_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235952_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235952_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235950            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235950_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235950_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235950_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235950_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235950_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235950_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235950_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235950_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235950_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235950_iter[i] /
                    (ctx->futhark_mc_segmap_task_235950_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235950_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235947         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235947_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235947_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235947_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235947_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235947_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235947_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235947_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235947_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235947_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235947_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235947_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235947_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235947_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235947_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235947_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235947_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235947_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235947_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235947_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235947_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235947_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235947_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235947_total_iter /
                (ctx->futhark_mc_segmap_parloop_235947_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235947_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235947_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235947_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235941            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235941_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235941_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235941_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235941_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235941_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235941_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235941_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235941_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235941_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235941_iter[i] /
                    (ctx->futhark_mc_segmap_task_235941_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235941_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235945     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235945_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235945_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235945_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235945_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235945_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235945_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235945_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235945_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235945_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235945_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235945_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235945_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235938         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235938_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235938_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235938_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235938_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235938_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235938_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235938_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235938_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235938_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235938_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235938_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235938_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235938_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235938_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235938_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235938_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235938_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235938_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235938_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235938_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235938_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235938_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235938_total_iter /
                (ctx->futhark_mc_segmap_parloop_235938_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235938_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235938_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235938_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235932            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235932_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235932_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235932_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235932_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235932_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235932_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235932_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235932_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235932_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235932_iter[i] /
                    (ctx->futhark_mc_segmap_task_235932_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235932_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235936     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235936_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235936_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235936_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235936_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235936_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235936_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235936_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235936_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235936_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235936_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235936_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235936_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235956         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235956_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235956_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235956_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235956_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235956_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235956_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235956_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235956_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235956_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235956_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235956_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235956_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235956_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235956_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235956_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235956_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235956_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235956_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235956_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235956_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235956_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235956_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235956_total_iter /
                (ctx->futhark_mc_segmap_parloop_235956_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235956_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235956_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235956_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235965         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235965_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235965_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235965_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235965_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235965_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235965_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235965_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235965_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235965_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235965_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235965_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235965_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235965_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235965_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235965_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235965_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235965_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235965_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235965_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235965_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235965_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235965_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235965_total_iter /
                (ctx->futhark_mc_segmap_parloop_235965_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235965_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235965_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235965_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235963            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235963_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235963_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235963_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235963_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235963_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235963_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235963_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235963_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235963_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235963_iter[i] /
                    (ctx->futhark_mc_segmap_task_235963_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235963_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235960         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235960_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235960_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235960_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235960_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235960_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235960_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235960_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235960_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235960_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235960_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235960_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235960_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235960_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235960_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235960_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235960_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235960_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235960_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235960_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235960_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235960_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235960_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235960_total_iter /
                (ctx->futhark_mc_segmap_parloop_235960_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235960_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235960_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235960_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235954            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235954_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235954_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235954_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235954_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235954_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235954_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235954_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235954_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235954_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235954_iter[i] /
                    (ctx->futhark_mc_segmap_task_235954_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235954_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235958     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235958_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235958_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235958_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235958_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235958_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235958_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235958_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235958_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235958_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235958_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235958_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235958_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235969         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235969_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235969_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235969_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235969_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235969_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235969_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235969_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235969_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235969_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235969_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235969_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235969_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235969_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235969_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235969_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235969_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235969_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235969_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235969_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235969_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235969_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235969_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235969_total_iter /
                (ctx->futhark_mc_segmap_parloop_235969_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235969_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235969_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235969_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235977 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_235977_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235977_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235977_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235977_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235977_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235977_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235977_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235977_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235977_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235977_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235977_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235977_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235977_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_235977_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235977_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235977_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235977_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235977_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235977_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235977_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235977_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235977_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235977_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235977_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235977_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235977_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235977_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235974            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235974_runs[i],
                    (long) ctx->futhark_mc_segred_task_235974_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235974_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235974_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235974_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235974_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235974_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235974_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235974_iter[i],
                    (long) ctx->futhark_mc_segred_task_235974_iter[i] /
                    (ctx->futhark_mc_segred_task_235974_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235974_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235972         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235972_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235972_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235972_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235972_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235972_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235972_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235972_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235972_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235972_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235972_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235972_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235972_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235972_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235972_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235972_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235972_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235972_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235972_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235972_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235972_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235972_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235972_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235972_total_iter /
                (ctx->futhark_mc_segmap_parloop_235972_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235972_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235972_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235972_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235967            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235967_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235967_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235967_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235967_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235967_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235967_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235967_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235967_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235967_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235967_iter[i] /
                    (ctx->futhark_mc_segmap_task_235967_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235967_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235970     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235970_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235970_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235970_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235970_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235970_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235970_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235970_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235970_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235970_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235970_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235970_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235970_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235981         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235981_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235981_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235981_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235981_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235981_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235981_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235981_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235981_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235981_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235981_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235981_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235981_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235981_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235981_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235981_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235981_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235981_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235981_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235981_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235981_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235981_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235981_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235981_total_iter /
                (ctx->futhark_mc_segmap_parloop_235981_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235981_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235981_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235981_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_235991   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_235991_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235991_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235991_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235991_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235991_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_235991_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235991_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235991_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235991_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235991_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235991_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235991_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_235991_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_235991_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235991_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235991_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235991_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235991_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_235991_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235991_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235991_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235991_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235991_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_235991_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235991_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_235991_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_235991_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_235993   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_235993_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235993_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235993_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235993_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235993_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_235993_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235993_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235993_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235993_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235993_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235993_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235993_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_235993_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_235993_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235993_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235993_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235993_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235993_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_235993_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235993_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235993_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235993_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235993_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_235993_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235993_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_235993_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_235993_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_235988           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_235988_runs[i],
                    (long) ctx->futhark_mc_segscan_task_235988_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235988_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235988_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_235988_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_235988_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235988_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_235988_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_235988_iter[i],
                    (long) ctx->futhark_mc_segscan_task_235988_iter[i] /
                    (ctx->futhark_mc_segscan_task_235988_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235988_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235985         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235985_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235985_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235985_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235985_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235985_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235985_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235985_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235985_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235985_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235985_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235985_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235985_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235985_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235985_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235985_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235985_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235985_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235985_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235985_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235985_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235985_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235985_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235985_total_iter /
                (ctx->futhark_mc_segmap_parloop_235985_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235985_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235985_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235985_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235979            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235979_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235979_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235979_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235979_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235979_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235979_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235979_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235979_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235979_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235979_iter[i] /
                    (ctx->futhark_mc_segmap_task_235979_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235979_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235983     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235983_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235983_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235983_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235983_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235983_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235983_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235983_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235983_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235983_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235983_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235983_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235983_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235997         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235997_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235997_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235997_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235997_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235997_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235997_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235997_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235997_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235997_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235997_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235997_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235997_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235997_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235997_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235997_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235997_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235997_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235997_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235997_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235997_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235997_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235997_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235997_total_iter /
                (ctx->futhark_mc_segmap_parloop_235997_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235997_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235997_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235997_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236005 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_236005_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236005_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236005_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236005_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236005_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236005_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236005_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236005_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236005_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236005_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236005_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236005_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236005_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_236005_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236005_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236005_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236005_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236005_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236005_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236005_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236005_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236005_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236005_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236005_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236005_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236005_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236005_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236002            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236002_runs[i],
                    (long) ctx->futhark_mc_segred_task_236002_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236002_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236002_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236002_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236002_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236002_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236002_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236002_iter[i],
                    (long) ctx->futhark_mc_segred_task_236002_iter[i] /
                    (ctx->futhark_mc_segred_task_236002_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236002_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236000         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236000_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236000_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236000_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236000_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236000_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236000_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236000_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236000_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236000_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236000_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236000_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236000_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236000_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236000_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236000_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236000_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236000_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236000_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236000_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236000_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236000_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236000_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236000_total_iter /
                (ctx->futhark_mc_segmap_parloop_236000_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236000_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236000_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236000_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235995            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235995_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235995_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235995_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235995_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235995_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235995_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235995_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235995_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235995_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235995_iter[i] /
                    (ctx->futhark_mc_segmap_task_235995_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235995_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235998     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235998_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235998_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235998_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235998_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235998_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235998_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235998_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235998_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235998_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235998_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235998_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235998_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236009         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236009_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236009_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236009_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236009_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236009_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236009_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236009_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236009_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236009_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236009_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236009_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236009_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236009_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236009_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236009_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236009_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236009_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236009_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236009_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236009_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236009_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236009_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236009_total_iter /
                (ctx->futhark_mc_segmap_parloop_236009_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236009_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236009_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236009_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_236019   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_236019_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236019_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236019_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236019_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236019_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_236019_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236019_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236019_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236019_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236019_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236019_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236019_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_236019_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_236019_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236019_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236019_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236019_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236019_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_236019_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236019_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236019_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236019_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236019_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_236019_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236019_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_236019_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_236019_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_236021   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_236021_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236021_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236021_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236021_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236021_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_236021_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236021_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236021_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236021_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236021_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236021_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236021_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_236021_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_236021_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236021_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236021_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236021_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236021_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_236021_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236021_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236021_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236021_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236021_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_236021_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236021_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_236021_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_236021_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_236016           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_236016_runs[i],
                    (long) ctx->futhark_mc_segscan_task_236016_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236016_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236016_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_236016_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_236016_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236016_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_236016_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_236016_iter[i],
                    (long) ctx->futhark_mc_segscan_task_236016_iter[i] /
                    (ctx->futhark_mc_segscan_task_236016_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236016_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236013         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236013_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236013_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236013_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236013_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236013_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236013_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236013_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236013_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236013_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236013_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236013_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236013_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236013_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236013_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236013_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236013_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236013_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236013_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236013_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236013_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236013_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236013_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236013_total_iter /
                (ctx->futhark_mc_segmap_parloop_236013_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236013_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236013_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236013_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236007            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236007_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236007_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236007_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236007_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236007_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236007_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236007_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236007_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236007_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236007_iter[i] /
                    (ctx->futhark_mc_segmap_task_236007_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236007_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236011     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236011_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236011_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236011_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236011_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236011_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236011_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236011_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236011_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236011_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236011_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236011_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236011_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236025         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236025_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236025_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236025_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236025_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236025_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236025_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236025_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236025_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236025_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236025_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236025_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236025_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236025_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236025_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236025_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236025_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236025_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236025_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236025_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236025_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236025_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236025_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236025_total_iter /
                (ctx->futhark_mc_segmap_parloop_236025_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236025_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236025_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236025_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236033 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_236033_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236033_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236033_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236033_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236033_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236033_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236033_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236033_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236033_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236033_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236033_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236033_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236033_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_236033_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236033_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236033_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236033_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236033_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236033_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236033_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236033_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236033_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236033_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236033_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236033_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236033_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236033_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236030            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236030_runs[i],
                    (long) ctx->futhark_mc_segred_task_236030_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236030_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236030_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236030_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236030_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236030_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236030_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236030_iter[i],
                    (long) ctx->futhark_mc_segred_task_236030_iter[i] /
                    (ctx->futhark_mc_segred_task_236030_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236030_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236028         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236028_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236028_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236028_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236028_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236028_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236028_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236028_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236028_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236028_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236028_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236028_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236028_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236028_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236028_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236028_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236028_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236028_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236028_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236028_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236028_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236028_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236028_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236028_total_iter /
                (ctx->futhark_mc_segmap_parloop_236028_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236028_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236028_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236028_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236023            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236023_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236023_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236023_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236023_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236023_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236023_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236023_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236023_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236023_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236023_iter[i] /
                    (ctx->futhark_mc_segmap_task_236023_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236023_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236026     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236026_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236026_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236026_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236026_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236026_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236026_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236026_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236026_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236026_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236026_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236026_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236026_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236037         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236037_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236037_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236037_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236037_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236037_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236037_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236037_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236037_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236037_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236037_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236037_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236037_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236037_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236037_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236037_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236037_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236037_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236037_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236037_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236037_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236037_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236037_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236037_total_iter /
                (ctx->futhark_mc_segmap_parloop_236037_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236037_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236037_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236037_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_236047   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_236047_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236047_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236047_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236047_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236047_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_236047_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236047_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236047_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236047_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236047_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236047_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236047_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_236047_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_236047_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236047_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236047_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236047_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236047_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_236047_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236047_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236047_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236047_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236047_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_236047_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236047_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_236047_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_236047_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_236049   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_236049_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236049_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236049_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236049_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236049_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_236049_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236049_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236049_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236049_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236049_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236049_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236049_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_236049_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_236049_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236049_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236049_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236049_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236049_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_236049_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236049_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236049_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236049_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236049_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_236049_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236049_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_236049_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_236049_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_236044           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_236044_runs[i],
                    (long) ctx->futhark_mc_segscan_task_236044_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236044_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236044_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_236044_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_236044_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236044_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_236044_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_236044_iter[i],
                    (long) ctx->futhark_mc_segscan_task_236044_iter[i] /
                    (ctx->futhark_mc_segscan_task_236044_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236044_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236041         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236041_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236041_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236041_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236041_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236041_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236041_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236041_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236041_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236041_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236041_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236041_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236041_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236041_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236041_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236041_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236041_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236041_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236041_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236041_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236041_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236041_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236041_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236041_total_iter /
                (ctx->futhark_mc_segmap_parloop_236041_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236041_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236041_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236041_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236035            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236035_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236035_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236035_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236035_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236035_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236035_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236035_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236035_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236035_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236035_iter[i] /
                    (ctx->futhark_mc_segmap_task_236035_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236035_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236039     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236039_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236039_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236039_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236039_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236039_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236039_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236039_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236039_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236039_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236039_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236039_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236039_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236053         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236053_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236053_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236053_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236053_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236053_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236053_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236053_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236053_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236053_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236053_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236053_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236053_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236053_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236053_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236053_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236053_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236053_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236053_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236053_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236053_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236053_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236053_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236053_total_iter /
                (ctx->futhark_mc_segmap_parloop_236053_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236053_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236053_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236053_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236062         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236062_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236062_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236062_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236062_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236062_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236062_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236062_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236062_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236062_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236062_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236062_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236062_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236062_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236062_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236062_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236062_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236062_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236062_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236062_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236062_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236062_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236062_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236062_total_iter /
                (ctx->futhark_mc_segmap_parloop_236062_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236062_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236062_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236062_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236070 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_236070_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236070_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236070_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236070_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236070_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236070_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236070_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236070_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236070_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236070_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236070_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236070_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236070_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_236070_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236070_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236070_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236070_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236070_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236070_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236070_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236070_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236070_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236070_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236070_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236070_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236070_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236070_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236067            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236067_runs[i],
                    (long) ctx->futhark_mc_segred_task_236067_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236067_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236067_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236067_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236067_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236067_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236067_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236067_iter[i],
                    (long) ctx->futhark_mc_segred_task_236067_iter[i] /
                    (ctx->futhark_mc_segred_task_236067_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236067_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236075 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_236075_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236075_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236075_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236075_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236075_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236075_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236075_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236075_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236075_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236075_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236075_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236075_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236075_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_236075_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236075_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236075_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236075_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236075_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236075_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236075_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236075_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236075_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236075_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236075_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236075_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236075_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236075_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236072            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236072_runs[i],
                    (long) ctx->futhark_mc_segred_task_236072_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236072_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236072_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236072_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236072_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236072_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236072_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236072_iter[i],
                    (long) ctx->futhark_mc_segred_task_236072_iter[i] /
                    (ctx->futhark_mc_segred_task_236072_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236072_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236065         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236065_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236065_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236065_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236065_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236065_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236065_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236065_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236065_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236065_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236065_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236065_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236065_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236065_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236065_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236065_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236065_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236065_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236065_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236065_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236065_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236065_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236065_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236065_total_iter /
                (ctx->futhark_mc_segmap_parloop_236065_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236065_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236065_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236065_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236060            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236060_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236060_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236060_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236060_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236060_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236060_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236060_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236060_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236060_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236060_iter[i] /
                    (ctx->futhark_mc_segmap_task_236060_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236060_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236063     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236063_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236063_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236063_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236063_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236063_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236063_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236063_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236063_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236063_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236063_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236063_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236063_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236057         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236057_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236057_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236057_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236057_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236057_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236057_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236057_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236057_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236057_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236057_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236057_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236057_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236057_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236057_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236057_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236057_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236057_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236057_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236057_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236057_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236057_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236057_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236057_total_iter /
                (ctx->futhark_mc_segmap_parloop_236057_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236057_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236057_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236057_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236051            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236051_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236051_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236051_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236051_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236051_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236051_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236051_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236051_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236051_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236051_iter[i] /
                    (ctx->futhark_mc_segmap_task_236051_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236051_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236055     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236055_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236055_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236055_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236055_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236055_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236055_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236055_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236055_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236055_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236055_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236055_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236055_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236079         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236079_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236079_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236079_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236079_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236079_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236079_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236079_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236079_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236079_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236079_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236079_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236079_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236079_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236079_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236079_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236079_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236079_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236079_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236079_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236079_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236079_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236079_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236079_total_iter /
                (ctx->futhark_mc_segmap_parloop_236079_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236079_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236079_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236079_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236090         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236090_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236090_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236090_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236090_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236090_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236090_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236090_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236090_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236090_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236090_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236090_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236090_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236090_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236090_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236090_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236090_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236090_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236090_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236090_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236090_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236090_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236090_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236090_total_iter /
                (ctx->futhark_mc_segmap_parloop_236090_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236090_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236090_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236090_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236100 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_236100_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236100_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236100_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236100_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236100_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236100_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236100_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236100_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236100_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236100_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236100_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236100_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236100_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_236100_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236100_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236100_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236100_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236100_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236100_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236100_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236100_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236100_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236100_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236100_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236100_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236100_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236100_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236095            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236095_runs[i],
                    (long) ctx->futhark_mc_segred_task_236095_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236095_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236095_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236095_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236095_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236095_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236095_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236095_iter[i],
                    (long) ctx->futhark_mc_segred_task_236095_iter[i] /
                    (ctx->futhark_mc_segred_task_236095_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236095_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236106 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_236106_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236106_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236106_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236106_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236106_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236106_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236106_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236106_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236106_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236106_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236106_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236106_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236106_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_236106_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236106_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236106_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236106_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236106_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236106_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236106_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236106_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236106_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236106_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236106_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236106_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236106_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236106_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236102            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236102_runs[i],
                    (long) ctx->futhark_mc_segred_task_236102_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236102_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236102_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236102_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236102_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236102_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236102_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236102_iter[i],
                    (long) ctx->futhark_mc_segred_task_236102_iter[i] /
                    (ctx->futhark_mc_segred_task_236102_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236102_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236093         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236093_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236093_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236093_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236093_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236093_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236093_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236093_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236093_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236093_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236093_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236093_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236093_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236093_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236093_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236093_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236093_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236093_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236093_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236093_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236093_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236093_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236093_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236093_total_iter /
                (ctx->futhark_mc_segmap_parloop_236093_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236093_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236093_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236093_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236088            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236088_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236088_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236088_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236088_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236088_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236088_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236088_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236088_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236088_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236088_iter[i] /
                    (ctx->futhark_mc_segmap_task_236088_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236088_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236091     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236091_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236091_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236091_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236091_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236091_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236091_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236091_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236091_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236091_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236091_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236091_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236091_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236084         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236084_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236084_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236084_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236084_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236084_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236084_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236084_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236084_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236084_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236084_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236084_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236084_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236084_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236084_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236084_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236084_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236084_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236084_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236084_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236084_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236084_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236084_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236084_total_iter /
                (ctx->futhark_mc_segmap_parloop_236084_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236084_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236084_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236084_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236077            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236077_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236077_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236077_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236077_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236077_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236077_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236077_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236077_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236077_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236077_iter[i] /
                    (ctx->futhark_mc_segmap_task_236077_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236077_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236082     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236082_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236082_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236082_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236082_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236082_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236082_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236082_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236082_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236082_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236082_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236082_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236082_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236110         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236110_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236110_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236110_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236110_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236110_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236110_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236110_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236110_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236110_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236110_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236110_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236110_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236110_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236110_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236110_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236110_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236110_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236110_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236110_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236110_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236110_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236110_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236110_total_iter /
                (ctx->futhark_mc_segmap_parloop_236110_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236110_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236110_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236110_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236121         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236121_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236121_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236121_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236121_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236121_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236121_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236121_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236121_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236121_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236121_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236121_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236121_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236121_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236121_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236121_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236121_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236121_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236121_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236121_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236121_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236121_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236121_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236121_total_iter /
                (ctx->futhark_mc_segmap_parloop_236121_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236121_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236121_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236121_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236133 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_236133_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236133_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236133_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236133_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236133_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236133_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236133_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236133_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236133_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236133_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236133_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236133_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236133_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_236133_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236133_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236133_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236133_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236133_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236133_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236133_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236133_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236133_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236133_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236133_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236133_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236133_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236133_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236126            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236126_runs[i],
                    (long) ctx->futhark_mc_segred_task_236126_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236126_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236126_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236126_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236126_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236126_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236126_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236126_iter[i],
                    (long) ctx->futhark_mc_segred_task_236126_iter[i] /
                    (ctx->futhark_mc_segred_task_236126_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236126_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236139 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_236139_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236139_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236139_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236139_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236139_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236139_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236139_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236139_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236139_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236139_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236139_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236139_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236139_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_236139_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236139_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236139_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236139_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236139_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236139_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236139_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236139_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236139_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236139_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236139_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236139_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236139_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236139_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236135            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236135_runs[i],
                    (long) ctx->futhark_mc_segred_task_236135_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236135_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236135_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236135_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236135_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236135_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236135_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236135_iter[i],
                    (long) ctx->futhark_mc_segred_task_236135_iter[i] /
                    (ctx->futhark_mc_segred_task_236135_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236135_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236124         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236124_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236124_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236124_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236124_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236124_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236124_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236124_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236124_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236124_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236124_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236124_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236124_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236124_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236124_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236124_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236124_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236124_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236124_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236124_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236124_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236124_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236124_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236124_total_iter /
                (ctx->futhark_mc_segmap_parloop_236124_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236124_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236124_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236124_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236119            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236119_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236119_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236119_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236119_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236119_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236119_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236119_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236119_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236119_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236119_iter[i] /
                    (ctx->futhark_mc_segmap_task_236119_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236119_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236122     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236122_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236122_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236122_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236122_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236122_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236122_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236122_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236122_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236122_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236122_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236122_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236122_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236115         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236115_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236115_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236115_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236115_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236115_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236115_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236115_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236115_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236115_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236115_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236115_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236115_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236115_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236115_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236115_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236115_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236115_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236115_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236115_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236115_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236115_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236115_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236115_total_iter /
                (ctx->futhark_mc_segmap_parloop_236115_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236115_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236115_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236115_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236108            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236108_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236108_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236108_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236108_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236108_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236108_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236108_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236108_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236108_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236108_iter[i] /
                    (ctx->futhark_mc_segmap_task_236108_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236108_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236113     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236113_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236113_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236113_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236113_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236113_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236113_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236113_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236113_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236113_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236113_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236113_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236113_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236143         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236143_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236143_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236143_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236143_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236143_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236143_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236143_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236143_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236143_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236143_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236143_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236143_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236143_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236143_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236143_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236143_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236143_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236143_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236143_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236143_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236143_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236143_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236143_total_iter /
                (ctx->futhark_mc_segmap_parloop_236143_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236143_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236143_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236143_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236153         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236153_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236153_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236153_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236153_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236153_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236153_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236153_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236153_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236153_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236153_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236153_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236153_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236153_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236153_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236153_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236153_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236153_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236153_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236153_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236153_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236153_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236153_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236153_total_iter /
                (ctx->futhark_mc_segmap_parloop_236153_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236153_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236153_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236153_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236163 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_236163_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236163_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236163_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236163_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236163_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236163_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236163_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236163_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236163_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236163_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236163_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236163_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236163_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_236163_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236163_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236163_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236163_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236163_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236163_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236163_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236163_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236163_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236163_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236163_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236163_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236163_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236163_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236160            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236160_runs[i],
                    (long) ctx->futhark_mc_segred_task_236160_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236160_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236160_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236160_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236160_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236160_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236160_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236160_iter[i],
                    (long) ctx->futhark_mc_segred_task_236160_iter[i] /
                    (ctx->futhark_mc_segred_task_236160_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236160_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236168 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_236168_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236168_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236168_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236168_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236168_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236168_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236168_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236168_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236168_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236168_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236168_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236168_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236168_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_236168_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236168_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236168_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236168_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236168_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236168_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236168_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236168_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236168_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236168_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236168_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236168_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236168_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236168_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236165            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236165_runs[i],
                    (long) ctx->futhark_mc_segred_task_236165_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236165_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236165_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236165_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236165_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236165_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236165_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236165_iter[i],
                    (long) ctx->futhark_mc_segred_task_236165_iter[i] /
                    (ctx->futhark_mc_segred_task_236165_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236165_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236157         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236157_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236157_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236157_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236157_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236157_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236157_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236157_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236157_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236157_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236157_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236157_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236157_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236157_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236157_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236157_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236157_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236157_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236157_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236157_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236157_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236157_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236157_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236157_total_iter /
                (ctx->futhark_mc_segmap_parloop_236157_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236157_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236157_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236157_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236151            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236151_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236151_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236151_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236151_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236151_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236151_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236151_iter[i] /
                    (ctx->futhark_mc_segmap_task_236151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236151_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236155     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236155_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236155_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236155_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236155_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236155_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236155_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236155_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236155_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236155_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236155_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236155_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236155_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236148         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236148_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236148_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236148_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236148_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236148_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236148_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236148_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236148_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236148_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236148_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236148_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236148_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236148_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236148_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236148_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236148_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236148_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236148_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236148_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236148_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236148_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236148_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236148_total_iter /
                (ctx->futhark_mc_segmap_parloop_236148_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236148_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236148_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236148_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236141            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236141_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236141_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236141_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236141_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236141_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236141_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236141_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236141_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236141_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236141_iter[i] /
                    (ctx->futhark_mc_segmap_task_236141_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236141_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236146     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236146_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236146_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236146_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236146_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236146_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236146_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236146_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236146_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236146_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236146_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236146_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236146_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236172         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236172_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236172_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236172_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236172_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236172_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236172_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236172_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236172_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236172_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236172_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236172_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236172_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236172_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236172_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236172_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236172_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236172_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236172_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236172_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236172_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236172_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236172_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236172_total_iter /
                (ctx->futhark_mc_segmap_parloop_236172_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236172_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236172_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236172_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236185         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236185_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236185_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236185_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236185_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236185_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236185_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236185_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236185_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236185_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236185_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236185_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236185_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236185_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236185_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236185_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236185_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236185_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236185_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236185_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236185_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236185_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236185_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236185_total_iter /
                (ctx->futhark_mc_segmap_parloop_236185_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236185_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236185_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236185_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236199 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_236199_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236199_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236199_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236199_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236199_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236199_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236199_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236199_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236199_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236199_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236199_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236199_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236199_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_236199_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236199_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236199_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236199_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236199_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236199_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236199_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236199_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236199_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236199_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236199_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236199_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236199_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236199_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236194            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236194_runs[i],
                    (long) ctx->futhark_mc_segred_task_236194_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236194_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236194_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236194_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236194_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236194_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236194_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236194_iter[i],
                    (long) ctx->futhark_mc_segred_task_236194_iter[i] /
                    (ctx->futhark_mc_segred_task_236194_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236194_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236205 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_236205_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236205_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236205_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236205_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236205_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236205_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236205_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236205_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236205_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236205_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236205_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236205_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236205_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_236205_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236205_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236205_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236205_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236205_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236205_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236205_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236205_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236205_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236205_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236205_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236205_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236205_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236205_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236201            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236201_runs[i],
                    (long) ctx->futhark_mc_segred_task_236201_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236201_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236201_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236201_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236201_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236201_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236201_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236201_iter[i],
                    (long) ctx->futhark_mc_segred_task_236201_iter[i] /
                    (ctx->futhark_mc_segred_task_236201_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236201_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236190         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236190_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236190_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236190_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236190_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236190_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236190_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236190_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236190_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236190_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236190_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236190_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236190_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236190_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236190_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236190_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236190_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236190_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236190_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236190_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236190_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236190_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236190_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236190_total_iter /
                (ctx->futhark_mc_segmap_parloop_236190_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236190_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236190_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236190_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236183            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236183_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236183_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236183_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236183_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236183_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236183_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236183_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236183_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236183_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236183_iter[i] /
                    (ctx->futhark_mc_segmap_task_236183_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236183_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236188     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236188_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236188_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236188_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236188_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236188_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236188_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236188_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236188_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236188_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236188_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236188_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236188_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236179         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236179_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236179_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236179_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236179_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236179_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236179_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236179_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236179_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236179_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236179_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236179_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236179_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236179_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236179_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236179_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236179_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236179_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236179_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236179_total_iter /
                (ctx->futhark_mc_segmap_parloop_236179_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236179_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236179_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236179_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236170            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236170_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236170_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236170_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236170_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236170_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236170_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236170_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236170_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236170_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236170_iter[i] /
                    (ctx->futhark_mc_segmap_task_236170_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236170_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236177     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236177_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236177_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236177_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236177_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236177_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236177_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236177_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236177_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236177_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236177_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236177_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236177_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236209         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236209_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236209_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236209_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236209_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236209_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236209_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236209_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236209_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236209_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236209_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236209_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236209_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236209_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236209_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236209_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236209_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236209_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236209_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236209_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236209_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236209_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236209_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236209_total_iter /
                (ctx->futhark_mc_segmap_parloop_236209_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236209_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236209_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236209_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236224         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236224_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236224_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236224_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236224_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236224_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236224_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236224_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236224_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236224_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236224_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236224_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236224_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236224_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236224_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236224_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236224_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236224_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236224_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236224_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236224_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236224_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236224_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236224_total_iter /
                (ctx->futhark_mc_segmap_parloop_236224_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236224_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236224_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236224_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236239         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236239_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236239_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236239_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236239_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236239_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236239_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236239_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236239_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236239_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236239_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236239_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236239_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236239_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236239_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236239_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236239_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236239_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236239_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236239_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236239_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236239_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236239_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236239_total_iter /
                (ctx->futhark_mc_segmap_parloop_236239_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236239_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236239_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236239_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236237            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236237_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236237_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236237_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236237_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236237_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236237_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236237_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236237_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236237_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236237_iter[i] /
                    (ctx->futhark_mc_segmap_task_236237_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236237_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236248 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_236248_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236248_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236248_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236248_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236248_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236248_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236248_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236248_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236248_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236248_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236248_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236248_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236248_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_236248_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236248_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236248_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236248_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236248_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236248_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236248_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236248_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236248_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236248_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236248_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236248_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236248_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236248_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236241            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236241_runs[i],
                    (long) ctx->futhark_mc_segred_task_236241_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236241_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236241_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236241_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236241_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236241_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236241_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236241_iter[i],
                    (long) ctx->futhark_mc_segred_task_236241_iter[i] /
                    (ctx->futhark_mc_segred_task_236241_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236241_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236254 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_236254_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236254_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236254_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236254_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236254_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236254_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236254_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236254_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236254_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236254_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236254_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236254_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236254_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_236254_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236254_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236254_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236254_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236254_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236254_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236254_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236254_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236254_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236254_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236254_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236254_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236254_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236254_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236250            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236250_runs[i],
                    (long) ctx->futhark_mc_segred_task_236250_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236250_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236250_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236250_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236250_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236250_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236250_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236250_iter[i],
                    (long) ctx->futhark_mc_segred_task_236250_iter[i] /
                    (ctx->futhark_mc_segred_task_236250_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236250_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236231         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236231_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236231_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236231_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236231_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236231_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236231_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236231_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236231_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236231_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236231_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236231_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236231_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236231_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236231_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236231_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236231_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236231_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236231_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236231_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236231_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236231_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236231_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236231_total_iter /
                (ctx->futhark_mc_segmap_parloop_236231_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236231_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236231_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236231_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236222            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236222_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236222_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236222_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236222_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236222_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236222_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236222_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236222_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236222_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236222_iter[i] /
                    (ctx->futhark_mc_segmap_task_236222_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236222_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236229     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236229_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236229_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236229_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236229_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236229_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236229_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236229_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236229_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236229_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236229_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236229_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236229_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236218         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236218_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236218_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236218_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236218_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236218_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236218_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236218_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236218_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236218_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236218_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236218_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236218_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236218_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236218_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236218_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236218_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236218_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236218_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236218_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236218_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236218_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236218_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236218_total_iter /
                (ctx->futhark_mc_segmap_parloop_236218_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236218_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236218_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236218_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236207            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236207_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236207_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236207_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236207_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236207_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236207_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236207_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236207_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236207_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236207_iter[i] /
                    (ctx->futhark_mc_segmap_task_236207_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236207_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236216     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236216_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236216_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236216_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236216_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236216_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236216_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236216_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236216_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236216_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236216_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236216_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236216_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236258         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236258_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236258_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236258_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236258_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236258_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236258_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236258_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236258_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236258_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236258_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236258_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236258_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236258_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236258_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236258_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236258_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236258_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236258_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236258_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236258_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236258_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236258_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236258_total_iter /
                (ctx->futhark_mc_segmap_parloop_236258_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236258_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236258_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236258_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236267         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236267_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236267_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236267_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236267_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236267_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236267_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236267_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236267_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236267_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236267_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236267_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236267_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236267_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236267_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236267_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236267_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236267_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236267_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236267_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236267_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236267_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236267_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236267_total_iter /
                (ctx->futhark_mc_segmap_parloop_236267_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236267_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236267_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236267_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236265            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236265_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236265_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236265_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236265_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236265_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236265_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236265_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236265_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236265_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236265_iter[i] /
                    (ctx->futhark_mc_segmap_task_236265_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236265_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236262         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236262_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236262_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236262_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236262_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236262_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236262_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236262_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236262_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236262_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236262_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236262_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236262_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236262_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236262_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236262_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236262_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236262_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236262_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236262_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236262_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236262_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236262_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236262_total_iter /
                (ctx->futhark_mc_segmap_parloop_236262_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236262_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236262_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236262_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236256            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236256_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236256_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236256_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236256_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236256_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236256_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236256_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236256_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236256_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236256_iter[i] /
                    (ctx->futhark_mc_segmap_task_236256_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236256_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236260     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236260_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236260_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236260_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236260_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236260_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236260_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236260_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236260_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236260_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236260_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236260_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236260_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236271         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236271_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236271_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236271_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236271_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236271_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236271_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236271_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236271_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236271_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236271_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236271_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236271_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236271_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236271_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236271_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236271_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236271_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236271_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236271_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236271_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236271_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236271_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236271_total_iter /
                (ctx->futhark_mc_segmap_parloop_236271_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236271_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236271_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236271_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236280         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236280_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236280_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236280_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236280_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236280_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236280_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236280_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236280_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236280_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236280_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236280_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236280_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236280_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236280_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236280_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236280_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236280_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236280_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236280_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236280_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236280_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236280_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236280_total_iter /
                (ctx->futhark_mc_segmap_parloop_236280_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236280_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236280_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236280_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236278            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236278_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236278_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236278_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236278_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236278_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236278_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236278_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236278_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236278_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236278_iter[i] /
                    (ctx->futhark_mc_segmap_task_236278_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236278_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236275         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236275_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236275_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236275_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236275_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236275_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236275_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236275_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236275_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236275_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236275_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236275_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236275_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236275_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236275_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236275_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236275_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236275_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236275_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236275_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236275_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236275_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236275_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236275_total_iter /
                (ctx->futhark_mc_segmap_parloop_236275_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236275_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236275_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236275_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236269            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236269_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236269_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236269_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236269_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236269_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236269_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236269_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236269_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236269_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236269_iter[i] /
                    (ctx->futhark_mc_segmap_task_236269_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236269_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236273     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236273_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236273_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236273_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236273_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236273_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236273_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236273_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236273_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236273_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236273_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236273_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236273_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236284         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236284_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236284_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236284_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236284_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236284_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236284_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236284_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236284_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236284_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236284_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236284_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236284_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236284_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236284_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236284_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236284_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236284_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236284_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236284_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236284_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236284_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236284_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236284_total_iter /
                (ctx->futhark_mc_segmap_parloop_236284_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236284_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236284_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236284_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236299         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236299_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236299_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236299_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236299_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236299_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236299_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236299_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236299_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236299_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236299_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236299_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236299_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236299_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236299_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236299_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236299_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236299_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236299_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236299_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236299_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236299_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236299_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236299_total_iter /
                (ctx->futhark_mc_segmap_parloop_236299_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236299_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236299_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236299_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236297            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236297_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236297_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236297_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236297_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236297_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236297_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236297_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236297_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236297_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236297_iter[i] /
                    (ctx->futhark_mc_segmap_task_236297_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236297_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236303         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236303_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236303_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236303_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236303_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236303_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236303_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236303_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236303_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236303_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236303_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236303_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236303_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236303_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236303_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236303_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236303_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236303_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236303_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236303_total_iter /
                (ctx->futhark_mc_segmap_parloop_236303_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236303_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236303_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236303_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236301            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236301_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236301_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236301_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236301_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236301_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236301_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236301_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236301_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236301_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236301_iter[i] /
                    (ctx->futhark_mc_segmap_task_236301_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236301_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236307         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236307_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236307_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236307_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236307_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236307_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236307_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236307_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236307_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236307_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236307_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236307_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236307_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236307_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236307_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236307_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236307_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236307_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236307_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236307_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236307_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236307_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236307_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236307_total_iter /
                (ctx->futhark_mc_segmap_parloop_236307_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236307_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236307_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236307_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236315 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_236315_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236315_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236315_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236315_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236315_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236315_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236315_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236315_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236315_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236315_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236315_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236315_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236315_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_236315_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236315_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236315_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236315_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236315_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236315_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236315_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236315_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236315_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236315_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236315_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236315_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236315_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236315_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236312            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236312_runs[i],
                    (long) ctx->futhark_mc_segred_task_236312_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236312_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236312_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236312_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236312_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236312_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236312_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236312_iter[i],
                    (long) ctx->futhark_mc_segred_task_236312_iter[i] /
                    (ctx->futhark_mc_segred_task_236312_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236312_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236320 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_236320_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236320_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236320_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236320_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236320_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236320_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236320_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236320_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236320_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236320_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236320_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236320_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236320_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_236320_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236320_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236320_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236320_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236320_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236320_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236320_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236320_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236320_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236320_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236320_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236320_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236320_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236320_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236317            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236317_runs[i],
                    (long) ctx->futhark_mc_segred_task_236317_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236317_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236317_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236317_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236317_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236317_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236317_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236317_iter[i],
                    (long) ctx->futhark_mc_segred_task_236317_iter[i] /
                    (ctx->futhark_mc_segred_task_236317_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236317_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236310         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236310_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236310_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236310_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236310_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236310_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236310_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236310_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236310_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236310_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236310_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236310_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236310_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236310_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236310_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236310_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236310_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236310_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236310_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236310_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236310_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236310_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236310_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236310_total_iter /
                (ctx->futhark_mc_segmap_parloop_236310_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236310_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236310_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236310_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236305            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236305_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236305_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236305_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236305_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236305_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236305_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236305_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236305_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236305_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236305_iter[i] /
                    (ctx->futhark_mc_segmap_task_236305_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236305_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236308     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236308_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236308_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236308_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236308_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236308_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236308_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236308_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236308_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236308_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236308_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236308_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236308_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236291         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236291_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236291_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236291_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236291_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236291_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236291_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236291_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236291_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236291_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236291_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236291_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236291_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236291_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236291_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236291_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236291_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236291_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236291_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236291_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236291_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236291_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236291_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236291_total_iter /
                (ctx->futhark_mc_segmap_parloop_236291_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236291_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236291_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236291_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236282            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236282_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236282_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236282_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236282_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236282_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236282_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236282_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236282_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236282_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236282_iter[i] /
                    (ctx->futhark_mc_segmap_task_236282_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236282_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236289     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236289_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236289_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236289_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236289_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236289_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236289_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236289_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236289_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236289_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236289_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236289_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236289_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236324         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236324_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236324_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236324_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236324_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236324_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236324_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236324_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236324_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236324_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236324_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236324_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236324_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236324_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236324_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236324_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236324_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236324_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236324_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236324_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236324_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236324_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236324_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236324_total_iter /
                (ctx->futhark_mc_segmap_parloop_236324_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236324_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236324_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236324_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236341         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236341_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236341_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236341_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236341_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236341_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236341_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236341_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236341_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236341_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236341_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236341_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236341_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236341_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236341_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236341_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236341_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236341_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236341_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236341_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236341_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236341_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236341_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236341_total_iter /
                (ctx->futhark_mc_segmap_parloop_236341_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236341_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236341_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236341_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236339            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236339_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236339_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236339_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236339_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236339_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236339_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236339_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236339_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236339_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236339_iter[i] /
                    (ctx->futhark_mc_segmap_task_236339_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236339_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236345         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236345_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236345_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236345_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236345_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236345_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236345_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236345_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236345_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236345_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236345_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236345_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236345_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236345_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236345_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236345_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236345_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236345_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236345_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236345_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236345_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236345_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236345_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236345_total_iter /
                (ctx->futhark_mc_segmap_parloop_236345_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236345_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236345_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236345_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236343            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236343_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236343_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236343_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236343_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236343_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236343_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236343_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236343_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236343_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236343_iter[i] /
                    (ctx->futhark_mc_segmap_task_236343_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236343_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236349         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236349_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236349_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236349_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236349_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236349_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236349_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236349_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236349_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236349_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236349_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236349_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236349_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236349_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236349_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236349_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236349_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236349_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236349_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236349_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236349_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236349_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236349_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236349_total_iter /
                (ctx->futhark_mc_segmap_parloop_236349_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236349_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236349_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236349_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236359 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_236359_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236359_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236359_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236359_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236359_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236359_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236359_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236359_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236359_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236359_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236359_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236359_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236359_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_236359_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236359_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236359_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236359_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236359_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236359_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236359_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236359_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236359_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236359_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236359_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236359_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236359_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236359_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236354            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236354_runs[i],
                    (long) ctx->futhark_mc_segred_task_236354_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236354_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236354_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236354_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236354_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236354_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236354_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236354_iter[i],
                    (long) ctx->futhark_mc_segred_task_236354_iter[i] /
                    (ctx->futhark_mc_segred_task_236354_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236354_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236365 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_236365_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236365_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236365_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236365_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236365_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236365_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236365_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236365_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236365_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236365_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236365_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236365_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236365_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_236365_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236365_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236365_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236365_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236365_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236365_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236365_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236365_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236365_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236365_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236365_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236365_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236365_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236365_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236361            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236361_runs[i],
                    (long) ctx->futhark_mc_segred_task_236361_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236361_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236361_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236361_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236361_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236361_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236361_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236361_iter[i],
                    (long) ctx->futhark_mc_segred_task_236361_iter[i] /
                    (ctx->futhark_mc_segred_task_236361_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236361_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236352         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236352_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236352_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236352_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236352_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236352_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236352_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236352_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236352_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236352_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236352_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236352_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236352_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236352_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236352_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236352_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236352_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236352_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236352_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236352_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236352_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236352_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236352_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236352_total_iter /
                (ctx->futhark_mc_segmap_parloop_236352_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236352_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236352_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236352_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236347            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236347_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236347_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236347_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236347_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236347_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236347_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236347_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236347_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236347_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236347_iter[i] /
                    (ctx->futhark_mc_segmap_task_236347_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236347_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236350     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236350_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236350_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236350_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236350_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236350_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236350_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236350_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236350_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236350_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236350_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236350_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236350_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236332         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236332_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236332_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236332_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236332_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236332_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236332_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236332_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236332_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236332_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236332_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236332_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236332_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236332_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236332_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236332_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236332_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236332_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236332_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236332_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236332_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236332_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236332_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236332_total_iter /
                (ctx->futhark_mc_segmap_parloop_236332_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236332_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236332_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236332_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236322            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236322_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236322_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236322_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236322_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236322_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236322_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236322_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236322_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236322_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236322_iter[i] /
                    (ctx->futhark_mc_segmap_task_236322_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236322_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236330     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236330_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236330_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236330_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236330_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236330_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236330_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236330_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236330_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236330_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236330_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236330_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236330_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236369         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236369_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236369_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236369_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236369_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236369_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236369_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236369_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236369_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236369_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236369_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236369_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236369_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236369_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236369_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236369_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236369_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236369_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236369_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236369_total_iter /
                (ctx->futhark_mc_segmap_parloop_236369_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236369_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236369_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236369_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236386         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236386_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236386_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236386_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236386_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236386_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236386_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236386_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236386_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236386_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236386_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236386_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236386_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236386_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236386_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236386_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236386_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236386_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236386_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236386_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236386_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236386_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236386_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236386_total_iter /
                (ctx->futhark_mc_segmap_parloop_236386_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236386_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236386_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236386_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236384            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236384_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236384_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236384_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236384_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236384_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236384_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236384_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236384_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236384_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236384_iter[i] /
                    (ctx->futhark_mc_segmap_task_236384_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236384_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236390         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236390_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236390_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236390_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236390_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236390_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236390_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236390_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236390_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236390_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236390_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236390_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236390_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236390_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236390_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236390_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236390_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236390_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236390_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236390_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236390_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236390_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236390_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236390_total_iter /
                (ctx->futhark_mc_segmap_parloop_236390_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236390_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236390_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236390_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236388            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236388_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236388_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236388_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236388_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236388_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236388_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236388_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236388_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236388_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236388_iter[i] /
                    (ctx->futhark_mc_segmap_task_236388_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236388_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236394         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236394_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236394_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236394_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236394_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236394_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236394_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236394_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236394_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236394_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236394_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236394_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236394_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236394_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236394_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236394_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236394_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236394_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236394_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236394_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236394_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236394_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236394_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236394_total_iter /
                (ctx->futhark_mc_segmap_parloop_236394_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236394_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236394_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236394_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236406 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_236406_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236406_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236406_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236406_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236406_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236406_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236406_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236406_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236406_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236406_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236406_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236406_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236406_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_236406_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236406_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236406_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236406_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236406_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236406_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236406_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236406_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236406_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236406_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236406_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236406_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236406_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236406_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236399            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236399_runs[i],
                    (long) ctx->futhark_mc_segred_task_236399_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236399_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236399_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236399_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236399_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236399_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236399_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236399_iter[i],
                    (long) ctx->futhark_mc_segred_task_236399_iter[i] /
                    (ctx->futhark_mc_segred_task_236399_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236399_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236412 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_236412_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236412_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236412_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236412_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236412_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236412_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236412_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236412_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236412_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236412_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236412_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236412_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236412_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_236412_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236412_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236412_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236412_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236412_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236412_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236412_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236412_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236412_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236412_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236412_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236412_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236412_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236412_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236408            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236408_runs[i],
                    (long) ctx->futhark_mc_segred_task_236408_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236408_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236408_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236408_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236408_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236408_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236408_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236408_iter[i],
                    (long) ctx->futhark_mc_segred_task_236408_iter[i] /
                    (ctx->futhark_mc_segred_task_236408_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236408_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236397         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236397_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236397_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236397_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236397_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236397_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236397_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236397_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236397_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236397_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236397_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236397_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236397_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236397_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236397_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236397_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236397_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236397_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236397_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236397_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236397_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236397_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236397_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236397_total_iter /
                (ctx->futhark_mc_segmap_parloop_236397_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236397_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236397_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236397_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236392            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236392_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236392_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236392_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236392_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236392_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236392_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236392_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236392_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236392_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236392_iter[i] /
                    (ctx->futhark_mc_segmap_task_236392_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236392_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236395     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236395_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236395_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236395_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236395_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236395_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236395_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236395_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236395_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236395_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236395_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236395_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236395_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236377         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236377_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236377_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236377_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236377_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236377_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236377_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236377_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236377_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236377_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236377_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236377_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236377_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236377_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236377_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236377_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236377_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236377_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236377_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236377_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236377_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236377_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236377_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236377_total_iter /
                (ctx->futhark_mc_segmap_parloop_236377_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236377_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236377_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236377_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236367            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236367_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236367_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236367_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236367_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236367_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236367_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236367_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236367_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236367_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236367_iter[i] /
                    (ctx->futhark_mc_segmap_task_236367_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236367_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236375     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236375_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236375_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236375_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236375_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236375_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236375_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236375_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236375_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236375_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236375_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236375_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236375_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236416         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236416_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236416_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236416_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236416_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236416_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236416_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236416_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236416_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236416_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236416_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236416_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236416_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236416_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236416_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236416_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236416_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236416_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236416_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236416_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236416_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236416_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236416_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236416_total_iter /
                (ctx->futhark_mc_segmap_parloop_236416_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236416_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236416_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236416_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236432         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236432_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236432_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236432_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236432_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236432_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236432_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236432_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236432_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236432_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236432_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236432_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236432_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236432_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236432_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236432_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236432_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236432_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236432_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236432_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236432_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236432_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236432_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236432_total_iter /
                (ctx->futhark_mc_segmap_parloop_236432_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236432_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236432_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236432_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236430            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236430_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236430_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236430_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236430_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236430_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236430_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236430_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236430_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236430_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236430_iter[i] /
                    (ctx->futhark_mc_segmap_task_236430_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236430_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236436         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236436_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236436_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236436_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236436_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236436_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236436_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236436_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236436_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236436_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236436_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236436_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236436_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236436_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236436_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236436_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236436_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236436_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236436_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236436_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236436_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236436_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236436_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236436_total_iter /
                (ctx->futhark_mc_segmap_parloop_236436_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236436_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236436_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236436_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236434            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236434_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236434_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236434_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236434_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236434_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236434_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236434_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236434_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236434_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236434_iter[i] /
                    (ctx->futhark_mc_segmap_task_236434_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236434_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236440         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236440_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236440_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236440_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236440_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236440_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236440_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236440_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236440_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236440_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236440_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236440_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236440_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236440_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236440_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236440_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236440_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236440_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236440_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236440_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236440_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236440_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236440_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236440_total_iter /
                (ctx->futhark_mc_segmap_parloop_236440_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236440_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236440_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236440_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236450 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_236450_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236450_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236450_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236450_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236450_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236450_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236450_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236450_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236450_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236450_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236450_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236450_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236450_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_236450_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236450_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236450_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236450_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236450_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236450_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236450_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236450_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236450_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236450_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236450_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236450_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236450_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236450_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236447            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236447_runs[i],
                    (long) ctx->futhark_mc_segred_task_236447_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236447_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236447_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236447_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236447_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236447_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236447_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236447_iter[i],
                    (long) ctx->futhark_mc_segred_task_236447_iter[i] /
                    (ctx->futhark_mc_segred_task_236447_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236447_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236455 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_236455_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236455_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236455_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236455_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236455_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236455_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236455_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236455_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236455_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236455_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236455_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236455_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236455_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_236455_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236455_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236455_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236455_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236455_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236455_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236455_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236455_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236455_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236455_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236455_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236455_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236455_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236455_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236452            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236452_runs[i],
                    (long) ctx->futhark_mc_segred_task_236452_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236452_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236452_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236452_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236452_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236452_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236452_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236452_iter[i],
                    (long) ctx->futhark_mc_segred_task_236452_iter[i] /
                    (ctx->futhark_mc_segred_task_236452_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236452_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236444         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236444_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236444_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236444_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236444_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236444_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236444_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236444_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236444_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236444_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236444_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236444_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236444_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236444_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236444_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236444_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236444_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236444_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236444_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236444_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236444_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236444_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236444_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236444_total_iter /
                (ctx->futhark_mc_segmap_parloop_236444_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236444_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236444_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236444_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236438            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236438_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236438_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236438_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236438_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236438_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236438_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236438_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236438_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236438_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236438_iter[i] /
                    (ctx->futhark_mc_segmap_task_236438_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236438_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236442     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236442_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236442_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236442_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236442_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236442_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236442_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236442_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236442_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236442_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236442_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236442_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236442_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236424         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236424_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236424_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236424_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236424_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236424_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236424_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236424_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236424_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236424_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236424_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236424_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236424_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236424_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236424_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236424_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236424_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236424_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236424_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236424_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236424_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236424_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236424_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236424_total_iter /
                (ctx->futhark_mc_segmap_parloop_236424_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236424_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236424_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236424_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236414            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236414_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236414_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236414_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236414_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236414_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236414_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236414_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236414_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236414_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236414_iter[i] /
                    (ctx->futhark_mc_segmap_task_236414_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236414_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236422     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236422_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236422_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236422_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236422_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236422_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236422_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236422_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236422_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236422_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236422_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236422_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236422_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236459         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236459_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236459_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236459_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236459_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236459_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236459_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236459_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236459_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236459_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236459_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236459_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236459_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236459_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236459_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236459_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236459_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236459_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236459_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236459_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236459_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236459_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236459_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236459_total_iter /
                (ctx->futhark_mc_segmap_parloop_236459_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236459_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236459_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236459_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236478         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236478_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236478_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236478_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236478_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236478_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236478_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236478_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236478_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236478_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236478_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236478_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236478_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236478_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236478_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236478_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236478_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236478_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236478_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236478_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236478_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236478_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236478_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236478_total_iter /
                (ctx->futhark_mc_segmap_parloop_236478_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236478_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236478_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236478_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236476            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236476_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236476_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236476_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236476_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236476_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236476_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236476_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236476_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236476_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236476_iter[i] /
                    (ctx->futhark_mc_segmap_task_236476_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236476_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236482         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236482_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236482_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236482_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236482_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236482_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236482_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236482_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236482_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236482_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236482_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236482_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236482_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236482_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236482_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236482_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236482_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236482_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236482_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236482_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236482_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236482_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236482_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236482_total_iter /
                (ctx->futhark_mc_segmap_parloop_236482_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236482_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236482_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236482_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236480            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236480_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236480_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236480_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236480_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236480_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236480_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236480_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236480_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236480_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236480_iter[i] /
                    (ctx->futhark_mc_segmap_task_236480_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236480_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236486         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236486_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236486_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236486_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236486_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236486_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236486_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236486_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236486_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236486_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236486_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236486_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236486_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236486_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236486_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236486_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236486_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236486_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236486_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236486_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236486_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236486_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236486_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236486_total_iter /
                (ctx->futhark_mc_segmap_parloop_236486_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236486_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236486_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236486_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236500 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_236500_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236500_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236500_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236500_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236500_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236500_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236500_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236500_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236500_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236500_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236500_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236500_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236500_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_236500_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236500_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236500_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236500_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236500_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236500_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236500_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236500_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236500_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236500_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236500_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236500_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236500_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236500_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236495            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236495_runs[i],
                    (long) ctx->futhark_mc_segred_task_236495_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236495_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236495_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236495_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236495_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236495_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236495_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236495_iter[i],
                    (long) ctx->futhark_mc_segred_task_236495_iter[i] /
                    (ctx->futhark_mc_segred_task_236495_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236495_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236506 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_236506_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236506_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236506_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236506_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236506_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236506_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236506_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236506_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236506_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236506_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236506_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236506_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236506_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_236506_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236506_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236506_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236506_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236506_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236506_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236506_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236506_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236506_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236506_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236506_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236506_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236506_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236506_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236502            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236502_runs[i],
                    (long) ctx->futhark_mc_segred_task_236502_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236502_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236502_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236502_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236502_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236502_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236502_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236502_iter[i],
                    (long) ctx->futhark_mc_segred_task_236502_iter[i] /
                    (ctx->futhark_mc_segred_task_236502_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236502_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236491         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236491_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236491_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236491_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236491_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236491_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236491_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236491_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236491_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236491_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236491_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236491_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236491_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236491_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236491_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236491_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236491_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236491_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236491_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236491_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236491_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236491_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236491_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236491_total_iter /
                (ctx->futhark_mc_segmap_parloop_236491_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236491_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236491_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236491_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236484            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236484_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236484_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236484_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236484_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236484_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236484_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236484_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236484_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236484_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236484_iter[i] /
                    (ctx->futhark_mc_segmap_task_236484_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236484_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236489     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236489_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236489_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236489_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236489_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236489_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236489_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236489_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236489_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236489_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236489_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236489_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236489_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236469         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236469_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236469_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236469_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236469_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236469_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236469_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236469_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236469_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236469_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236469_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236469_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236469_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236469_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236469_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236469_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236469_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236469_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236469_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236469_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236469_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236469_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236469_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236469_total_iter /
                (ctx->futhark_mc_segmap_parloop_236469_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236469_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236469_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236469_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236457            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236457_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236457_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236457_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236457_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236457_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236457_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236457_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236457_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236457_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236457_iter[i] /
                    (ctx->futhark_mc_segmap_task_236457_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236457_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236467     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236467_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236467_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236467_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236467_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236467_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236467_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236467_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236467_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236467_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236467_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236467_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236467_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236510         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236510_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236510_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236510_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236510_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236510_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236510_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236510_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236510_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236510_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236510_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236510_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236510_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236510_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236510_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236510_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236510_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236510_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236510_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236510_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236510_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236510_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236510_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236510_total_iter /
                (ctx->futhark_mc_segmap_parloop_236510_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236510_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236510_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236510_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236531         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236531_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236531_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236531_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236531_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236531_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236531_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236531_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236531_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236531_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236531_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236531_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236531_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236531_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236531_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236531_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236531_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236531_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236531_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236531_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236531_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236531_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236531_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236531_total_iter /
                (ctx->futhark_mc_segmap_parloop_236531_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236531_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236531_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236531_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236529            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236529_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236529_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236529_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236529_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236529_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236529_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236529_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236529_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236529_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236529_iter[i] /
                    (ctx->futhark_mc_segmap_task_236529_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236529_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236535         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236535_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236535_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236535_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236535_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236535_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236535_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236535_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236535_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236535_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236535_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236535_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236535_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236535_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236535_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236535_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236535_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236535_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236535_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236535_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236535_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236535_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236535_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236535_total_iter /
                (ctx->futhark_mc_segmap_parloop_236535_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236535_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236535_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236535_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236533            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236533_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236533_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236533_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236533_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236533_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236533_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236533_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236533_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236533_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236533_iter[i] /
                    (ctx->futhark_mc_segmap_task_236533_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236533_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236539         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236539_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236539_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236539_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236539_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236539_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236539_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236539_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236539_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236539_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236539_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236539_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236539_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236539_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236539_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236539_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236539_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236539_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236539_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236539_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236539_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236539_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236539_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236539_total_iter /
                (ctx->futhark_mc_segmap_parloop_236539_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236539_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236539_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236539_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236554         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236554_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236554_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236554_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236554_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236554_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236554_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236554_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236554_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236554_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236554_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236554_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236554_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236554_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236554_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236554_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236554_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236554_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236554_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236554_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236554_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236554_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236554_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236554_total_iter /
                (ctx->futhark_mc_segmap_parloop_236554_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236554_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236554_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236554_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236552            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236552_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236552_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236552_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236552_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236552_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236552_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236552_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236552_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236552_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236552_iter[i] /
                    (ctx->futhark_mc_segmap_task_236552_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236552_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236563 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_236563_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236563_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236563_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236563_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236563_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236563_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236563_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236563_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236563_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236563_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236563_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236563_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236563_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_236563_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236563_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236563_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236563_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236563_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236563_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236563_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236563_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236563_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236563_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236563_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236563_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236563_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236563_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236556            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236556_runs[i],
                    (long) ctx->futhark_mc_segred_task_236556_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236556_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236556_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236556_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236556_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236556_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236556_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236556_iter[i],
                    (long) ctx->futhark_mc_segred_task_236556_iter[i] /
                    (ctx->futhark_mc_segred_task_236556_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236556_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236569 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_236569_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236569_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236569_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236569_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236569_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236569_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236569_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236569_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236569_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236569_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236569_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236569_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236569_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_236569_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236569_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236569_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236569_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236569_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236569_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236569_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236569_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236569_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236569_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236569_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236569_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236569_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236569_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236565            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236565_runs[i],
                    (long) ctx->futhark_mc_segred_task_236565_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236565_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236565_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236565_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236565_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236565_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236565_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236565_iter[i],
                    (long) ctx->futhark_mc_segred_task_236565_iter[i] /
                    (ctx->futhark_mc_segred_task_236565_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236565_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236546         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236546_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236546_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236546_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236546_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236546_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236546_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236546_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236546_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236546_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236546_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236546_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236546_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236546_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236546_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236546_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236546_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236546_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236546_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236546_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236546_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236546_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236546_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236546_total_iter /
                (ctx->futhark_mc_segmap_parloop_236546_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236546_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236546_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236546_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236537            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236537_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236537_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236537_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236537_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236537_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236537_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236537_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236537_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236537_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236537_iter[i] /
                    (ctx->futhark_mc_segmap_task_236537_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236537_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236544     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236544_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236544_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236544_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236544_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236544_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236544_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236544_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236544_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236544_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236544_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236544_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236544_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236522         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236522_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236522_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236522_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236522_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236522_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236522_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236522_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236522_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236522_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236522_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236522_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236522_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236522_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236522_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236522_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236522_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236522_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236522_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236522_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236522_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236522_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236522_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236522_total_iter /
                (ctx->futhark_mc_segmap_parloop_236522_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236522_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236522_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236522_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236508            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236508_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236508_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236508_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236508_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236508_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236508_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236508_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236508_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236508_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236508_iter[i] /
                    (ctx->futhark_mc_segmap_task_236508_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236508_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236520     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236520_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236520_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236520_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236520_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236520_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236520_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236520_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236520_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236520_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236520_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236520_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236520_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236573         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236573_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236573_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236573_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236573_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236573_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236573_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236573_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236573_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236573_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236573_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236573_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236573_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236573_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236573_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236573_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236573_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236573_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236573_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236573_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236573_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236573_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236573_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236573_total_iter /
                (ctx->futhark_mc_segmap_parloop_236573_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236573_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236573_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236573_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236582         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236582_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236582_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236582_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236582_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236582_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236582_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236582_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236582_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236582_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236582_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236582_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236582_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236582_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236582_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236582_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236582_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236582_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236582_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236582_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236582_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236582_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236582_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236582_total_iter /
                (ctx->futhark_mc_segmap_parloop_236582_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236582_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236582_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236582_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236580            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236580_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236580_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236580_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236580_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236580_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236580_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236580_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236580_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236580_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236580_iter[i] /
                    (ctx->futhark_mc_segmap_task_236580_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236580_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236577         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236577_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236577_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236577_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236577_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236577_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236577_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236577_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236577_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236577_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236577_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236577_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236577_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236577_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236577_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236577_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236577_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236577_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236577_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236577_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236577_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236577_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236577_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236577_total_iter /
                (ctx->futhark_mc_segmap_parloop_236577_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236577_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236577_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236577_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236571            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236571_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236571_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236571_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236571_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236571_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236571_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236571_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236571_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236571_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236571_iter[i] /
                    (ctx->futhark_mc_segmap_task_236571_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236571_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236575     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236575_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236575_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236575_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236575_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236575_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236575_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236575_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236575_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236575_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236575_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236575_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236575_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236586         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236586_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236586_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236586_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236586_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236586_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236586_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236586_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236586_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236586_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236586_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236586_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236586_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236586_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236586_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236586_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236586_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236586_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236586_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236586_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236586_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236586_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236586_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236586_total_iter /
                (ctx->futhark_mc_segmap_parloop_236586_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236586_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236586_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236586_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236597         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236597_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236597_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236597_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236597_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236597_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236597_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236597_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236597_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236597_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236597_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236597_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236597_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236597_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236597_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236597_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236597_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236597_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236597_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236597_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236597_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236597_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236597_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236597_total_iter /
                (ctx->futhark_mc_segmap_parloop_236597_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236597_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236597_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236597_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236595            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236595_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236595_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236595_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236595_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236595_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236595_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236595_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236595_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236595_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236595_iter[i] /
                    (ctx->futhark_mc_segmap_task_236595_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236595_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236601         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236601_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236601_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236601_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236601_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236601_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236601_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236601_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236601_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236601_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236601_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236601_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236601_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236601_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236601_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236601_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236601_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236601_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236601_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236601_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236601_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236601_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236601_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236601_total_iter /
                (ctx->futhark_mc_segmap_parloop_236601_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236601_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236601_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236601_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236599            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236599_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236599_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236599_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236599_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236599_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236599_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236599_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236599_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236599_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236599_iter[i] /
                    (ctx->futhark_mc_segmap_task_236599_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236599_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236591         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236591_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236591_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236591_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236591_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236591_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236591_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236591_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236591_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236591_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236591_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236591_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236591_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236591_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236591_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236591_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236591_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236591_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236591_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236591_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236591_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236591_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236591_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236591_total_iter /
                (ctx->futhark_mc_segmap_parloop_236591_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236591_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236591_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236591_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236584            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236584_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236584_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236584_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236584_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236584_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236584_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236584_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236584_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236584_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236584_iter[i] /
                    (ctx->futhark_mc_segmap_task_236584_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236584_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236589     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236589_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236589_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236589_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236589_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236589_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236589_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236589_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236589_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236589_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236589_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236589_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236589_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236605         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236605_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236605_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236605_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236605_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236605_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236605_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236605_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236605_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236605_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236605_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236605_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236605_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236605_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236605_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236605_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236605_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236605_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236605_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236605_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236605_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236605_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236605_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236605_total_iter /
                (ctx->futhark_mc_segmap_parloop_236605_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236605_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236605_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236605_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_236626   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_236626_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236626_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236626_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236626_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236626_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_236626_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236626_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236626_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236626_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236626_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236626_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236626_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_236626_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_236626_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236626_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236626_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236626_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236626_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_236626_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236626_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236626_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236626_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236626_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_236626_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236626_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_236626_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_236626_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_236628   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_236628_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236628_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236628_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236628_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236628_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_236628_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236628_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236628_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236628_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236628_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236628_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236628_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_236628_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_236628_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236628_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236628_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236628_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236628_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_236628_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236628_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236628_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236628_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236628_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_236628_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236628_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_236628_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_236628_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_236620           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_236620_runs[i],
                    (long) ctx->futhark_mc_segscan_task_236620_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236620_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236620_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_236620_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_236620_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236620_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_236620_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_236620_iter[i],
                    (long) ctx->futhark_mc_segscan_task_236620_iter[i] /
                    (ctx->futhark_mc_segscan_task_236620_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236620_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236632         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236632_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236632_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236632_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236632_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236632_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236632_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236632_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236632_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236632_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236632_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236632_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236632_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236632_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236632_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236632_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236632_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236632_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236632_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236632_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236632_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236632_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236632_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236632_total_iter /
                (ctx->futhark_mc_segmap_parloop_236632_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236632_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236632_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236632_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236630            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236630_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236630_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236630_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236630_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236630_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236630_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236630_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236630_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236630_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236630_iter[i] /
                    (ctx->futhark_mc_segmap_task_236630_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236630_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236613         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236613_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236613_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236613_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236613_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236613_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236613_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236613_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236613_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236613_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236613_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236613_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236613_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236613_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236613_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236613_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236613_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236613_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236613_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236613_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236613_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236613_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236613_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236613_total_iter /
                (ctx->futhark_mc_segmap_parloop_236613_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236613_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236613_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236613_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236603            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236603_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236603_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236603_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236603_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236603_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236603_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236603_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236603_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236603_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236603_iter[i] /
                    (ctx->futhark_mc_segmap_task_236603_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236603_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236611     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236611_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236611_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236611_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236611_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236611_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236611_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236611_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236611_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236636         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236636_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236636_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236636_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236636_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236636_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236636_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236636_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236636_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236636_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236636_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236636_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236636_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236636_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236636_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236636_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236636_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236636_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236636_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236636_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236636_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236636_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236636_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236636_total_iter /
                (ctx->futhark_mc_segmap_parloop_236636_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236636_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236636_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236636_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236644 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_236644_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236644_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236644_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236644_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236644_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236644_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236644_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236644_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236644_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236644_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236644_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236644_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236644_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_236644_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236644_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236644_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236644_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236644_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236644_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236644_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236644_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236644_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236644_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236644_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236644_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236644_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236644_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236641            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236641_runs[i],
                    (long) ctx->futhark_mc_segred_task_236641_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236641_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236641_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236641_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236641_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236641_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236641_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236641_iter[i],
                    (long) ctx->futhark_mc_segred_task_236641_iter[i] /
                    (ctx->futhark_mc_segred_task_236641_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236641_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236639         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236639_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236639_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236639_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236639_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236639_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236639_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236639_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236639_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236639_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236639_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236639_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236639_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236639_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236639_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236639_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236639_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236639_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236639_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236639_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236639_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236639_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236639_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236639_total_iter /
                (ctx->futhark_mc_segmap_parloop_236639_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236639_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236639_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236639_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236634            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236634_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236634_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236634_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236634_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236634_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236634_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236634_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236634_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236634_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236634_iter[i] /
                    (ctx->futhark_mc_segmap_task_236634_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236634_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236637     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236637_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236637_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236637_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236637_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236637_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236637_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236637_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236637_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236637_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236637_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236637_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236637_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236648         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236648_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236648_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236648_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236648_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236648_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236648_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236648_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236648_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236648_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236648_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236648_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236648_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236648_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236648_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236648_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236648_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236648_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236648_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236648_total_iter /
                (ctx->futhark_mc_segmap_parloop_236648_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236648_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236648_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236648_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236657         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236657_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236657_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236657_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236657_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236657_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236657_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236657_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236657_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236657_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236657_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236657_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236657_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236657_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236657_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236657_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236657_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236657_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236657_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236657_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236657_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236657_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236657_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236657_total_iter /
                (ctx->futhark_mc_segmap_parloop_236657_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236657_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236657_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236657_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236655            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236655_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236655_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236655_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236655_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236655_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236655_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236655_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236655_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236655_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236655_iter[i] /
                    (ctx->futhark_mc_segmap_task_236655_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236655_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236652         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236652_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236652_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236652_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236652_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236652_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236652_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236652_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236652_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236652_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236652_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236652_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236652_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236652_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236652_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236652_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236652_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236652_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236652_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236652_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236652_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236652_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236652_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236652_total_iter /
                (ctx->futhark_mc_segmap_parloop_236652_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236652_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236652_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236652_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236646            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236646_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236646_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236646_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236646_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236646_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236646_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236646_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236646_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236646_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236646_iter[i] /
                    (ctx->futhark_mc_segmap_task_236646_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236646_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236650     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236650_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236650_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236650_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236650_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236650_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236650_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236650_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236650_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236666         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236666_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236666_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236666_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236666_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236666_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236666_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236666_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236666_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236666_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236666_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236666_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236666_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236666_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236666_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236666_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236666_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236666_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236666_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236666_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236666_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236666_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236666_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236666_total_iter /
                (ctx->futhark_mc_segmap_parloop_236666_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236666_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236666_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236666_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236664            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236664_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236664_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236664_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236664_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236664_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236664_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236664_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236664_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236664_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236664_iter[i] /
                    (ctx->futhark_mc_segmap_task_236664_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236664_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236661         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236661_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236661_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236661_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236661_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236661_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236661_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236661_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236661_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236661_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236661_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236661_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236661_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236661_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236661_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236661_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236661_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236661_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236661_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236661_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236661_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236661_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236661_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236661_total_iter /
                (ctx->futhark_mc_segmap_parloop_236661_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236661_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236661_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236661_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236659            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236659_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236659_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236659_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236659_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236659_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236659_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236659_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236659_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236659_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236659_iter[i] /
                    (ctx->futhark_mc_segmap_task_236659_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236659_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_235376,
                             struct memblock *mem_out_p_235377,
                             struct memblock *mem_out_p_235378,
                             struct memblock Y_mem_217285, int64_t m_203489,
                             int64_t n_203490, int64_t n_p_203492,
                             int64_t q_s_203493, int64_t q_t_203494,
                             int64_t q_l_203495, int64_t d_s_203496,
                             int64_t d_t_203497, int64_t d_l_203498,
                             int64_t jump_s_203499, int64_t jump_t_203500,
                             int64_t jump_l_203501, int64_t n_inner_203502,
                             int64_t n_outer_203503,
                             int64_t jump_threshold_203504,
                             int64_t q_threshold_203505);

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_235411 {
    struct futhark_context *ctx;
    int64_t free_m_203489;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_mem_217288;
    unsigned char *free_mem_217291;
    unsigned char *free_mem_217293;
};
struct futhark_mc_scan_stage_1_parloop_struct_235414 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_mem_217288;
    unsigned char *free_mem_217291;
    unsigned char *free_mem_217293;
};
struct futhark_mc_task_235416 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    bool *retval_defunc_2_reduce_res_203548;
};
struct futhark_mc_segred_stage_1_parloop_struct_235419 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221036;
};
static int futhark_mc_segred_stage_1_parloop_235420(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206862,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235419
    *futhark_mc_segred_stage_1_parloop_struct_235419 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235419 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235419->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235420_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235420_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235419->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235419->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_segred_stage_1_parloop_struct_235419->free_defunc_0_f_res_203510;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235419->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235419->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221036 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221036",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235419->free_reduce_stage_1_tid_res_arr_mem_221036,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221038 = start;
    bool x_203549;
    bool x_203550;
    bool local_acc_221039 = 0;
    
    for (; iter_221038 < end; iter_221038++) {
        int64_t gtid_206863 = iter_221038;
        bool defunc_2_reduce_res_203553;
        bool redout_216023 = 1;
        
        for (int64_t i_216024 = 0; i_216024 < defunc_0_f_res_203510;
             i_216024++) {
            int64_t x_203558 = mul64(n_p_203492, i_216024);
            int64_t idx_203559 = add64(x_203558, gtid_206863);
            bool cond_203560 = slt64(idx_203559, n_203490);
            bool defunc_0_f_res_203561;
            
            if (cond_203560) {
                bool x_203562 = sle64((int64_t) 0, idx_203559);
                bool bounds_check_203563 = cond_203560 && x_203562;
                bool index_certs_203564;
                
                if (!bounds_check_203563) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_203559,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  stl.fut:406:65-70\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  stl.fut:404:36-407:52\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:403:29-408:37\n   #9  stl.fut:402:22-409:28\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double isnan_arg_203565;
                
                isnan_arg_203565 = ((double *) Y_mem_217285.mem)[gtid_206861 *
                                                                 n_203490 +
                                                                 idx_203559];
                
                bool isnan_res_203566;
                
                isnan_res_203566 = futrts_isnan64(isnan_arg_203565);
                defunc_0_f_res_203561 = isnan_res_203566;
            } else {
                defunc_0_f_res_203561 = 0;
            }
            
            bool x_203556 = defunc_0_f_res_203561 && redout_216023;
            bool redout_tmp_221040 = x_203556;
            
            redout_216023 = redout_tmp_221040;
        }
        defunc_2_reduce_res_203553 = redout_216023;
        // save map-out results
        { }
        // Load accum params
        {
            x_203549 = local_acc_221039;
        }
        // Load next params
        {
            x_203550 = defunc_2_reduce_res_203553;
        }
        // Red body
        {
            bool defunc_1_op_res_203551 = x_203549 || x_203550;
            
            local_acc_221039 = defunc_1_op_res_203551;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221036.mem)[flat_tid_206862] =
        local_acc_221039;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235420_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235420_end -
                 futhark_mc_segred_stage_1_parloop_235420_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235420_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235420_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235420_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235417(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206862 = tid;
    int num_tasks_221035 = info.nsubtasks;
    struct futhark_mc_task_235416 *futhark_mc_task_235416 =
                                  (struct futhark_mc_task_235416 *) args;
    struct futhark_context *ctx = futhark_mc_task_235416->ctx;
    uint64_t futhark_mc_segred_task_235417_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235417_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235416->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235416->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_task_235416->free_defunc_0_f_res_203510;
    int64_t gtid_206861 = futhark_mc_task_235416->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235416->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_203548 =
         *futhark_mc_task_235416->retval_defunc_2_reduce_res_203548;
    size_t reduce_stage_1_tid_res_arr_mem_221036_cached_sizze_235418 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221036 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221036_cached_sizze_235418 <
        (size_t) num_tasks_221035) {
        reduce_stage_1_tid_res_arr_mem_221036 =
            realloc(reduce_stage_1_tid_res_arr_mem_221036, num_tasks_221035);
        reduce_stage_1_tid_res_arr_mem_221036_cached_sizze_235418 =
            num_tasks_221035;
    }
    
    int64_t iter_221038;
    struct futhark_mc_segred_stage_1_parloop_struct_235419
    futhark_mc_segred_stage_1_parloop_struct_235419;
    
    futhark_mc_segred_stage_1_parloop_struct_235419.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235419.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235419.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235419.free_defunc_0_f_res_203510 =
        defunc_0_f_res_203510;
    futhark_mc_segred_stage_1_parloop_struct_235419.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235419.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235419.free_reduce_stage_1_tid_res_arr_mem_221036 =
        reduce_stage_1_tid_res_arr_mem_221036;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235420_task;
    
    futhark_mc_segred_stage_1_parloop_235420_task.name =
        "futhark_mc_segred_stage_1_parloop_235420";
    futhark_mc_segred_stage_1_parloop_235420_task.fn =
        futhark_mc_segred_stage_1_parloop_235420;
    futhark_mc_segred_stage_1_parloop_235420_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235419;
    futhark_mc_segred_stage_1_parloop_235420_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235420_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235420_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235420_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235420_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235420_task);
    
    if (futhark_mc_segred_stage_1_parloop_235420_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235420_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235420_total_end -
                 futhark_mc_segred_stage_1_parloop_235420_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235420_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235420_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235420_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203548 = 0;
    }
    
    bool x_221041;
    bool x_221042;
    
    for (int32_t i_221044 = 0; i_221044 < num_tasks_221035; i_221044++) {
        flat_tid_206862 = i_221044;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221041 = defunc_2_reduce_res_203548;
            }
            // load next params
            {
                x_221042 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221036)[flat_tid_206862];
            }
            // red body
            {
                bool defunc_1_op_res_221043 = x_221041 || x_221042;
                
                defunc_2_reduce_res_203548 = defunc_1_op_res_221043;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221036);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235417_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235417_end -
                 futhark_mc_segred_task_235417_start;
        
        ctx->futhark_mc_segred_task_235417_runs[tid]++;
        ctx->futhark_mc_segred_task_235417_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235417_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235416->retval_defunc_2_reduce_res_203548 =
            defunc_2_reduce_res_203548;
    }
    return err;
}
struct futhark_mc_segred_stage_1_parloop_struct_235423 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221045;
};
struct futhark_mc_task_235425 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_gtid_206861;
    int64_t free_gtid_206869;
    unsigned char *free_Y_mem_217285;
    bool *retval_defunc_2_reduce_res_206874;
};
struct futhark_mc_segred_stage_1_parloop_struct_235428 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_gtid_206861;
    int64_t free_gtid_206869;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221050;
};
static int futhark_mc_segred_stage_1_parloop_235429(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206875,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235428
    *futhark_mc_segred_stage_1_parloop_struct_235428 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235428 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235428->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235429_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235429_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235428->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235428->free_n_p_203492;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235428->free_gtid_206861;
    int64_t gtid_206869 =
            futhark_mc_segred_stage_1_parloop_struct_235428->free_gtid_206869;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235428->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221050 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221050",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235428->free_reduce_stage_1_tid_res_arr_mem_221050,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221052 = start;
    bool x_206877;
    bool x_206878;
    bool local_acc_221053 = 1;
    
    for (; iter_221052 < end; iter_221052++) {
        int64_t gtid_206876 = iter_221052;
        int64_t x_206881 = mul64(n_p_203492, gtid_206876);
        int64_t idx_206882 = add64(gtid_206869, x_206881);
        bool cond_206883 = slt64(idx_206882, n_203490);
        bool defunc_0_f_res_206884;
        
        if (cond_206883) {
            bool x_206885 = sle64((int64_t) 0, idx_206882);
            bool bounds_check_206886 = cond_206883 && x_206885;
            bool index_certs_206887;
            
            if (!bounds_check_206886) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_206882,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  stl.fut:406:65-70\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  stl.fut:404:36-407:52\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:403:29-408:37\n   #9  stl.fut:402:22-409:28\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double isnan_arg_206888;
            
            isnan_arg_206888 = ((double *) Y_mem_217285.mem)[gtid_206861 *
                                                             n_203490 +
                                                             idx_206882];
            
            bool isnan_res_206889;
            
            isnan_res_206889 = futrts_isnan64(isnan_arg_206888);
            defunc_0_f_res_206884 = isnan_res_206889;
        } else {
            defunc_0_f_res_206884 = 0;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206877 = local_acc_221053;
        }
        // Load next params
        {
            x_206878 = defunc_0_f_res_206884;
        }
        // Red body
        {
            bool x_206879 = x_206877 && x_206878;
            
            local_acc_221053 = x_206879;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221050.mem)[flat_tid_206875] =
        local_acc_221053;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235429_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235429_end -
                 futhark_mc_segred_stage_1_parloop_235429_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235429_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235429_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235429_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235426(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206875 = tid;
    int num_tasks_221049 = info.nsubtasks;
    struct futhark_mc_task_235425 *futhark_mc_task_235425 =
                                  (struct futhark_mc_task_235425 *) args;
    struct futhark_context *ctx = futhark_mc_task_235425->ctx;
    uint64_t futhark_mc_segred_task_235426_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235426_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235425->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235425->free_n_p_203492;
    int64_t gtid_206861 = futhark_mc_task_235425->free_gtid_206861;
    int64_t gtid_206869 = futhark_mc_task_235425->free_gtid_206869;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235425->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_206874 =
         *futhark_mc_task_235425->retval_defunc_2_reduce_res_206874;
    size_t reduce_stage_1_tid_res_arr_mem_221050_cached_sizze_235427 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221050 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221050_cached_sizze_235427 <
        (size_t) num_tasks_221049) {
        reduce_stage_1_tid_res_arr_mem_221050 =
            realloc(reduce_stage_1_tid_res_arr_mem_221050, num_tasks_221049);
        reduce_stage_1_tid_res_arr_mem_221050_cached_sizze_235427 =
            num_tasks_221049;
    }
    
    int64_t iter_221052;
    struct futhark_mc_segred_stage_1_parloop_struct_235428
    futhark_mc_segred_stage_1_parloop_struct_235428;
    
    futhark_mc_segred_stage_1_parloop_struct_235428.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235428.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235428.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235428.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235428.free_gtid_206869 =
        gtid_206869;
    futhark_mc_segred_stage_1_parloop_struct_235428.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235428.free_reduce_stage_1_tid_res_arr_mem_221050 =
        reduce_stage_1_tid_res_arr_mem_221050;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235429_task;
    
    futhark_mc_segred_stage_1_parloop_235429_task.name =
        "futhark_mc_segred_stage_1_parloop_235429";
    futhark_mc_segred_stage_1_parloop_235429_task.fn =
        futhark_mc_segred_stage_1_parloop_235429;
    futhark_mc_segred_stage_1_parloop_235429_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235428;
    futhark_mc_segred_stage_1_parloop_235429_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235429_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235429_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235429_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235429_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235429_task);
    
    if (futhark_mc_segred_stage_1_parloop_235429_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235429_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235429_total_end -
                 futhark_mc_segred_stage_1_parloop_235429_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235429_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235429_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235429_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_206874 = 1;
    }
    
    bool x_221054;
    bool x_221055;
    
    for (int32_t i_221057 = 0; i_221057 < num_tasks_221049; i_221057++) {
        flat_tid_206875 = i_221057;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221054 = defunc_2_reduce_res_206874;
            }
            // load next params
            {
                x_221055 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221050)[flat_tid_206875];
            }
            // red body
            {
                bool x_221056 = x_221054 && x_221055;
                
                defunc_2_reduce_res_206874 = x_221056;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221050);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235426_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235426_end -
                 futhark_mc_segred_task_235426_start;
        
        ctx->futhark_mc_segred_task_235426_runs[tid]++;
        ctx->futhark_mc_segred_task_235426_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235426_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235425->retval_defunc_2_reduce_res_206874 =
            defunc_2_reduce_res_206874;
    }
    return err;
}
static int futhark_mc_segred_stage_1_parloop_235424(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206868,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235423
    *futhark_mc_segred_stage_1_parloop_struct_235423 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235423 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235423->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235424_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235424_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235423->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235423->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_segred_stage_1_parloop_struct_235423->free_defunc_0_f_res_203510;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235423->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235423->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221045 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221045",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235423->free_reduce_stage_1_tid_res_arr_mem_221045,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221047 = start;
    bool x_206870;
    bool x_206871;
    bool local_acc_221048 = 0;
    
    for (; iter_221047 < end; iter_221047++) {
        int64_t gtid_206869 = iter_221047;
        bool defunc_2_reduce_res_206874;
        int64_t flat_tid_206875 = (int64_t) 0;
        int32_t num_tasks_221049;
        
        defunc_2_reduce_res_206874 = 0;
        
        struct futhark_mc_task_235425 futhark_mc_task_235425;
        
        futhark_mc_task_235425.ctx = ctx;
        futhark_mc_task_235425.free_n_203490 = n_203490;
        futhark_mc_task_235425.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235425.free_gtid_206861 = gtid_206861;
        futhark_mc_task_235425.free_gtid_206869 = gtid_206869;
        futhark_mc_task_235425.free_Y_mem_217285 = Y_mem_217285.mem;
        futhark_mc_task_235425.retval_defunc_2_reduce_res_206874 =
            &defunc_2_reduce_res_206874;
        
        struct scheduler_segop futhark_mc_task_235425_task;
        
        futhark_mc_task_235425_task.args = &futhark_mc_task_235425;
        futhark_mc_task_235425_task.top_level_fn =
            futhark_mc_segred_task_235426;
        futhark_mc_task_235425_task.name = "futhark_mc_segred_task_235426";
        futhark_mc_task_235425_task.iterations = defunc_0_f_res_203510;
        futhark_mc_task_235425_task.task_time =
            &ctx->futhark_mc_segred_task_235426_total_time;
        futhark_mc_task_235425_task.task_iter =
            &ctx->futhark_mc_segred_task_235426_total_iter;
        futhark_mc_task_235425_task.sched = STATIC;
        futhark_mc_task_235425_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235426_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235425_task);
        
        if (futhark_mc_segred_task_235426_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206870 = local_acc_221048;
        }
        // Load next params
        {
            x_206871 = defunc_2_reduce_res_206874;
        }
        // Red body
        {
            bool defunc_1_op_res_206872 = x_206870 || x_206871;
            
            local_acc_221048 = defunc_1_op_res_206872;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221045.mem)[flat_tid_206868] =
        local_acc_221048;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235424_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235424_end -
                 futhark_mc_segred_stage_1_parloop_235424_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235424_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235424_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235424_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_nested_task_235421(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206868 = tid;
    int num_tasks_221035 = info.nsubtasks;
    struct futhark_mc_task_235416 *futhark_mc_task_235416 =
                                  (struct futhark_mc_task_235416 *) args;
    struct futhark_context *ctx = futhark_mc_task_235416->ctx;
    uint64_t futhark_mc_segred_nested_task_235421_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_nested_task_235421_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235416->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235416->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_task_235416->free_defunc_0_f_res_203510;
    int64_t gtid_206861 = futhark_mc_task_235416->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235416->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_203548 =
         *futhark_mc_task_235416->retval_defunc_2_reduce_res_203548;
    size_t reduce_stage_1_tid_res_arr_mem_221045_cached_sizze_235422 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221045 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221045_cached_sizze_235422 <
        (size_t) num_tasks_221035) {
        reduce_stage_1_tid_res_arr_mem_221045 =
            realloc(reduce_stage_1_tid_res_arr_mem_221045, num_tasks_221035);
        reduce_stage_1_tid_res_arr_mem_221045_cached_sizze_235422 =
            num_tasks_221035;
    }
    
    int64_t iter_221047;
    struct futhark_mc_segred_stage_1_parloop_struct_235423
    futhark_mc_segred_stage_1_parloop_struct_235423;
    
    futhark_mc_segred_stage_1_parloop_struct_235423.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235423.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235423.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235423.free_defunc_0_f_res_203510 =
        defunc_0_f_res_203510;
    futhark_mc_segred_stage_1_parloop_struct_235423.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235423.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235423.free_reduce_stage_1_tid_res_arr_mem_221045 =
        reduce_stage_1_tid_res_arr_mem_221045;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235424_task;
    
    futhark_mc_segred_stage_1_parloop_235424_task.name =
        "futhark_mc_segred_stage_1_parloop_235424";
    futhark_mc_segred_stage_1_parloop_235424_task.fn =
        futhark_mc_segred_stage_1_parloop_235424;
    futhark_mc_segred_stage_1_parloop_235424_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235423;
    futhark_mc_segred_stage_1_parloop_235424_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235424_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235424_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235424_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235424_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235424_task);
    
    if (futhark_mc_segred_stage_1_parloop_235424_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235424_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235424_total_end -
                 futhark_mc_segred_stage_1_parloop_235424_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235424_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235424_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235424_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203548 = 0;
    }
    
    bool x_221058;
    bool x_221059;
    
    for (int32_t i_221061 = 0; i_221061 < num_tasks_221035; i_221061++) {
        flat_tid_206868 = i_221061;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221058 = defunc_2_reduce_res_203548;
            }
            // load next params
            {
                x_221059 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221045)[flat_tid_206868];
            }
            // red body
            {
                bool defunc_1_op_res_221060 = x_221058 || x_221059;
                
                defunc_2_reduce_res_203548 = defunc_1_op_res_221060;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221045);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_nested_task_235421_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_nested_task_235421_end -
                 futhark_mc_segred_nested_task_235421_start;
        
        ctx->futhark_mc_segred_nested_task_235421_runs[tid]++;
        ctx->futhark_mc_segred_nested_task_235421_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_nested_task_235421_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235416->retval_defunc_2_reduce_res_203548 =
            defunc_2_reduce_res_203548;
    }
    return err;
}
static int futhark_mc_scan_stage_1_parloop_235415(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_206860, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_235414
    *futhark_mc_scan_stage_1_parloop_struct_235414 =
    (struct futhark_mc_scan_stage_1_parloop_struct_235414 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_235414->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_235415_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235415_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_scan_stage_1_parloop_struct_235414->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_scan_stage_1_parloop_struct_235414->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_scan_stage_1_parloop_struct_235414->free_defunc_0_f_res_203510;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_scan_stage_1_parloop_struct_235414->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock mem_217288 = {.desc ="mem_217288", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235414->free_mem_217288,
                                  .size =0, .references =NULL};
    struct memblock mem_217291 = {.desc ="mem_217291", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235414->free_mem_217291,
                                  .size =0, .references =NULL};
    struct memblock mem_217293 = {.desc ="mem_217293", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235414->free_mem_217293,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221034 = start;
    int64_t x_203544;
    int64_t y_203545;
    
    x_203544 = (int64_t) 0;
    for (; iter_221034 < end; iter_221034++) {
        int64_t gtid_206861 = iter_221034;
        
        // stage 1 scan body
        {
            bool defunc_2_reduce_res_203548;
            int64_t flat_tid_206862 = (int64_t) 0;
            int32_t num_tasks_221035;
            
            defunc_2_reduce_res_203548 = 0;
            
            int64_t flat_tid_206868 = (int64_t) 0;
            struct futhark_mc_task_235416 futhark_mc_task_235416;
            
            futhark_mc_task_235416.ctx = ctx;
            futhark_mc_task_235416.free_n_203490 = n_203490;
            futhark_mc_task_235416.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235416.free_defunc_0_f_res_203510 =
                defunc_0_f_res_203510;
            futhark_mc_task_235416.free_gtid_206861 = gtid_206861;
            futhark_mc_task_235416.free_Y_mem_217285 = Y_mem_217285.mem;
            futhark_mc_task_235416.retval_defunc_2_reduce_res_203548 =
                &defunc_2_reduce_res_203548;
            
            struct scheduler_segop futhark_mc_task_235416_task;
            
            futhark_mc_task_235416_task.args = &futhark_mc_task_235416;
            futhark_mc_task_235416_task.top_level_fn =
                futhark_mc_segred_task_235417;
            futhark_mc_task_235416_task.name = "futhark_mc_segred_task_235417";
            futhark_mc_task_235416_task.iterations = n_p_203492;
            futhark_mc_task_235416_task.task_time =
                &ctx->futhark_mc_segred_task_235417_total_time;
            futhark_mc_task_235416_task.task_iter =
                &ctx->futhark_mc_segred_task_235417_total_iter;
            futhark_mc_task_235416_task.sched = STATIC;
            futhark_mc_task_235416_task.nested_fn =
                futhark_mc_segred_nested_task_235421;
            
            int futhark_mc_segred_task_235417_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235416_task);
            
            if (futhark_mc_segred_task_235417_err != 0) {
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t defunc_2_lifted_lambda_res_203567 =
                    btoi_bool_i64(defunc_2_reduce_res_203548);
            bool is_i_203568 = defunc_2_lifted_lambda_res_203567 == (int64_t) 0;
            bool cond_neg_203569 = !is_i_203568;
            int64_t part_res_203570 = btoi_bool_i64(cond_neg_203569);
            int64_t part_res_203571 = btoi_bool_i64(is_i_203568);
            
            // write mapped values results to memory
            {
                ((int64_t *) mem_217291.mem)[gtid_206861] = part_res_203570;
                ((bool *) mem_217293.mem)[gtid_206861] =
                    defunc_2_reduce_res_203548;
            }
            x_203544 = x_203544;
            // Read next values
            {
                y_203545 = part_res_203571;
            }
            
            int64_t zz_203546 = x_203544 + y_203545;
            
            ((int64_t *) mem_217288.mem)[gtid_206861] = zz_203546;
            x_203544 = zz_203546;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235415_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235415_end -
                 futhark_mc_scan_stage_1_parloop_235415_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_235415_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_235415_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_235415_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_task_235430 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    bool *retval_defunc_2_reduce_res_203548;
};
struct futhark_mc_segred_stage_1_parloop_struct_235433 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221071;
};
static int futhark_mc_segred_stage_1_parloop_235434(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206862,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235433
    *futhark_mc_segred_stage_1_parloop_struct_235433 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235433 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235433->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235434_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235434_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235433->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235433->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_segred_stage_1_parloop_struct_235433->free_defunc_0_f_res_203510;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235433->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235433->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221071 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221071",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235433->free_reduce_stage_1_tid_res_arr_mem_221071,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221073 = start;
    bool x_203549;
    bool x_203550;
    bool local_acc_221074 = 0;
    
    for (; iter_221073 < end; iter_221073++) {
        int64_t gtid_206863 = iter_221073;
        bool defunc_2_reduce_res_203553;
        bool redout_216023 = 1;
        
        for (int64_t i_216024 = 0; i_216024 < defunc_0_f_res_203510;
             i_216024++) {
            int64_t x_203558 = mul64(n_p_203492, i_216024);
            int64_t idx_203559 = add64(x_203558, gtid_206863);
            bool cond_203560 = slt64(idx_203559, n_203490);
            bool defunc_0_f_res_203561;
            
            if (cond_203560) {
                bool x_203562 = sle64((int64_t) 0, idx_203559);
                bool bounds_check_203563 = cond_203560 && x_203562;
                bool index_certs_203564;
                
                if (!bounds_check_203563) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_203559,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  stl.fut:406:65-70\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  stl.fut:404:36-407:52\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:403:29-408:37\n   #9  stl.fut:402:22-409:28\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double isnan_arg_203565;
                
                isnan_arg_203565 = ((double *) Y_mem_217285.mem)[gtid_206861 *
                                                                 n_203490 +
                                                                 idx_203559];
                
                bool isnan_res_203566;
                
                isnan_res_203566 = futrts_isnan64(isnan_arg_203565);
                defunc_0_f_res_203561 = isnan_res_203566;
            } else {
                defunc_0_f_res_203561 = 0;
            }
            
            bool x_203556 = defunc_0_f_res_203561 && redout_216023;
            bool redout_tmp_221075 = x_203556;
            
            redout_216023 = redout_tmp_221075;
        }
        defunc_2_reduce_res_203553 = redout_216023;
        // save map-out results
        { }
        // Load accum params
        {
            x_203549 = local_acc_221074;
        }
        // Load next params
        {
            x_203550 = defunc_2_reduce_res_203553;
        }
        // Red body
        {
            bool defunc_1_op_res_203551 = x_203549 || x_203550;
            
            local_acc_221074 = defunc_1_op_res_203551;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221071.mem)[flat_tid_206862] =
        local_acc_221074;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235434_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235434_end -
                 futhark_mc_segred_stage_1_parloop_235434_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235434_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235434_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235434_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235431(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206862 = tid;
    int num_tasks_221070 = info.nsubtasks;
    struct futhark_mc_task_235430 *futhark_mc_task_235430 =
                                  (struct futhark_mc_task_235430 *) args;
    struct futhark_context *ctx = futhark_mc_task_235430->ctx;
    uint64_t futhark_mc_segred_task_235431_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235431_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235430->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235430->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_task_235430->free_defunc_0_f_res_203510;
    int64_t gtid_206861 = futhark_mc_task_235430->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235430->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_203548 =
         *futhark_mc_task_235430->retval_defunc_2_reduce_res_203548;
    size_t reduce_stage_1_tid_res_arr_mem_221071_cached_sizze_235432 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221071 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221071_cached_sizze_235432 <
        (size_t) num_tasks_221070) {
        reduce_stage_1_tid_res_arr_mem_221071 =
            realloc(reduce_stage_1_tid_res_arr_mem_221071, num_tasks_221070);
        reduce_stage_1_tid_res_arr_mem_221071_cached_sizze_235432 =
            num_tasks_221070;
    }
    
    int64_t iter_221073;
    struct futhark_mc_segred_stage_1_parloop_struct_235433
    futhark_mc_segred_stage_1_parloop_struct_235433;
    
    futhark_mc_segred_stage_1_parloop_struct_235433.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235433.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235433.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235433.free_defunc_0_f_res_203510 =
        defunc_0_f_res_203510;
    futhark_mc_segred_stage_1_parloop_struct_235433.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235433.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235433.free_reduce_stage_1_tid_res_arr_mem_221071 =
        reduce_stage_1_tid_res_arr_mem_221071;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235434_task;
    
    futhark_mc_segred_stage_1_parloop_235434_task.name =
        "futhark_mc_segred_stage_1_parloop_235434";
    futhark_mc_segred_stage_1_parloop_235434_task.fn =
        futhark_mc_segred_stage_1_parloop_235434;
    futhark_mc_segred_stage_1_parloop_235434_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235433;
    futhark_mc_segred_stage_1_parloop_235434_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235434_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235434_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235434_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235434_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235434_task);
    
    if (futhark_mc_segred_stage_1_parloop_235434_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235434_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235434_total_end -
                 futhark_mc_segred_stage_1_parloop_235434_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235434_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235434_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235434_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203548 = 0;
    }
    
    bool x_221076;
    bool x_221077;
    
    for (int32_t i_221079 = 0; i_221079 < num_tasks_221070; i_221079++) {
        flat_tid_206862 = i_221079;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221076 = defunc_2_reduce_res_203548;
            }
            // load next params
            {
                x_221077 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221071)[flat_tid_206862];
            }
            // red body
            {
                bool defunc_1_op_res_221078 = x_221076 || x_221077;
                
                defunc_2_reduce_res_203548 = defunc_1_op_res_221078;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221071);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235431_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235431_end -
                 futhark_mc_segred_task_235431_start;
        
        ctx->futhark_mc_segred_task_235431_runs[tid]++;
        ctx->futhark_mc_segred_task_235431_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235431_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235430->retval_defunc_2_reduce_res_203548 =
            defunc_2_reduce_res_203548;
    }
    return err;
}
struct futhark_mc_segred_stage_1_parloop_struct_235437 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221080;
};
struct futhark_mc_task_235439 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_gtid_206861;
    int64_t free_gtid_206869;
    unsigned char *free_Y_mem_217285;
    bool *retval_defunc_2_reduce_res_206874;
};
struct futhark_mc_segred_stage_1_parloop_struct_235442 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_gtid_206861;
    int64_t free_gtid_206869;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221085;
};
static int futhark_mc_segred_stage_1_parloop_235443(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206875,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235442
    *futhark_mc_segred_stage_1_parloop_struct_235442 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235442 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235442->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235443_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235443_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235442->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235442->free_n_p_203492;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235442->free_gtid_206861;
    int64_t gtid_206869 =
            futhark_mc_segred_stage_1_parloop_struct_235442->free_gtid_206869;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235442->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221085 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221085",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235442->free_reduce_stage_1_tid_res_arr_mem_221085,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221087 = start;
    bool x_206877;
    bool x_206878;
    bool local_acc_221088 = 1;
    
    for (; iter_221087 < end; iter_221087++) {
        int64_t gtid_206876 = iter_221087;
        int64_t x_206881 = mul64(n_p_203492, gtid_206876);
        int64_t idx_206882 = add64(gtid_206869, x_206881);
        bool cond_206883 = slt64(idx_206882, n_203490);
        bool defunc_0_f_res_206884;
        
        if (cond_206883) {
            bool x_206885 = sle64((int64_t) 0, idx_206882);
            bool bounds_check_206886 = cond_206883 && x_206885;
            bool index_certs_206887;
            
            if (!bounds_check_206886) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_206882,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  stl.fut:406:65-70\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  stl.fut:404:36-407:52\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:403:29-408:37\n   #9  stl.fut:402:22-409:28\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double isnan_arg_206888;
            
            isnan_arg_206888 = ((double *) Y_mem_217285.mem)[gtid_206861 *
                                                             n_203490 +
                                                             idx_206882];
            
            bool isnan_res_206889;
            
            isnan_res_206889 = futrts_isnan64(isnan_arg_206888);
            defunc_0_f_res_206884 = isnan_res_206889;
        } else {
            defunc_0_f_res_206884 = 0;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206877 = local_acc_221088;
        }
        // Load next params
        {
            x_206878 = defunc_0_f_res_206884;
        }
        // Red body
        {
            bool x_206879 = x_206877 && x_206878;
            
            local_acc_221088 = x_206879;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221085.mem)[flat_tid_206875] =
        local_acc_221088;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235443_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235443_end -
                 futhark_mc_segred_stage_1_parloop_235443_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235443_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235443_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235443_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235440(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206875 = tid;
    int num_tasks_221084 = info.nsubtasks;
    struct futhark_mc_task_235439 *futhark_mc_task_235439 =
                                  (struct futhark_mc_task_235439 *) args;
    struct futhark_context *ctx = futhark_mc_task_235439->ctx;
    uint64_t futhark_mc_segred_task_235440_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235440_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235439->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235439->free_n_p_203492;
    int64_t gtid_206861 = futhark_mc_task_235439->free_gtid_206861;
    int64_t gtid_206869 = futhark_mc_task_235439->free_gtid_206869;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235439->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_206874 =
         *futhark_mc_task_235439->retval_defunc_2_reduce_res_206874;
    size_t reduce_stage_1_tid_res_arr_mem_221085_cached_sizze_235441 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221085 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221085_cached_sizze_235441 <
        (size_t) num_tasks_221084) {
        reduce_stage_1_tid_res_arr_mem_221085 =
            realloc(reduce_stage_1_tid_res_arr_mem_221085, num_tasks_221084);
        reduce_stage_1_tid_res_arr_mem_221085_cached_sizze_235441 =
            num_tasks_221084;
    }
    
    int64_t iter_221087;
    struct futhark_mc_segred_stage_1_parloop_struct_235442
    futhark_mc_segred_stage_1_parloop_struct_235442;
    
    futhark_mc_segred_stage_1_parloop_struct_235442.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235442.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235442.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235442.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235442.free_gtid_206869 =
        gtid_206869;
    futhark_mc_segred_stage_1_parloop_struct_235442.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235442.free_reduce_stage_1_tid_res_arr_mem_221085 =
        reduce_stage_1_tid_res_arr_mem_221085;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235443_task;
    
    futhark_mc_segred_stage_1_parloop_235443_task.name =
        "futhark_mc_segred_stage_1_parloop_235443";
    futhark_mc_segred_stage_1_parloop_235443_task.fn =
        futhark_mc_segred_stage_1_parloop_235443;
    futhark_mc_segred_stage_1_parloop_235443_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235442;
    futhark_mc_segred_stage_1_parloop_235443_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235443_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235443_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235443_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235443_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235443_task);
    
    if (futhark_mc_segred_stage_1_parloop_235443_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235443_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235443_total_end -
                 futhark_mc_segred_stage_1_parloop_235443_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235443_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235443_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235443_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_206874 = 1;
    }
    
    bool x_221089;
    bool x_221090;
    
    for (int32_t i_221092 = 0; i_221092 < num_tasks_221084; i_221092++) {
        flat_tid_206875 = i_221092;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221089 = defunc_2_reduce_res_206874;
            }
            // load next params
            {
                x_221090 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221085)[flat_tid_206875];
            }
            // red body
            {
                bool x_221091 = x_221089 && x_221090;
                
                defunc_2_reduce_res_206874 = x_221091;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221085);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235440_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235440_end -
                 futhark_mc_segred_task_235440_start;
        
        ctx->futhark_mc_segred_task_235440_runs[tid]++;
        ctx->futhark_mc_segred_task_235440_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235440_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235439->retval_defunc_2_reduce_res_206874 =
            defunc_2_reduce_res_206874;
    }
    return err;
}
static int futhark_mc_segred_stage_1_parloop_235438(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206868,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235437
    *futhark_mc_segred_stage_1_parloop_struct_235437 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235437 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235437->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235438_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235438_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235437->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235437->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_segred_stage_1_parloop_struct_235437->free_defunc_0_f_res_203510;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235437->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235437->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221080 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221080",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235437->free_reduce_stage_1_tid_res_arr_mem_221080,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221082 = start;
    bool x_206870;
    bool x_206871;
    bool local_acc_221083 = 0;
    
    for (; iter_221082 < end; iter_221082++) {
        int64_t gtid_206869 = iter_221082;
        bool defunc_2_reduce_res_206874;
        int64_t flat_tid_206875 = (int64_t) 0;
        int32_t num_tasks_221084;
        
        defunc_2_reduce_res_206874 = 0;
        
        struct futhark_mc_task_235439 futhark_mc_task_235439;
        
        futhark_mc_task_235439.ctx = ctx;
        futhark_mc_task_235439.free_n_203490 = n_203490;
        futhark_mc_task_235439.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235439.free_gtid_206861 = gtid_206861;
        futhark_mc_task_235439.free_gtid_206869 = gtid_206869;
        futhark_mc_task_235439.free_Y_mem_217285 = Y_mem_217285.mem;
        futhark_mc_task_235439.retval_defunc_2_reduce_res_206874 =
            &defunc_2_reduce_res_206874;
        
        struct scheduler_segop futhark_mc_task_235439_task;
        
        futhark_mc_task_235439_task.args = &futhark_mc_task_235439;
        futhark_mc_task_235439_task.top_level_fn =
            futhark_mc_segred_task_235440;
        futhark_mc_task_235439_task.name = "futhark_mc_segred_task_235440";
        futhark_mc_task_235439_task.iterations = defunc_0_f_res_203510;
        futhark_mc_task_235439_task.task_time =
            &ctx->futhark_mc_segred_task_235440_total_time;
        futhark_mc_task_235439_task.task_iter =
            &ctx->futhark_mc_segred_task_235440_total_iter;
        futhark_mc_task_235439_task.sched = STATIC;
        futhark_mc_task_235439_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235440_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235439_task);
        
        if (futhark_mc_segred_task_235440_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206870 = local_acc_221083;
        }
        // Load next params
        {
            x_206871 = defunc_2_reduce_res_206874;
        }
        // Red body
        {
            bool defunc_1_op_res_206872 = x_206870 || x_206871;
            
            local_acc_221083 = defunc_1_op_res_206872;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221080.mem)[flat_tid_206868] =
        local_acc_221083;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235438_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235438_end -
                 futhark_mc_segred_stage_1_parloop_235438_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235438_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235438_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235438_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_nested_task_235435(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206868 = tid;
    int num_tasks_221070 = info.nsubtasks;
    struct futhark_mc_task_235430 *futhark_mc_task_235430 =
                                  (struct futhark_mc_task_235430 *) args;
    struct futhark_context *ctx = futhark_mc_task_235430->ctx;
    uint64_t futhark_mc_segred_nested_task_235435_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_nested_task_235435_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235430->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235430->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_task_235430->free_defunc_0_f_res_203510;
    int64_t gtid_206861 = futhark_mc_task_235430->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235430->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_203548 =
         *futhark_mc_task_235430->retval_defunc_2_reduce_res_203548;
    size_t reduce_stage_1_tid_res_arr_mem_221080_cached_sizze_235436 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221080 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221080_cached_sizze_235436 <
        (size_t) num_tasks_221070) {
        reduce_stage_1_tid_res_arr_mem_221080 =
            realloc(reduce_stage_1_tid_res_arr_mem_221080, num_tasks_221070);
        reduce_stage_1_tid_res_arr_mem_221080_cached_sizze_235436 =
            num_tasks_221070;
    }
    
    int64_t iter_221082;
    struct futhark_mc_segred_stage_1_parloop_struct_235437
    futhark_mc_segred_stage_1_parloop_struct_235437;
    
    futhark_mc_segred_stage_1_parloop_struct_235437.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235437.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235437.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235437.free_defunc_0_f_res_203510 =
        defunc_0_f_res_203510;
    futhark_mc_segred_stage_1_parloop_struct_235437.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235437.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235437.free_reduce_stage_1_tid_res_arr_mem_221080 =
        reduce_stage_1_tid_res_arr_mem_221080;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235438_task;
    
    futhark_mc_segred_stage_1_parloop_235438_task.name =
        "futhark_mc_segred_stage_1_parloop_235438";
    futhark_mc_segred_stage_1_parloop_235438_task.fn =
        futhark_mc_segred_stage_1_parloop_235438;
    futhark_mc_segred_stage_1_parloop_235438_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235437;
    futhark_mc_segred_stage_1_parloop_235438_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235438_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235438_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235438_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235438_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235438_task);
    
    if (futhark_mc_segred_stage_1_parloop_235438_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235438_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235438_total_end -
                 futhark_mc_segred_stage_1_parloop_235438_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235438_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235438_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235438_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203548 = 0;
    }
    
    bool x_221093;
    bool x_221094;
    
    for (int32_t i_221096 = 0; i_221096 < num_tasks_221070; i_221096++) {
        flat_tid_206868 = i_221096;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221093 = defunc_2_reduce_res_203548;
            }
            // load next params
            {
                x_221094 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221080)[flat_tid_206868];
            }
            // red body
            {
                bool defunc_1_op_res_221095 = x_221093 || x_221094;
                
                defunc_2_reduce_res_203548 = defunc_1_op_res_221095;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221080);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_nested_task_235435_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_nested_task_235435_end -
                 futhark_mc_segred_nested_task_235435_start;
        
        ctx->futhark_mc_segred_nested_task_235435_runs[tid]++;
        ctx->futhark_mc_segred_nested_task_235435_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_nested_task_235435_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235430->retval_defunc_2_reduce_res_203548 =
            defunc_2_reduce_res_203548;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_235444 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_mem_217288;
};
struct futhark_mc_task_235446 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    bool *retval_defunc_2_reduce_res_203548;
};
struct futhark_mc_segred_stage_1_parloop_struct_235449 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221102;
};
static int futhark_mc_segred_stage_1_parloop_235450(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206862,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235449
    *futhark_mc_segred_stage_1_parloop_struct_235449 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235449 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235449->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235450_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235450_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235449->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235449->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_segred_stage_1_parloop_struct_235449->free_defunc_0_f_res_203510;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235449->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235449->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221102 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221102",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235449->free_reduce_stage_1_tid_res_arr_mem_221102,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221104 = start;
    bool x_203549;
    bool x_203550;
    bool local_acc_221105 = 0;
    
    for (; iter_221104 < end; iter_221104++) {
        int64_t gtid_206863 = iter_221104;
        bool defunc_2_reduce_res_203553;
        bool redout_216023 = 1;
        
        for (int64_t i_216024 = 0; i_216024 < defunc_0_f_res_203510;
             i_216024++) {
            int64_t x_203558 = mul64(n_p_203492, i_216024);
            int64_t idx_203559 = add64(x_203558, gtid_206863);
            bool cond_203560 = slt64(idx_203559, n_203490);
            bool defunc_0_f_res_203561;
            
            if (cond_203560) {
                bool x_203562 = sle64((int64_t) 0, idx_203559);
                bool bounds_check_203563 = cond_203560 && x_203562;
                bool index_certs_203564;
                
                if (!bounds_check_203563) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_203559,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  stl.fut:406:65-70\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  stl.fut:404:36-407:52\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:403:29-408:37\n   #9  stl.fut:402:22-409:28\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double isnan_arg_203565;
                
                isnan_arg_203565 = ((double *) Y_mem_217285.mem)[gtid_206861 *
                                                                 n_203490 +
                                                                 idx_203559];
                
                bool isnan_res_203566;
                
                isnan_res_203566 = futrts_isnan64(isnan_arg_203565);
                defunc_0_f_res_203561 = isnan_res_203566;
            } else {
                defunc_0_f_res_203561 = 0;
            }
            
            bool x_203556 = defunc_0_f_res_203561 && redout_216023;
            bool redout_tmp_221106 = x_203556;
            
            redout_216023 = redout_tmp_221106;
        }
        defunc_2_reduce_res_203553 = redout_216023;
        // save map-out results
        { }
        // Load accum params
        {
            x_203549 = local_acc_221105;
        }
        // Load next params
        {
            x_203550 = defunc_2_reduce_res_203553;
        }
        // Red body
        {
            bool defunc_1_op_res_203551 = x_203549 || x_203550;
            
            local_acc_221105 = defunc_1_op_res_203551;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221102.mem)[flat_tid_206862] =
        local_acc_221105;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235450_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235450_end -
                 futhark_mc_segred_stage_1_parloop_235450_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235450_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235450_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235450_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235447(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206862 = tid;
    int num_tasks_221101 = info.nsubtasks;
    struct futhark_mc_task_235446 *futhark_mc_task_235446 =
                                  (struct futhark_mc_task_235446 *) args;
    struct futhark_context *ctx = futhark_mc_task_235446->ctx;
    uint64_t futhark_mc_segred_task_235447_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235447_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235446->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235446->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_task_235446->free_defunc_0_f_res_203510;
    int64_t gtid_206861 = futhark_mc_task_235446->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235446->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_203548 =
         *futhark_mc_task_235446->retval_defunc_2_reduce_res_203548;
    size_t reduce_stage_1_tid_res_arr_mem_221102_cached_sizze_235448 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221102 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221102_cached_sizze_235448 <
        (size_t) num_tasks_221101) {
        reduce_stage_1_tid_res_arr_mem_221102 =
            realloc(reduce_stage_1_tid_res_arr_mem_221102, num_tasks_221101);
        reduce_stage_1_tid_res_arr_mem_221102_cached_sizze_235448 =
            num_tasks_221101;
    }
    
    int64_t iter_221104;
    struct futhark_mc_segred_stage_1_parloop_struct_235449
    futhark_mc_segred_stage_1_parloop_struct_235449;
    
    futhark_mc_segred_stage_1_parloop_struct_235449.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235449.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235449.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235449.free_defunc_0_f_res_203510 =
        defunc_0_f_res_203510;
    futhark_mc_segred_stage_1_parloop_struct_235449.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235449.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235449.free_reduce_stage_1_tid_res_arr_mem_221102 =
        reduce_stage_1_tid_res_arr_mem_221102;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235450_task;
    
    futhark_mc_segred_stage_1_parloop_235450_task.name =
        "futhark_mc_segred_stage_1_parloop_235450";
    futhark_mc_segred_stage_1_parloop_235450_task.fn =
        futhark_mc_segred_stage_1_parloop_235450;
    futhark_mc_segred_stage_1_parloop_235450_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235449;
    futhark_mc_segred_stage_1_parloop_235450_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235450_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235450_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235450_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235450_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235450_task);
    
    if (futhark_mc_segred_stage_1_parloop_235450_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235450_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235450_total_end -
                 futhark_mc_segred_stage_1_parloop_235450_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235450_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235450_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235450_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203548 = 0;
    }
    
    bool x_221107;
    bool x_221108;
    
    for (int32_t i_221110 = 0; i_221110 < num_tasks_221101; i_221110++) {
        flat_tid_206862 = i_221110;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221107 = defunc_2_reduce_res_203548;
            }
            // load next params
            {
                x_221108 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221102)[flat_tid_206862];
            }
            // red body
            {
                bool defunc_1_op_res_221109 = x_221107 || x_221108;
                
                defunc_2_reduce_res_203548 = defunc_1_op_res_221109;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221102);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235447_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235447_end -
                 futhark_mc_segred_task_235447_start;
        
        ctx->futhark_mc_segred_task_235447_runs[tid]++;
        ctx->futhark_mc_segred_task_235447_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235447_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235446->retval_defunc_2_reduce_res_203548 =
            defunc_2_reduce_res_203548;
    }
    return err;
}
struct futhark_mc_segred_stage_1_parloop_struct_235453 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203510;
    int64_t free_gtid_206861;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221111;
};
struct futhark_mc_task_235455 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_gtid_206861;
    int64_t free_gtid_206869;
    unsigned char *free_Y_mem_217285;
    bool *retval_defunc_2_reduce_res_206874;
};
struct futhark_mc_segred_stage_1_parloop_struct_235458 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_gtid_206861;
    int64_t free_gtid_206869;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221116;
};
static int futhark_mc_segred_stage_1_parloop_235459(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206875,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235458
    *futhark_mc_segred_stage_1_parloop_struct_235458 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235458 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235458->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235459_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235459_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235458->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235458->free_n_p_203492;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235458->free_gtid_206861;
    int64_t gtid_206869 =
            futhark_mc_segred_stage_1_parloop_struct_235458->free_gtid_206869;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235458->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221116 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221116",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235458->free_reduce_stage_1_tid_res_arr_mem_221116,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221118 = start;
    bool x_206877;
    bool x_206878;
    bool local_acc_221119 = 1;
    
    for (; iter_221118 < end; iter_221118++) {
        int64_t gtid_206876 = iter_221118;
        int64_t x_206881 = mul64(n_p_203492, gtid_206876);
        int64_t idx_206882 = add64(gtid_206869, x_206881);
        bool cond_206883 = slt64(idx_206882, n_203490);
        bool defunc_0_f_res_206884;
        
        if (cond_206883) {
            bool x_206885 = sle64((int64_t) 0, idx_206882);
            bool bounds_check_206886 = cond_206883 && x_206885;
            bool index_certs_206887;
            
            if (!bounds_check_206886) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_206882,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  stl.fut:406:65-70\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  stl.fut:404:36-407:52\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:403:29-408:37\n   #9  stl.fut:402:22-409:28\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double isnan_arg_206888;
            
            isnan_arg_206888 = ((double *) Y_mem_217285.mem)[gtid_206861 *
                                                             n_203490 +
                                                             idx_206882];
            
            bool isnan_res_206889;
            
            isnan_res_206889 = futrts_isnan64(isnan_arg_206888);
            defunc_0_f_res_206884 = isnan_res_206889;
        } else {
            defunc_0_f_res_206884 = 0;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206877 = local_acc_221119;
        }
        // Load next params
        {
            x_206878 = defunc_0_f_res_206884;
        }
        // Red body
        {
            bool x_206879 = x_206877 && x_206878;
            
            local_acc_221119 = x_206879;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221116.mem)[flat_tid_206875] =
        local_acc_221119;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235459_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235459_end -
                 futhark_mc_segred_stage_1_parloop_235459_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235459_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235459_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235459_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235456(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206875 = tid;
    int num_tasks_221115 = info.nsubtasks;
    struct futhark_mc_task_235455 *futhark_mc_task_235455 =
                                  (struct futhark_mc_task_235455 *) args;
    struct futhark_context *ctx = futhark_mc_task_235455->ctx;
    uint64_t futhark_mc_segred_task_235456_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235456_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235455->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235455->free_n_p_203492;
    int64_t gtid_206861 = futhark_mc_task_235455->free_gtid_206861;
    int64_t gtid_206869 = futhark_mc_task_235455->free_gtid_206869;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235455->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_206874 =
         *futhark_mc_task_235455->retval_defunc_2_reduce_res_206874;
    size_t reduce_stage_1_tid_res_arr_mem_221116_cached_sizze_235457 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221116 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221116_cached_sizze_235457 <
        (size_t) num_tasks_221115) {
        reduce_stage_1_tid_res_arr_mem_221116 =
            realloc(reduce_stage_1_tid_res_arr_mem_221116, num_tasks_221115);
        reduce_stage_1_tid_res_arr_mem_221116_cached_sizze_235457 =
            num_tasks_221115;
    }
    
    int64_t iter_221118;
    struct futhark_mc_segred_stage_1_parloop_struct_235458
    futhark_mc_segred_stage_1_parloop_struct_235458;
    
    futhark_mc_segred_stage_1_parloop_struct_235458.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235458.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235458.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235458.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235458.free_gtid_206869 =
        gtid_206869;
    futhark_mc_segred_stage_1_parloop_struct_235458.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235458.free_reduce_stage_1_tid_res_arr_mem_221116 =
        reduce_stage_1_tid_res_arr_mem_221116;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235459_task;
    
    futhark_mc_segred_stage_1_parloop_235459_task.name =
        "futhark_mc_segred_stage_1_parloop_235459";
    futhark_mc_segred_stage_1_parloop_235459_task.fn =
        futhark_mc_segred_stage_1_parloop_235459;
    futhark_mc_segred_stage_1_parloop_235459_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235458;
    futhark_mc_segred_stage_1_parloop_235459_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235459_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235459_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235459_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235459_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235459_task);
    
    if (futhark_mc_segred_stage_1_parloop_235459_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235459_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235459_total_end -
                 futhark_mc_segred_stage_1_parloop_235459_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235459_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235459_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235459_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_206874 = 1;
    }
    
    bool x_221120;
    bool x_221121;
    
    for (int32_t i_221123 = 0; i_221123 < num_tasks_221115; i_221123++) {
        flat_tid_206875 = i_221123;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221120 = defunc_2_reduce_res_206874;
            }
            // load next params
            {
                x_221121 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221116)[flat_tid_206875];
            }
            // red body
            {
                bool x_221122 = x_221120 && x_221121;
                
                defunc_2_reduce_res_206874 = x_221122;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221116);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235456_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235456_end -
                 futhark_mc_segred_task_235456_start;
        
        ctx->futhark_mc_segred_task_235456_runs[tid]++;
        ctx->futhark_mc_segred_task_235456_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235456_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235455->retval_defunc_2_reduce_res_206874 =
            defunc_2_reduce_res_206874;
    }
    return err;
}
static int futhark_mc_segred_stage_1_parloop_235454(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206868,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235453
    *futhark_mc_segred_stage_1_parloop_struct_235453 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235453 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235453->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235454_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235454_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_235453->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235453->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_segred_stage_1_parloop_struct_235453->free_defunc_0_f_res_203510;
    int64_t gtid_206861 =
            futhark_mc_segred_stage_1_parloop_struct_235453->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235453->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221111 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221111",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235453->free_reduce_stage_1_tid_res_arr_mem_221111,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221113 = start;
    bool x_206870;
    bool x_206871;
    bool local_acc_221114 = 0;
    
    for (; iter_221113 < end; iter_221113++) {
        int64_t gtid_206869 = iter_221113;
        bool defunc_2_reduce_res_206874;
        int64_t flat_tid_206875 = (int64_t) 0;
        int32_t num_tasks_221115;
        
        defunc_2_reduce_res_206874 = 0;
        
        struct futhark_mc_task_235455 futhark_mc_task_235455;
        
        futhark_mc_task_235455.ctx = ctx;
        futhark_mc_task_235455.free_n_203490 = n_203490;
        futhark_mc_task_235455.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235455.free_gtid_206861 = gtid_206861;
        futhark_mc_task_235455.free_gtid_206869 = gtid_206869;
        futhark_mc_task_235455.free_Y_mem_217285 = Y_mem_217285.mem;
        futhark_mc_task_235455.retval_defunc_2_reduce_res_206874 =
            &defunc_2_reduce_res_206874;
        
        struct scheduler_segop futhark_mc_task_235455_task;
        
        futhark_mc_task_235455_task.args = &futhark_mc_task_235455;
        futhark_mc_task_235455_task.top_level_fn =
            futhark_mc_segred_task_235456;
        futhark_mc_task_235455_task.name = "futhark_mc_segred_task_235456";
        futhark_mc_task_235455_task.iterations = defunc_0_f_res_203510;
        futhark_mc_task_235455_task.task_time =
            &ctx->futhark_mc_segred_task_235456_total_time;
        futhark_mc_task_235455_task.task_iter =
            &ctx->futhark_mc_segred_task_235456_total_iter;
        futhark_mc_task_235455_task.sched = STATIC;
        futhark_mc_task_235455_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235456_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235455_task);
        
        if (futhark_mc_segred_task_235456_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206870 = local_acc_221114;
        }
        // Load next params
        {
            x_206871 = defunc_2_reduce_res_206874;
        }
        // Red body
        {
            bool defunc_1_op_res_206872 = x_206870 || x_206871;
            
            local_acc_221114 = defunc_1_op_res_206872;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221111.mem)[flat_tid_206868] =
        local_acc_221114;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235454_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235454_end -
                 futhark_mc_segred_stage_1_parloop_235454_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235454_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235454_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235454_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_nested_task_235451(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206868 = tid;
    int num_tasks_221101 = info.nsubtasks;
    struct futhark_mc_task_235446 *futhark_mc_task_235446 =
                                  (struct futhark_mc_task_235446 *) args;
    struct futhark_context *ctx = futhark_mc_task_235446->ctx;
    uint64_t futhark_mc_segred_nested_task_235451_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_nested_task_235451_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235446->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235446->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_task_235446->free_defunc_0_f_res_203510;
    int64_t gtid_206861 = futhark_mc_task_235446->free_gtid_206861;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235446->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    bool defunc_2_reduce_res_203548 =
         *futhark_mc_task_235446->retval_defunc_2_reduce_res_203548;
    size_t reduce_stage_1_tid_res_arr_mem_221111_cached_sizze_235452 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221111 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221111_cached_sizze_235452 <
        (size_t) num_tasks_221101) {
        reduce_stage_1_tid_res_arr_mem_221111 =
            realloc(reduce_stage_1_tid_res_arr_mem_221111, num_tasks_221101);
        reduce_stage_1_tid_res_arr_mem_221111_cached_sizze_235452 =
            num_tasks_221101;
    }
    
    int64_t iter_221113;
    struct futhark_mc_segred_stage_1_parloop_struct_235453
    futhark_mc_segred_stage_1_parloop_struct_235453;
    
    futhark_mc_segred_stage_1_parloop_struct_235453.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235453.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_235453.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235453.free_defunc_0_f_res_203510 =
        defunc_0_f_res_203510;
    futhark_mc_segred_stage_1_parloop_struct_235453.free_gtid_206861 =
        gtid_206861;
    futhark_mc_segred_stage_1_parloop_struct_235453.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segred_stage_1_parloop_struct_235453.free_reduce_stage_1_tid_res_arr_mem_221111 =
        reduce_stage_1_tid_res_arr_mem_221111;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235454_task;
    
    futhark_mc_segred_stage_1_parloop_235454_task.name =
        "futhark_mc_segred_stage_1_parloop_235454";
    futhark_mc_segred_stage_1_parloop_235454_task.fn =
        futhark_mc_segred_stage_1_parloop_235454;
    futhark_mc_segred_stage_1_parloop_235454_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235453;
    futhark_mc_segred_stage_1_parloop_235454_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235454_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235454_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235454_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235454_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235454_task);
    
    if (futhark_mc_segred_stage_1_parloop_235454_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235454_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235454_total_end -
                 futhark_mc_segred_stage_1_parloop_235454_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235454_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235454_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235454_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203548 = 0;
    }
    
    bool x_221124;
    bool x_221125;
    
    for (int32_t i_221127 = 0; i_221127 < num_tasks_221101; i_221127++) {
        flat_tid_206868 = i_221127;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221124 = defunc_2_reduce_res_203548;
            }
            // load next params
            {
                x_221125 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221111)[flat_tid_206868];
            }
            // red body
            {
                bool defunc_1_op_res_221126 = x_221124 || x_221125;
                
                defunc_2_reduce_res_203548 = defunc_1_op_res_221126;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221111);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_nested_task_235451_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_nested_task_235451_end -
                 futhark_mc_segred_nested_task_235451_start;
        
        ctx->futhark_mc_segred_nested_task_235451_runs[tid]++;
        ctx->futhark_mc_segred_nested_task_235451_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_nested_task_235451_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235446->retval_defunc_2_reduce_res_203548 =
            defunc_2_reduce_res_203548;
    }
    return err;
}
static int futhark_mc_scan_stage_3_parloop_235445(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_206860, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_235444
    *futhark_mc_scan_stage_3_parloop_struct_235444 =
    (struct futhark_mc_scan_stage_3_parloop_struct_235444 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_235444->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_235445_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_235445_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_scan_stage_3_parloop_struct_235444->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_scan_stage_3_parloop_struct_235444->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_scan_stage_3_parloop_struct_235444->free_defunc_0_f_res_203510;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_scan_stage_3_parloop_struct_235444->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock mem_217288 = {.desc ="mem_217288", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235444->free_mem_217288,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221100 = start;
    int64_t x_221097;
    int64_t y_221098;
    
    if (iter_221100 == (int64_t) 0) {
        x_221097 = (int64_t) 0;
    } else {
        x_221097 = ((int64_t *) mem_217288.mem)[iter_221100 - (int64_t) 1];
    }
    for (; iter_221100 < end; iter_221100++) {
        int64_t gtid_206861 = iter_221100;
        
        // stage 3 scan body
        {
            bool defunc_2_reduce_res_203548;
            int64_t flat_tid_206862 = (int64_t) 0;
            int32_t num_tasks_221101;
            
            defunc_2_reduce_res_203548 = 0;
            
            int64_t flat_tid_206868 = (int64_t) 0;
            struct futhark_mc_task_235446 futhark_mc_task_235446;
            
            futhark_mc_task_235446.ctx = ctx;
            futhark_mc_task_235446.free_n_203490 = n_203490;
            futhark_mc_task_235446.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235446.free_defunc_0_f_res_203510 =
                defunc_0_f_res_203510;
            futhark_mc_task_235446.free_gtid_206861 = gtid_206861;
            futhark_mc_task_235446.free_Y_mem_217285 = Y_mem_217285.mem;
            futhark_mc_task_235446.retval_defunc_2_reduce_res_203548 =
                &defunc_2_reduce_res_203548;
            
            struct scheduler_segop futhark_mc_task_235446_task;
            
            futhark_mc_task_235446_task.args = &futhark_mc_task_235446;
            futhark_mc_task_235446_task.top_level_fn =
                futhark_mc_segred_task_235447;
            futhark_mc_task_235446_task.name = "futhark_mc_segred_task_235447";
            futhark_mc_task_235446_task.iterations = n_p_203492;
            futhark_mc_task_235446_task.task_time =
                &ctx->futhark_mc_segred_task_235447_total_time;
            futhark_mc_task_235446_task.task_iter =
                &ctx->futhark_mc_segred_task_235447_total_iter;
            futhark_mc_task_235446_task.sched = STATIC;
            futhark_mc_task_235446_task.nested_fn =
                futhark_mc_segred_nested_task_235451;
            
            int futhark_mc_segred_task_235447_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235446_task);
            
            if (futhark_mc_segred_task_235447_err != 0) {
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t defunc_2_lifted_lambda_res_203567 =
                    btoi_bool_i64(defunc_2_reduce_res_203548);
            bool is_i_203568 = defunc_2_lifted_lambda_res_203567 == (int64_t) 0;
            bool cond_neg_203569 = !is_i_203568;
            int64_t part_res_203570 = btoi_bool_i64(cond_neg_203569);
            int64_t part_res_203571 = btoi_bool_i64(is_i_203568);
            
            x_221097 = x_221097;
            y_221098 = part_res_203571;
            
            int64_t zz_221099 = x_221097 + y_221098;
            
            ((int64_t *) mem_217288.mem)[gtid_206861] = zz_221099;
            x_221097 = zz_221099;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_235445_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_235445_end -
                 futhark_mc_scan_stage_3_parloop_235445_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_235445_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_235445_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_235445_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_235412(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206860 = tid;
    int num_tasks_221033 = info.nsubtasks;
    struct futhark_mc_task_235411 *futhark_mc_task_235411 =
                                  (struct futhark_mc_task_235411 *) args;
    struct futhark_context *ctx = futhark_mc_task_235411->ctx;
    uint64_t futhark_mc_segscan_task_235412_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_235412_start = get_wall_time();
    
    int64_t m_203489 = futhark_mc_task_235411->free_m_203489;
    int64_t n_203490 = futhark_mc_task_235411->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235411->free_n_p_203492;
    int64_t defunc_0_f_res_203510 =
            futhark_mc_task_235411->free_defunc_0_f_res_203510;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235411->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock mem_217288 = {.desc ="mem_217288", .mem =
                                  futhark_mc_task_235411->free_mem_217288,
                                  .size =0, .references =NULL};
    struct memblock mem_217291 = {.desc ="mem_217291", .mem =
                                  futhark_mc_task_235411->free_mem_217291,
                                  .size =0, .references =NULL};
    struct memblock mem_217293 = {.desc ="mem_217293", .mem =
                                  futhark_mc_task_235411->free_mem_217293,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_221067_cached_sizze_235413 = 0;
    unsigned char *scan_stage_2_accum_mem_221067 = NULL;
    int64_t iter_221034;
    struct futhark_mc_scan_stage_1_parloop_struct_235414
    futhark_mc_scan_stage_1_parloop_struct_235414;
    
    futhark_mc_scan_stage_1_parloop_struct_235414.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_235414.free_n_203490 = n_203490;
    futhark_mc_scan_stage_1_parloop_struct_235414.free_n_p_203492 = n_p_203492;
    futhark_mc_scan_stage_1_parloop_struct_235414.free_defunc_0_f_res_203510 =
        defunc_0_f_res_203510;
    futhark_mc_scan_stage_1_parloop_struct_235414.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_scan_stage_1_parloop_struct_235414.free_mem_217288 =
        mem_217288.mem;
    futhark_mc_scan_stage_1_parloop_struct_235414.free_mem_217291 =
        mem_217291.mem;
    futhark_mc_scan_stage_1_parloop_struct_235414.free_mem_217293 =
        mem_217293.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_235415_task;
    
    futhark_mc_scan_stage_1_parloop_235415_task.name =
        "futhark_mc_scan_stage_1_parloop_235415";
    futhark_mc_scan_stage_1_parloop_235415_task.fn =
        futhark_mc_scan_stage_1_parloop_235415;
    futhark_mc_scan_stage_1_parloop_235415_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_235414;
    futhark_mc_scan_stage_1_parloop_235415_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_235415_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_235415_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235415_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_235415_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_235415_task);
    
    if (futhark_mc_scan_stage_1_parloop_235415_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235415_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235415_total_end -
                 futhark_mc_scan_stage_1_parloop_235415_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235415_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235415_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235415_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_221033)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_221062;
        int64_t y_221063;
        int64_t offset_221065 = (int64_t) 0;
        int64_t offset_index_221066 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_221067_cached_sizze_235413 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_221067 =
                realloc(scan_stage_2_accum_mem_221067, (int64_t) 8);
            scan_stage_2_accum_mem_221067_cached_sizze_235413 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_221067)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_221069 = 0; i_221069 < num_tasks_221033 - 1;
             i_221069++) {
            offset_221065 = squot64(m_203489, sext_i32_i64(num_tasks_221033));
            if (slt64(sext_i32_i64(i_221069), srem64(m_203489,
                                                     sext_i32_i64(num_tasks_221033)))) {
                offset_221065 += (int64_t) 1;
            }
            offset_index_221066 += offset_221065;
            
            int64_t gtid_206861 = offset_index_221066;
            bool defunc_2_reduce_res_203548;
            int64_t flat_tid_206862 = (int64_t) 0;
            int32_t num_tasks_221070;
            
            defunc_2_reduce_res_203548 = 0;
            
            int64_t flat_tid_206868 = (int64_t) 0;
            struct futhark_mc_task_235430 futhark_mc_task_235430;
            
            futhark_mc_task_235430.ctx = ctx;
            futhark_mc_task_235430.free_n_203490 = n_203490;
            futhark_mc_task_235430.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235430.free_defunc_0_f_res_203510 =
                defunc_0_f_res_203510;
            futhark_mc_task_235430.free_gtid_206861 = gtid_206861;
            futhark_mc_task_235430.free_Y_mem_217285 = Y_mem_217285.mem;
            futhark_mc_task_235430.retval_defunc_2_reduce_res_203548 =
                &defunc_2_reduce_res_203548;
            
            struct scheduler_segop futhark_mc_task_235430_task;
            
            futhark_mc_task_235430_task.args = &futhark_mc_task_235430;
            futhark_mc_task_235430_task.top_level_fn =
                futhark_mc_segred_task_235431;
            futhark_mc_task_235430_task.name = "futhark_mc_segred_task_235431";
            futhark_mc_task_235430_task.iterations = n_p_203492;
            futhark_mc_task_235430_task.task_time =
                &ctx->futhark_mc_segred_task_235431_total_time;
            futhark_mc_task_235430_task.task_iter =
                &ctx->futhark_mc_segred_task_235431_total_iter;
            futhark_mc_task_235430_task.sched = STATIC;
            futhark_mc_task_235430_task.nested_fn =
                futhark_mc_segred_nested_task_235435;
            
            int futhark_mc_segred_task_235431_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235430_task);
            
            if (futhark_mc_segred_task_235431_err != 0) {
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t defunc_2_lifted_lambda_res_203567 =
                    btoi_bool_i64(defunc_2_reduce_res_203548);
            bool is_i_203568 = defunc_2_lifted_lambda_res_203567 == (int64_t) 0;
            bool cond_neg_203569 = !is_i_203568;
            int64_t part_res_203570 = btoi_bool_i64(cond_neg_203569);
            int64_t part_res_203571 = btoi_bool_i64(is_i_203568);
            
            // Read carry in
            {
                x_221062 =
                    ((int64_t *) scan_stage_2_accum_mem_221067)[(int64_t) 0];
            }
            // Read next values
            {
                y_221063 = ((int64_t *) mem_217288.mem)[offset_index_221066 -
                                                        (int64_t) 1];
            }
            
            int64_t zz_221064 = x_221062 + y_221063;
            
            ((int64_t *) mem_217288.mem)[offset_index_221066 - (int64_t) 1] =
                zz_221064;
            ((int64_t *) scan_stage_2_accum_mem_221067)[(int64_t) 0] =
                zz_221064;
        }
        
        int64_t iter_221100 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_235444
        futhark_mc_scan_stage_3_parloop_struct_235444;
        
        futhark_mc_scan_stage_3_parloop_struct_235444.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_235444.free_n_203490 = n_203490;
        futhark_mc_scan_stage_3_parloop_struct_235444.free_n_p_203492 =
            n_p_203492;
        futhark_mc_scan_stage_3_parloop_struct_235444.free_defunc_0_f_res_203510 =
            defunc_0_f_res_203510;
        futhark_mc_scan_stage_3_parloop_struct_235444.free_Y_mem_217285 =
            Y_mem_217285.mem;
        futhark_mc_scan_stage_3_parloop_struct_235444.free_mem_217288 =
            mem_217288.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_235445_task;
        
        futhark_mc_scan_stage_3_parloop_235445_task.name =
            "futhark_mc_scan_stage_3_parloop_235445";
        futhark_mc_scan_stage_3_parloop_235445_task.fn =
            futhark_mc_scan_stage_3_parloop_235445;
        futhark_mc_scan_stage_3_parloop_235445_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_235444;
        futhark_mc_scan_stage_3_parloop_235445_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_235445_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_235445_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_235445_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_235445_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_235445_task);
        
        if (futhark_mc_scan_stage_3_parloop_235445_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_235445_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_235445_total_end -
                     futhark_mc_scan_stage_3_parloop_235445_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235445_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235445_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235445_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_221067);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_235412_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_235412_end -
                 futhark_mc_segscan_task_235412_start;
        
        ctx->futhark_mc_segscan_task_235412_runs[tid]++;
        ctx->futhark_mc_segscan_task_235412_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_235412_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235460 {
    struct futhark_context *ctx;
    int64_t free_m_203489;
    int64_t free_n_203490;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_mem_217288;
    unsigned char *free_mem_217291;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217300;
};
struct futhark_mc_segmap_parloop_struct_235462 {
    struct futhark_context *ctx;
    int64_t free_m_203489;
    int64_t free_n_203490;
    unsigned char *free_Y_mem_217285;
    unsigned char *free_mem_217288;
    unsigned char *free_mem_217291;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217300;
};
static int futhark_mc_segmap_parloop_235463(void *args, int64_t start,
                                            int64_t end, int flat_tid_206890,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235462
    *futhark_mc_segmap_parloop_struct_235462 =
    (struct futhark_mc_segmap_parloop_struct_235462 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235462->ctx;
    uint64_t futhark_mc_segmap_parloop_235463_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235463_start = get_wall_time();
    
    int64_t m_203489 = futhark_mc_segmap_parloop_struct_235462->free_m_203489;
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235462->free_n_203490;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_segmap_parloop_struct_235462->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock mem_217288 = {.desc ="mem_217288", .mem =
                                  futhark_mc_segmap_parloop_struct_235462->free_mem_217288,
                                  .size =0, .references =NULL};
    struct memblock mem_217291 = {.desc ="mem_217291", .mem =
                                  futhark_mc_segmap_parloop_struct_235462->free_mem_217291,
                                  .size =0, .references =NULL};
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235462->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217300 = {.desc ="mem_217300", .mem =
                                  futhark_mc_segmap_parloop_struct_235462->free_mem_217300,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221129 = start;
    
    for (; iter_221129 < end; iter_221129++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221130 = m_203489;
        int64_t gtid_206891 = iter_221129;
        int64_t remnant_221131 = iter_221129 - gtid_206891;
        int64_t c_203583;
        
        c_203583 = ((int64_t *) mem_217291.mem)[gtid_206891];
        
        int64_t offset_203584;
        
        offset_203584 = ((int64_t *) mem_217288.mem)[gtid_206891];
        
        bool is_this_one_203588 = c_203583 == (int64_t) 0;
        int64_t this_offset_203589 = (int64_t) -1 + offset_203584;
        int64_t total_res_203590;
        
        if (is_this_one_203588) {
            total_res_203590 = this_offset_203589;
        } else {
            total_res_203590 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, total_res_203590) && slt64(total_res_203590,
                                                          m_203489)) {
            if (n_203490 * (int64_t) 8 > 0)
                memmove(mem_217297.mem + total_res_203590 * n_203490 *
                        (int64_t) 8, Y_mem_217285.mem + gtid_206891 * n_203490 *
                        (int64_t) 8, n_203490 * (int64_t) 8);
        }
        if (sle64((int64_t) 0, total_res_203590) && slt64(total_res_203590,
                                                          m_203489)) {
            ((int64_t *) mem_217300.mem)[total_res_203590] = gtid_206891;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235463_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235463_end -
                 futhark_mc_segmap_parloop_235463_start;
        
        ctx->futhark_mc_segmap_parloop_235463_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235463_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235463_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235461(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206890 = tid;
    int num_tasks_221128 = info.nsubtasks;
    struct futhark_mc_task_235460 *futhark_mc_task_235460 =
                                  (struct futhark_mc_task_235460 *) args;
    struct futhark_context *ctx = futhark_mc_task_235460->ctx;
    uint64_t futhark_mc_segmap_task_235461_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235461_start = get_wall_time();
    
    int64_t m_203489 = futhark_mc_task_235460->free_m_203489;
    int64_t n_203490 = futhark_mc_task_235460->free_n_203490;
    struct memblock Y_mem_217285 = {.desc ="Y_mem_217285", .mem =
                                    futhark_mc_task_235460->free_Y_mem_217285,
                                    .size =0, .references =NULL};
    struct memblock mem_217288 = {.desc ="mem_217288", .mem =
                                  futhark_mc_task_235460->free_mem_217288,
                                  .size =0, .references =NULL};
    struct memblock mem_217291 = {.desc ="mem_217291", .mem =
                                  futhark_mc_task_235460->free_mem_217291,
                                  .size =0, .references =NULL};
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235460->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217300 = {.desc ="mem_217300", .mem =
                                  futhark_mc_task_235460->free_mem_217300,
                                  .size =0, .references =NULL};
    int64_t iter_221129;
    struct futhark_mc_segmap_parloop_struct_235462
    futhark_mc_segmap_parloop_struct_235462;
    
    futhark_mc_segmap_parloop_struct_235462.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235462.free_m_203489 = m_203489;
    futhark_mc_segmap_parloop_struct_235462.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235462.free_Y_mem_217285 =
        Y_mem_217285.mem;
    futhark_mc_segmap_parloop_struct_235462.free_mem_217288 = mem_217288.mem;
    futhark_mc_segmap_parloop_struct_235462.free_mem_217291 = mem_217291.mem;
    futhark_mc_segmap_parloop_struct_235462.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235462.free_mem_217300 = mem_217300.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235463_task;
    
    futhark_mc_segmap_parloop_235463_task.name =
        "futhark_mc_segmap_parloop_235463";
    futhark_mc_segmap_parloop_235463_task.fn = futhark_mc_segmap_parloop_235463;
    futhark_mc_segmap_parloop_235463_task.args =
        &futhark_mc_segmap_parloop_struct_235462;
    futhark_mc_segmap_parloop_235463_task.iterations = iterations;
    futhark_mc_segmap_parloop_235463_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235463_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235463_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235463_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235463_task);
    
    if (futhark_mc_segmap_parloop_235463_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235463_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235463_total_end -
                 futhark_mc_segmap_parloop_235463_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235463_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235463_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235463_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235461_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235461_end -
                 futhark_mc_segmap_task_235461_start;
        
        ctx->futhark_mc_segmap_task_235461_runs[tid]++;
        ctx->futhark_mc_segmap_task_235461_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235461_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235464 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
};
struct futhark_mc_segmap_parloop_struct_235466 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
};
static int futhark_mc_segmap_parloop_235467(void *args, int64_t start,
                                            int64_t end, int flat_tid_206892,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235466
    *futhark_mc_segmap_parloop_struct_235466 =
    (struct futhark_mc_segmap_parloop_struct_235466 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235466->ctx;
    uint64_t futhark_mc_segmap_parloop_235467_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235467_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235466->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235466->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235466->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235466->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235466->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235466->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_235466->free_mem_217343,
                                  .size =0, .references =NULL};
    size_t mem_217309_cached_sizze_235468 = 0;
    unsigned char *mem_217309 = NULL;
    size_t mem_217324_cached_sizze_235469 = 0;
    unsigned char *mem_217324 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221133 = start;
    
    if (mem_217309_cached_sizze_235468 < (size_t) bytes_217302) {
        mem_217309 = realloc(mem_217309, bytes_217302);
        mem_217309_cached_sizze_235468 = bytes_217302;
    }
    if (mem_217324_cached_sizze_235469 < (size_t) bytes_217302) {
        mem_217324 = realloc(mem_217324, bytes_217302);
        mem_217324_cached_sizze_235469 = bytes_217302;
    }
    for (; iter_221133 < end; iter_221133++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221152 = partition_sizze_203577;
        int64_t gtid_206893 = iter_221133;
        int64_t remnant_221153 = iter_221133 - gtid_206893;
        int64_t discard_216030;
        int64_t scanacc_221135 = (int64_t) 0;
        
        for (int64_t i_221134 = 0; i_221134 < n_203490; i_221134++) {
            double x_221137;
            
            x_221137 = ((double *) mem_217297.mem)[gtid_206893 * n_203490 +
                                                   i_221134];
            
            bool isnan_res_221138;
            
            isnan_res_221138 = futrts_isnan64(x_221137);
            
            bool defunc_0_p_res_221139 = !isnan_res_221138;
            int64_t defunc_0_f_res_221140 =
                    btoi_bool_i64(defunc_0_p_res_221139);
            int64_t defunc_1_op_res_221141 = add64(defunc_0_f_res_221140,
                                                   scanacc_221135);
            
            ((int64_t *) mem_217309)[i_221134] = defunc_1_op_res_221141;
            
            int64_t scanacc_tmp_221154 = defunc_1_op_res_221141;
            
            scanacc_221135 = scanacc_tmp_221154;
        }
        discard_216030 = scanacc_221135;
        
        int64_t last_res_203686;
        
        last_res_203686 = ((int64_t *) mem_217309)[i_203670];
        for (int64_t i_221156 = 0; i_221156 < n_203490; i_221156++) {
            ((int64_t *) mem_217324)[i_221156] = (int64_t) -1;
        }
        for (int64_t write_iter_221143 = 0; write_iter_221143 < n_203490;
             write_iter_221143++) {
            double write_iv_221145;
            
            write_iv_221145 = ((double *) mem_217297.mem)[gtid_206893 *
                                                          n_203490 +
                                                          write_iter_221143];
            
            bool isnan_res_221146;
            
            isnan_res_221146 = futrts_isnan64(write_iv_221145);
            
            bool defunc_0_p_res_221147 = !isnan_res_221146;
            int64_t defunc_1_f_res_221148;
            
            if (defunc_0_p_res_221147) {
                int64_t write_iv_221149;
                
                write_iv_221149 = ((int64_t *) mem_217309)[write_iter_221143];
                
                int64_t defunc_1_f_res_t_res_221150 = sub64(write_iv_221149,
                                                            (int64_t) 1);
                
                defunc_1_f_res_221148 = defunc_1_f_res_t_res_221150;
            } else {
                defunc_1_f_res_221148 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_221148) &&
                slt64(defunc_1_f_res_221148, n_203490)) {
                ((int64_t *) mem_217324)[defunc_1_f_res_221148] =
                    write_iter_221143;
            }
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_217340.mem + gtid_206893 * n_203490 * (int64_t) 8,
                    mem_217324 + (int64_t) 0, n_203490 * (int64_t) 8);
        ((int64_t *) mem_217343.mem)[gtid_206893] = last_res_203686;
    }
    
  cleanup:
    { }
    free(mem_217309);
    free(mem_217324);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235467_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235467_end -
                 futhark_mc_segmap_parloop_235467_start;
        
        ctx->futhark_mc_segmap_parloop_235467_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235467_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235467_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235465(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206892 = tid;
    int num_tasks_221132 = info.nsubtasks;
    struct futhark_mc_task_235464 *futhark_mc_task_235464 =
                                  (struct futhark_mc_task_235464 *) args;
    struct futhark_context *ctx = futhark_mc_task_235464->ctx;
    uint64_t futhark_mc_segmap_task_235465_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235465_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235464->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235464->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_task_235464->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235464->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_235464->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235464->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_235464->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t iter_221133;
    struct futhark_mc_segmap_parloop_struct_235466
    futhark_mc_segmap_parloop_struct_235466;
    
    futhark_mc_segmap_parloop_struct_235466.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235466.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235466.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235466.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235466.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235466.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235466.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235466.free_mem_217343 = mem_217343.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235467_task;
    
    futhark_mc_segmap_parloop_235467_task.name =
        "futhark_mc_segmap_parloop_235467";
    futhark_mc_segmap_parloop_235467_task.fn = futhark_mc_segmap_parloop_235467;
    futhark_mc_segmap_parloop_235467_task.args =
        &futhark_mc_segmap_parloop_struct_235466;
    futhark_mc_segmap_parloop_235467_task.iterations = iterations;
    futhark_mc_segmap_parloop_235467_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235467_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235467_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235467_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235467_task);
    
    if (futhark_mc_segmap_parloop_235467_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235467_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235467_total_end -
                 futhark_mc_segmap_parloop_235467_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235467_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235467_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235467_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235465_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235465_end -
                 futhark_mc_segmap_task_235465_start;
        
        ctx->futhark_mc_segmap_task_235465_runs[tid]++;
        ctx->futhark_mc_segmap_task_235465_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235465_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235471 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
};
struct futhark_mc_task_235475 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_206901;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217303;
};
struct futhark_mc_scan_stage_1_parloop_struct_235478 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_206901;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217303;
};
static int futhark_mc_scan_stage_1_parloop_235479(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221159, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_235478
    *futhark_mc_scan_stage_1_parloop_struct_235478 =
    (struct futhark_mc_scan_stage_1_parloop_struct_235478 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_235478->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_235479_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235479_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_scan_stage_1_parloop_struct_235478->free_n_203490;
    int64_t gtid_206901 =
            futhark_mc_scan_stage_1_parloop_struct_235478->free_gtid_206901;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235478->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217303 = {.desc ="mem_217303", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235478->free_mem_217303,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221179 = start;
    int64_t x_221161;
    int64_t x_221162;
    
    x_221161 = (int64_t) 0;
    for (; iter_221179 < end; iter_221179++) {
        int64_t gtid_221160 = iter_221179;
        
        // stage 1 scan body
        {
            double x_221164;
            
            x_221164 = ((double *) mem_217297.mem)[gtid_206901 * n_203490 +
                                                   gtid_221160];
            
            bool isnan_res_221165;
            
            isnan_res_221165 = futrts_isnan64(x_221164);
            
            bool defunc_0_p_res_221166 = !isnan_res_221165;
            int64_t defunc_0_f_res_221167 =
                    btoi_bool_i64(defunc_0_p_res_221166);
            
            // write mapped values results to memory
            { }
            x_221161 = x_221161;
            // Read next values
            {
                x_221162 = defunc_0_f_res_221167;
            }
            
            int64_t defunc_1_op_res_221163 = add64(x_221161, x_221162);
            
            ((int64_t *) mem_217303.mem)[gtid_221160] = defunc_1_op_res_221163;
            x_221161 = defunc_1_op_res_221163;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235479_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235479_end -
                 futhark_mc_scan_stage_1_parloop_235479_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_235479_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_235479_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_235479_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_235480 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_206901;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217303;
};
static int futhark_mc_scan_stage_3_parloop_235481(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221159, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_235480
    *futhark_mc_scan_stage_3_parloop_struct_235480 =
    (struct futhark_mc_scan_stage_3_parloop_struct_235480 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_235480->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_235481_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_235481_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_scan_stage_3_parloop_struct_235480->free_n_203490;
    int64_t gtid_206901 =
            futhark_mc_scan_stage_3_parloop_struct_235480->free_gtid_206901;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235480->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217303 = {.desc ="mem_217303", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235480->free_mem_217303,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221191 = start;
    int64_t x_221188;
    int64_t x_221189;
    
    if (iter_221191 == (int64_t) 0) {
        x_221188 = (int64_t) 0;
    } else {
        x_221188 = ((int64_t *) mem_217303.mem)[iter_221191 - (int64_t) 1];
    }
    for (; iter_221191 < end; iter_221191++) {
        int64_t gtid_221160 = iter_221191;
        
        // stage 3 scan body
        {
            double x_221164;
            
            x_221164 = ((double *) mem_217297.mem)[gtid_206901 * n_203490 +
                                                   gtid_221160];
            
            bool isnan_res_221165;
            
            isnan_res_221165 = futrts_isnan64(x_221164);
            
            bool defunc_0_p_res_221166 = !isnan_res_221165;
            int64_t defunc_0_f_res_221167 =
                    btoi_bool_i64(defunc_0_p_res_221166);
            
            x_221188 = x_221188;
            x_221189 = defunc_0_f_res_221167;
            
            int64_t defunc_1_op_res_221190 = add64(x_221188, x_221189);
            
            ((int64_t *) mem_217303.mem)[gtid_221160] = defunc_1_op_res_221190;
            x_221188 = defunc_1_op_res_221190;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_235481_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_235481_end -
                 futhark_mc_scan_stage_3_parloop_235481_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_235481_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_235481_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_235481_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_235476(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221159 = tid;
    int num_tasks_221178 = info.nsubtasks;
    struct futhark_mc_task_235475 *futhark_mc_task_235475 =
                                  (struct futhark_mc_task_235475 *) args;
    struct futhark_context *ctx = futhark_mc_task_235475->ctx;
    uint64_t futhark_mc_segscan_task_235476_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_235476_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235475->free_n_203490;
    int64_t gtid_206901 = futhark_mc_task_235475->free_gtid_206901;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235475->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217303 = {.desc ="mem_217303", .mem =
                                  futhark_mc_task_235475->free_mem_217303,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_221185_cached_sizze_235477 = 0;
    unsigned char *scan_stage_2_accum_mem_221185 = NULL;
    int64_t iter_221179;
    struct futhark_mc_scan_stage_1_parloop_struct_235478
    futhark_mc_scan_stage_1_parloop_struct_235478;
    
    futhark_mc_scan_stage_1_parloop_struct_235478.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_235478.free_n_203490 = n_203490;
    futhark_mc_scan_stage_1_parloop_struct_235478.free_gtid_206901 =
        gtid_206901;
    futhark_mc_scan_stage_1_parloop_struct_235478.free_mem_217297 =
        mem_217297.mem;
    futhark_mc_scan_stage_1_parloop_struct_235478.free_mem_217303 =
        mem_217303.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_235479_task;
    
    futhark_mc_scan_stage_1_parloop_235479_task.name =
        "futhark_mc_scan_stage_1_parloop_235479";
    futhark_mc_scan_stage_1_parloop_235479_task.fn =
        futhark_mc_scan_stage_1_parloop_235479;
    futhark_mc_scan_stage_1_parloop_235479_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_235478;
    futhark_mc_scan_stage_1_parloop_235479_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_235479_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_235479_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235479_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_235479_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_235479_task);
    
    if (futhark_mc_scan_stage_1_parloop_235479_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235479_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235479_total_end -
                 futhark_mc_scan_stage_1_parloop_235479_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235479_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235479_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235479_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_221178)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_221180;
        int64_t x_221181;
        int64_t offset_221183 = (int64_t) 0;
        int64_t offset_index_221184 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_221185_cached_sizze_235477 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_221185 =
                realloc(scan_stage_2_accum_mem_221185, (int64_t) 8);
            scan_stage_2_accum_mem_221185_cached_sizze_235477 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_221185)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_221187 = 0; i_221187 < num_tasks_221178 - 1;
             i_221187++) {
            offset_221183 = squot64(n_203490, sext_i32_i64(num_tasks_221178));
            if (slt64(sext_i32_i64(i_221187), srem64(n_203490,
                                                     sext_i32_i64(num_tasks_221178)))) {
                offset_221183 += (int64_t) 1;
            }
            offset_index_221184 += offset_221183;
            
            int64_t gtid_221160 = offset_index_221184;
            double x_221164;
            
            x_221164 = ((double *) mem_217297.mem)[gtid_206901 * n_203490 +
                                                   gtid_221160];
            
            bool isnan_res_221165;
            
            isnan_res_221165 = futrts_isnan64(x_221164);
            
            bool defunc_0_p_res_221166 = !isnan_res_221165;
            int64_t defunc_0_f_res_221167 =
                    btoi_bool_i64(defunc_0_p_res_221166);
            
            // Read carry in
            {
                x_221180 =
                    ((int64_t *) scan_stage_2_accum_mem_221185)[(int64_t) 0];
            }
            // Read next values
            {
                x_221181 = ((int64_t *) mem_217303.mem)[offset_index_221184 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_221182 = add64(x_221180, x_221181);
            
            ((int64_t *) mem_217303.mem)[offset_index_221184 - (int64_t) 1] =
                defunc_1_op_res_221182;
            ((int64_t *) scan_stage_2_accum_mem_221185)[(int64_t) 0] =
                defunc_1_op_res_221182;
        }
        
        int64_t iter_221191 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_235480
        futhark_mc_scan_stage_3_parloop_struct_235480;
        
        futhark_mc_scan_stage_3_parloop_struct_235480.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_235480.free_n_203490 = n_203490;
        futhark_mc_scan_stage_3_parloop_struct_235480.free_gtid_206901 =
            gtid_206901;
        futhark_mc_scan_stage_3_parloop_struct_235480.free_mem_217297 =
            mem_217297.mem;
        futhark_mc_scan_stage_3_parloop_struct_235480.free_mem_217303 =
            mem_217303.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_235481_task;
        
        futhark_mc_scan_stage_3_parloop_235481_task.name =
            "futhark_mc_scan_stage_3_parloop_235481";
        futhark_mc_scan_stage_3_parloop_235481_task.fn =
            futhark_mc_scan_stage_3_parloop_235481;
        futhark_mc_scan_stage_3_parloop_235481_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_235480;
        futhark_mc_scan_stage_3_parloop_235481_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_235481_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_235481_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_235481_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_235481_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_235481_task);
        
        if (futhark_mc_scan_stage_3_parloop_235481_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_235481_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_235481_total_end -
                     futhark_mc_scan_stage_3_parloop_235481_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235481_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235481_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235481_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_221185);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_235476_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_235476_end -
                 futhark_mc_segscan_task_235476_start;
        
        ctx->futhark_mc_segscan_task_235476_runs[tid]++;
        ctx->futhark_mc_segscan_task_235476_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_235476_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235482 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_206901;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217303;
    unsigned char *free_mem_217306;
};
struct futhark_mc_segmap_parloop_struct_235484 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_206901;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217303;
    unsigned char *free_mem_217306;
};
static int futhark_mc_segmap_parloop_235485(void *args, int64_t start,
                                            int64_t end, int flat_tid_221168,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235484
    *futhark_mc_segmap_parloop_struct_235484 =
    (struct futhark_mc_segmap_parloop_struct_235484 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235484->ctx;
    uint64_t futhark_mc_segmap_parloop_235485_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235485_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235484->free_n_203490;
    int64_t gtid_206901 =
            futhark_mc_segmap_parloop_struct_235484->free_gtid_206901;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235484->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217303 = {.desc ="mem_217303", .mem =
                                  futhark_mc_segmap_parloop_struct_235484->free_mem_217303,
                                  .size =0, .references =NULL};
    struct memblock mem_217306 = {.desc ="mem_217306", .mem =
                                  futhark_mc_segmap_parloop_struct_235484->free_mem_217306,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221194 = start;
    
    for (; iter_221194 < end; iter_221194++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221197 = n_203490;
        int64_t gtid_221169 = iter_221194;
        int64_t remnant_221198 = iter_221194 - gtid_221169;
        double x_221170;
        
        x_221170 = ((double *) mem_217297.mem)[gtid_206901 * n_203490 +
                                               gtid_221169];
        
        bool isnan_res_221171;
        
        isnan_res_221171 = futrts_isnan64(x_221170);
        
        bool defunc_0_p_res_221172 = !isnan_res_221171;
        int64_t defunc_1_f_res_221173;
        
        if (defunc_0_p_res_221172) {
            int64_t x_221195;
            
            x_221195 = ((int64_t *) mem_217303.mem)[gtid_221169];
            
            int64_t defunc_1_f_res_t_res_221196 = sub64(x_221195, (int64_t) 1);
            
            defunc_1_f_res_221173 = defunc_1_f_res_t_res_221196;
        } else {
            defunc_1_f_res_221173 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_221173) &&
            slt64(defunc_1_f_res_221173, n_203490)) {
            ((int64_t *) mem_217306.mem)[defunc_1_f_res_221173] = gtid_221169;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235485_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235485_end -
                 futhark_mc_segmap_parloop_235485_start;
        
        ctx->futhark_mc_segmap_parloop_235485_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235485_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235485_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235483(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221168 = tid;
    int num_tasks_221193 = info.nsubtasks;
    struct futhark_mc_task_235482 *futhark_mc_task_235482 =
                                  (struct futhark_mc_task_235482 *) args;
    struct futhark_context *ctx = futhark_mc_task_235482->ctx;
    uint64_t futhark_mc_segmap_task_235483_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235483_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235482->free_n_203490;
    int64_t gtid_206901 = futhark_mc_task_235482->free_gtid_206901;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235482->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217303 = {.desc ="mem_217303", .mem =
                                  futhark_mc_task_235482->free_mem_217303,
                                  .size =0, .references =NULL};
    struct memblock mem_217306 = {.desc ="mem_217306", .mem =
                                  futhark_mc_task_235482->free_mem_217306,
                                  .size =0, .references =NULL};
    int64_t iter_221194;
    struct futhark_mc_segmap_parloop_struct_235484
    futhark_mc_segmap_parloop_struct_235484;
    
    futhark_mc_segmap_parloop_struct_235484.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235484.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235484.free_gtid_206901 = gtid_206901;
    futhark_mc_segmap_parloop_struct_235484.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235484.free_mem_217303 = mem_217303.mem;
    futhark_mc_segmap_parloop_struct_235484.free_mem_217306 = mem_217306.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235485_task;
    
    futhark_mc_segmap_parloop_235485_task.name =
        "futhark_mc_segmap_parloop_235485";
    futhark_mc_segmap_parloop_235485_task.fn = futhark_mc_segmap_parloop_235485;
    futhark_mc_segmap_parloop_235485_task.args =
        &futhark_mc_segmap_parloop_struct_235484;
    futhark_mc_segmap_parloop_235485_task.iterations = iterations;
    futhark_mc_segmap_parloop_235485_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235485_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235485_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235485_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235485_task);
    
    if (futhark_mc_segmap_parloop_235485_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235485_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235485_total_end -
                 futhark_mc_segmap_parloop_235485_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235485_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235485_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235485_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235483_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235483_end -
                 futhark_mc_segmap_task_235483_start;
        
        ctx->futhark_mc_segmap_task_235483_runs[tid]++;
        ctx->futhark_mc_segmap_task_235483_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235483_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235472(void *args, int64_t start,
                                            int64_t end, int flat_tid_206900,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235471
    *futhark_mc_segmap_parloop_struct_235471 =
    (struct futhark_mc_segmap_parloop_struct_235471 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235471->ctx;
    uint64_t futhark_mc_segmap_parloop_235472_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235472_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235471->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235471->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235471->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235471->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235471->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235471->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_235471->free_mem_217343,
                                  .size =0, .references =NULL};
    size_t mem_217303_cached_sizze_235473 = 0;
    unsigned char *mem_217303 = NULL;
    size_t mem_217306_cached_sizze_235474 = 0;
    unsigned char *mem_217306 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221158 = start;
    
    if (mem_217303_cached_sizze_235473 < (size_t) bytes_217302) {
        mem_217303 = realloc(mem_217303, bytes_217302);
        mem_217303_cached_sizze_235473 = bytes_217302;
    }
    if (mem_217306_cached_sizze_235474 < (size_t) bytes_217302) {
        mem_217306 = realloc(mem_217306, bytes_217302);
        mem_217306_cached_sizze_235474 = bytes_217302;
    }
    for (; iter_221158 < end; iter_221158++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221176 = partition_sizze_203577;
        int64_t gtid_206901 = iter_221158;
        int64_t remnant_221177 = iter_221158 - gtid_206901;
        int64_t flat_tid_221159 = (int64_t) 0;
        int32_t num_tasks_221178;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_235475 futhark_mc_task_235475;
        
        futhark_mc_task_235475.ctx = ctx;
        futhark_mc_task_235475.free_n_203490 = n_203490;
        futhark_mc_task_235475.free_gtid_206901 = gtid_206901;
        futhark_mc_task_235475.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_235475.free_mem_217303 = mem_217303;
        
        struct scheduler_segop futhark_mc_task_235475_task;
        
        futhark_mc_task_235475_task.args = &futhark_mc_task_235475;
        futhark_mc_task_235475_task.top_level_fn =
            futhark_mc_segscan_task_235476;
        futhark_mc_task_235475_task.name = "futhark_mc_segscan_task_235476";
        futhark_mc_task_235475_task.iterations = n_203490;
        futhark_mc_task_235475_task.task_time =
            &ctx->futhark_mc_segscan_task_235476_total_time;
        futhark_mc_task_235475_task.task_iter =
            &ctx->futhark_mc_segscan_task_235476_total_iter;
        futhark_mc_task_235475_task.sched = STATIC;
        futhark_mc_task_235475_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_235476_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235475_task);
        
        if (futhark_mc_segscan_task_235476_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_206913;
        
        last_res_206913 = ((int64_t *) mem_217303)[i_203670];
        for (int64_t i_221192 = 0; i_221192 < n_203490; i_221192++) {
            ((int64_t *) mem_217306)[i_221192] = (int64_t) -1;
        }
        
        int64_t flat_tid_221168 = (int64_t) 0;
        int32_t num_tasks_221193;
        struct futhark_mc_task_235482 futhark_mc_task_235482;
        
        futhark_mc_task_235482.ctx = ctx;
        futhark_mc_task_235482.free_n_203490 = n_203490;
        futhark_mc_task_235482.free_gtid_206901 = gtid_206901;
        futhark_mc_task_235482.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_235482.free_mem_217303 = mem_217303;
        futhark_mc_task_235482.free_mem_217306 = mem_217306;
        
        struct scheduler_segop futhark_mc_task_235482_task;
        
        futhark_mc_task_235482_task.args = &futhark_mc_task_235482;
        futhark_mc_task_235482_task.top_level_fn =
            futhark_mc_segmap_task_235483;
        futhark_mc_task_235482_task.name = "futhark_mc_segmap_task_235483";
        futhark_mc_task_235482_task.iterations = n_203490;
        futhark_mc_task_235482_task.task_time =
            &ctx->futhark_mc_segmap_task_235483_total_time;
        futhark_mc_task_235482_task.task_iter =
            &ctx->futhark_mc_segmap_task_235483_total_iter;
        futhark_mc_task_235482_task.sched = STATIC;
        futhark_mc_task_235482_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235483_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235482_task);
        
        if (futhark_mc_segmap_task_235483_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_217340.mem + gtid_206901 * n_203490 * (int64_t) 8,
                    mem_217306 + (int64_t) 0, n_203490 * (int64_t) 8);
        ((int64_t *) mem_217343.mem)[gtid_206901] = last_res_206913;
    }
    
  cleanup:
    { }
    free(mem_217303);
    free(mem_217306);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235472_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235472_end -
                 futhark_mc_segmap_parloop_235472_start;
        
        ctx->futhark_mc_segmap_parloop_235472_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235472_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235472_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235470(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206900 = tid;
    int num_tasks_221132 = info.nsubtasks;
    struct futhark_mc_task_235464 *futhark_mc_task_235464 =
                                  (struct futhark_mc_task_235464 *) args;
    struct futhark_context *ctx = futhark_mc_task_235464->ctx;
    uint64_t futhark_mc_segmap_nested_task_235470_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235470_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235464->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235464->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_task_235464->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235464->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_235464->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235464->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_235464->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t iter_221158;
    struct futhark_mc_segmap_parloop_struct_235471
    futhark_mc_segmap_parloop_struct_235471;
    
    futhark_mc_segmap_parloop_struct_235471.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235471.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235471.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235471.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235471.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235471.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235471.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235471.free_mem_217343 = mem_217343.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235472_task;
    
    futhark_mc_segmap_parloop_235472_task.name =
        "futhark_mc_segmap_parloop_235472";
    futhark_mc_segmap_parloop_235472_task.fn = futhark_mc_segmap_parloop_235472;
    futhark_mc_segmap_parloop_235472_task.args =
        &futhark_mc_segmap_parloop_struct_235471;
    futhark_mc_segmap_parloop_235472_task.iterations = iterations;
    futhark_mc_segmap_parloop_235472_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235472_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235472_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235472_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235472_task);
    
    if (futhark_mc_segmap_parloop_235472_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235472_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235472_total_end -
                 futhark_mc_segmap_parloop_235472_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235472_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235472_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235472_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235470_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235470_end -
                 futhark_mc_segmap_nested_task_235470_start;
        
        ctx->futhark_mc_segmap_nested_task_235470_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235470_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235470_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235486 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217345;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217414;
};
struct futhark_mc_segmap_parloop_struct_235488 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217414;
};
static int futhark_mc_segmap_parloop_235489(void *args, int64_t start,
                                            int64_t end, int flat_tid_206925,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235488
    *futhark_mc_segmap_parloop_struct_235488 =
    (struct futhark_mc_segmap_parloop_struct_235488 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235488->ctx;
    uint64_t futhark_mc_segmap_parloop_235489_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235489_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235488->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235488->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235488->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235488->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235488->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235488->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217364 =
            futhark_mc_segmap_parloop_struct_235488->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_segmap_parloop_struct_235488->free_mem_217414,
                                  .size =0, .references =NULL};
    size_t mem_217369_cached_sizze_235490 = 0;
    unsigned char *mem_217369 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221200 = start;
    
    if (mem_217369_cached_sizze_235490 < (size_t) bytes_217364) {
        mem_217369 = realloc(mem_217369, bytes_217364);
        mem_217369_cached_sizze_235490 = bytes_217364;
    }
    for (; iter_221200 < end; iter_221200++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221216 = partition_sizze_203577;
        int64_t gtid_206926 = iter_221200;
        int64_t remnant_221217 = iter_221200 - gtid_206926;
        
        for (int64_t i_221201 = 0; i_221201 < n_p_203492; i_221201++) {
            for (int64_t i_221204 = 0; i_221204 < defunc_0_f_res_203631;
                 i_221204++) {
                int64_t y_221206 = mul64(n_p_203492, i_221204);
                int64_t new_i_221207 = add64(y_221206, i_221201);
                bool cond_221208 = slt64(i_203670, new_i_221207);
                double defunc_0_f_res_221209;
                
                if (cond_221208) {
                    defunc_0_f_res_221209 = NAN;
                } else {
                    bool x_221210 = sle64((int64_t) 0, new_i_221207);
                    bool y_221211 = slt64(new_i_221207, n_203490);
                    bool bounds_check_221212 = x_221210 && y_221211;
                    bool index_certs_221213;
                    
                    if (!bounds_check_221212) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) new_i_221207,
                                      "] out of bounds for array of shape [",
                                      (long long) n_203490, "].",
                                      "-> #0  stl.fut:124:33-40\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  stl.fut:119:20-125:36\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:117:12-126:20\n   #9  stl.fut:116:5-127:11\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    double defunc_0_f_res_f_res_221214;
                    
                    defunc_0_f_res_f_res_221214 =
                        ((double *) mem_217297.mem)[gtid_206926 * n_203490 +
                                                    new_i_221207];
                    defunc_0_f_res_221209 = defunc_0_f_res_f_res_221214;
                }
                ((double *) mem_217369)[i_221201 * defunc_0_f_res_203631 +
                                        i_221204] = defunc_0_f_res_221209;
            }
        }
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217414.mem + gtid_206926 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217369 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217369);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235489_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235489_end -
                 futhark_mc_segmap_parloop_235489_start;
        
        ctx->futhark_mc_segmap_parloop_235489_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235489_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235489_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235487(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206925 = tid;
    int num_tasks_221199 = info.nsubtasks;
    struct futhark_mc_task_235486 *futhark_mc_task_235486 =
                                  (struct futhark_mc_task_235486 *) args;
    struct futhark_context *ctx = futhark_mc_task_235486->ctx;
    uint64_t futhark_mc_segmap_task_235487_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235487_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235486->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235486->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235486->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235486->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235486->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235486->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217345 = futhark_mc_task_235486->free_bytes_217345;
    int64_t bytes_217364 = futhark_mc_task_235486->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235486->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t iter_221200;
    struct futhark_mc_segmap_parloop_struct_235488
    futhark_mc_segmap_parloop_struct_235488;
    
    futhark_mc_segmap_parloop_struct_235488.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235488.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235488.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235488.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235488.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235488.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235488.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235488.free_bytes_217364 = bytes_217364;
    futhark_mc_segmap_parloop_struct_235488.free_mem_217414 = mem_217414.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235489_task;
    
    futhark_mc_segmap_parloop_235489_task.name =
        "futhark_mc_segmap_parloop_235489";
    futhark_mc_segmap_parloop_235489_task.fn = futhark_mc_segmap_parloop_235489;
    futhark_mc_segmap_parloop_235489_task.args =
        &futhark_mc_segmap_parloop_struct_235488;
    futhark_mc_segmap_parloop_235489_task.iterations = iterations;
    futhark_mc_segmap_parloop_235489_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235489_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235489_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235489_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235489_task);
    
    if (futhark_mc_segmap_parloop_235489_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235489_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235489_total_end -
                 futhark_mc_segmap_parloop_235489_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235489_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235489_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235489_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235487_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235487_end -
                 futhark_mc_segmap_task_235487_start;
        
        ctx->futhark_mc_segmap_task_235487_runs[tid]++;
        ctx->futhark_mc_segmap_task_235487_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235487_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235492 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217345;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217414;
};
struct futhark_mc_task_235495 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_206952;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217365;
};
struct futhark_mc_segmap_parloop_struct_235497 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_206952;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217365;
};
static int futhark_mc_segmap_parloop_235498(void *args, int64_t start,
                                            int64_t end, int flat_tid_221236,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235497
    *futhark_mc_segmap_parloop_struct_235497 =
    (struct futhark_mc_segmap_parloop_struct_235497 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235497->ctx;
    uint64_t futhark_mc_segmap_parloop_235498_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235498_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235497->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235497->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235497->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235497->free_i_203670;
    int64_t gtid_206952 =
            futhark_mc_segmap_parloop_struct_235497->free_gtid_206952;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235497->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235497->free_bytes_217345;
    struct memblock mem_217365 = {.desc ="mem_217365", .mem =
                                  futhark_mc_segmap_parloop_struct_235497->free_mem_217365,
                                  .size =0, .references =NULL};
    size_t mem_221238_cached_sizze_235499 = 0;
    unsigned char *mem_221238 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221256 = start;
    
    if (mem_221238_cached_sizze_235499 < (size_t) bytes_217345) {
        mem_221238 = realloc(mem_221238, bytes_217345);
        mem_221238_cached_sizze_235499 = bytes_217345;
    }
    for (; iter_221256 < end; iter_221256++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221269 = n_p_203492;
        int64_t gtid_221237 = iter_221256;
        int64_t remnant_221270 = iter_221256 - gtid_221237;
        
        for (int64_t i_221257 = 0; i_221257 < defunc_0_f_res_203631;
             i_221257++) {
            int64_t y_221259 = mul64(n_p_203492, i_221257);
            int64_t new_i_221260 = add64(gtid_221237, y_221259);
            bool cond_221261 = slt64(i_203670, new_i_221260);
            double defunc_0_f_res_221262;
            
            if (cond_221261) {
                defunc_0_f_res_221262 = NAN;
            } else {
                bool x_221263 = sle64((int64_t) 0, new_i_221260);
                bool y_221264 = slt64(new_i_221260, n_203490);
                bool bounds_check_221265 = x_221263 && y_221264;
                bool index_certs_221266;
                
                if (!bounds_check_221265) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) new_i_221260,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  stl.fut:124:33-40\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  stl.fut:119:20-125:36\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:117:12-126:20\n   #9  stl.fut:116:5-127:11\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_f_res_221267;
                
                defunc_0_f_res_f_res_221267 =
                    ((double *) mem_217297.mem)[gtid_206952 * n_203490 +
                                                new_i_221260];
                defunc_0_f_res_221262 = defunc_0_f_res_f_res_221267;
            }
            ((double *) mem_221238)[i_221257] = defunc_0_f_res_221262;
        }
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217365.mem + gtid_221237 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_221238 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221238);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235498_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235498_end -
                 futhark_mc_segmap_parloop_235498_start;
        
        ctx->futhark_mc_segmap_parloop_235498_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235498_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235498_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235496(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221236 = tid;
    int num_tasks_221255 = info.nsubtasks;
    struct futhark_mc_task_235495 *futhark_mc_task_235495 =
                                  (struct futhark_mc_task_235495 *) args;
    struct futhark_context *ctx = futhark_mc_task_235495->ctx;
    uint64_t futhark_mc_segmap_task_235496_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235496_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235495->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235495->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235495->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235495->free_i_203670;
    int64_t gtid_206952 = futhark_mc_task_235495->free_gtid_206952;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235495->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217345 = futhark_mc_task_235495->free_bytes_217345;
    struct memblock mem_217365 = {.desc ="mem_217365", .mem =
                                  futhark_mc_task_235495->free_mem_217365,
                                  .size =0, .references =NULL};
    int64_t iter_221256;
    struct futhark_mc_segmap_parloop_struct_235497
    futhark_mc_segmap_parloop_struct_235497;
    
    futhark_mc_segmap_parloop_struct_235497.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235497.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235497.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235497.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235497.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235497.free_gtid_206952 = gtid_206952;
    futhark_mc_segmap_parloop_struct_235497.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235497.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235497.free_mem_217365 = mem_217365.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235498_task;
    
    futhark_mc_segmap_parloop_235498_task.name =
        "futhark_mc_segmap_parloop_235498";
    futhark_mc_segmap_parloop_235498_task.fn = futhark_mc_segmap_parloop_235498;
    futhark_mc_segmap_parloop_235498_task.args =
        &futhark_mc_segmap_parloop_struct_235497;
    futhark_mc_segmap_parloop_235498_task.iterations = iterations;
    futhark_mc_segmap_parloop_235498_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235498_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235498_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235498_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235498_task);
    
    if (futhark_mc_segmap_parloop_235498_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235498_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235498_total_end -
                 futhark_mc_segmap_parloop_235498_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235498_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235498_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235498_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235496_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235496_end -
                 futhark_mc_segmap_task_235496_start;
        
        ctx->futhark_mc_segmap_task_235496_runs[tid]++;
        ctx->futhark_mc_segmap_task_235496_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235496_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235501 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_206952;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217365;
};
struct futhark_mc_task_235504 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_206952;
    unsigned char *free_mem_217297;
    int64_t free_gtid_221222;
    unsigned char *free_mem_221223;
};
struct futhark_mc_segmap_parloop_struct_235506 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_206952;
    unsigned char *free_mem_217297;
    int64_t free_gtid_221222;
    unsigned char *free_mem_221223;
};
static int futhark_mc_segmap_parloop_235507(void *args, int64_t start,
                                            int64_t end, int flat_tid_221273,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235506
    *futhark_mc_segmap_parloop_struct_235506 =
    (struct futhark_mc_segmap_parloop_struct_235506 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235506->ctx;
    uint64_t futhark_mc_segmap_parloop_235507_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235507_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235506->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235506->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235506->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235506->free_i_203670;
    int64_t gtid_206952 =
            futhark_mc_segmap_parloop_struct_235506->free_gtid_206952;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235506->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t gtid_221222 =
            futhark_mc_segmap_parloop_struct_235506->free_gtid_221222;
    struct memblock mem_221223 = {.desc ="mem_221223", .mem =
                                  futhark_mc_segmap_parloop_struct_235506->free_mem_221223,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221287 = start;
    
    for (; iter_221287 < end; iter_221287++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221293 = defunc_0_f_res_203631;
        int64_t gtid_221274 = iter_221287;
        int64_t remnant_221294 = iter_221287 - gtid_221274;
        int64_t y_221275 = mul64(n_p_203492, gtid_221274);
        int64_t new_i_221276 = add64(gtid_221222, y_221275);
        bool cond_221277 = slt64(i_203670, new_i_221276);
        double defunc_0_f_res_221278;
        
        if (cond_221277) {
            defunc_0_f_res_221278 = NAN;
        } else {
            bool x_221288 = sle64((int64_t) 0, new_i_221276);
            bool y_221289 = slt64(new_i_221276, n_203490);
            bool bounds_check_221290 = x_221288 && y_221289;
            bool index_certs_221291;
            
            if (!bounds_check_221290) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) new_i_221276,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  stl.fut:124:33-40\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  stl.fut:119:20-125:36\n   #5  /prelude/soacs.fut:59:3-10\n   #6  /prelude/array.fut:195:3-17\n   #7  utils.fut:6:3-16\n   #8  stl.fut:117:12-126:20\n   #9  stl.fut:116:5-127:11\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_f_res_221292;
            
            defunc_0_f_res_f_res_221292 =
                ((double *) mem_217297.mem)[gtid_206952 * n_203490 +
                                            new_i_221276];
            defunc_0_f_res_221278 = defunc_0_f_res_f_res_221292;
        }
        ((double *) mem_221223.mem)[gtid_221274] = defunc_0_f_res_221278;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235507_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235507_end -
                 futhark_mc_segmap_parloop_235507_start;
        
        ctx->futhark_mc_segmap_parloop_235507_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235507_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235507_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235505(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221273 = tid;
    int num_tasks_221286 = info.nsubtasks;
    struct futhark_mc_task_235504 *futhark_mc_task_235504 =
                                  (struct futhark_mc_task_235504 *) args;
    struct futhark_context *ctx = futhark_mc_task_235504->ctx;
    uint64_t futhark_mc_segmap_task_235505_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235505_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235504->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235504->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235504->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235504->free_i_203670;
    int64_t gtid_206952 = futhark_mc_task_235504->free_gtid_206952;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235504->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t gtid_221222 = futhark_mc_task_235504->free_gtid_221222;
    struct memblock mem_221223 = {.desc ="mem_221223", .mem =
                                  futhark_mc_task_235504->free_mem_221223,
                                  .size =0, .references =NULL};
    int64_t iter_221287;
    struct futhark_mc_segmap_parloop_struct_235506
    futhark_mc_segmap_parloop_struct_235506;
    
    futhark_mc_segmap_parloop_struct_235506.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235506.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235506.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235506.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235506.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235506.free_gtid_206952 = gtid_206952;
    futhark_mc_segmap_parloop_struct_235506.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235506.free_gtid_221222 = gtid_221222;
    futhark_mc_segmap_parloop_struct_235506.free_mem_221223 = mem_221223.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235507_task;
    
    futhark_mc_segmap_parloop_235507_task.name =
        "futhark_mc_segmap_parloop_235507";
    futhark_mc_segmap_parloop_235507_task.fn = futhark_mc_segmap_parloop_235507;
    futhark_mc_segmap_parloop_235507_task.args =
        &futhark_mc_segmap_parloop_struct_235506;
    futhark_mc_segmap_parloop_235507_task.iterations = iterations;
    futhark_mc_segmap_parloop_235507_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235507_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235507_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235507_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235507_task);
    
    if (futhark_mc_segmap_parloop_235507_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235507_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235507_total_end -
                 futhark_mc_segmap_parloop_235507_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235507_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235507_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235507_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235505_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235505_end -
                 futhark_mc_segmap_task_235505_start;
        
        ctx->futhark_mc_segmap_task_235505_runs[tid]++;
        ctx->futhark_mc_segmap_task_235505_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235505_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235502(void *args, int64_t start,
                                            int64_t end, int flat_tid_221221,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235501
    *futhark_mc_segmap_parloop_struct_235501 =
    (struct futhark_mc_segmap_parloop_struct_235501 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235501->ctx;
    uint64_t futhark_mc_segmap_parloop_235502_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235502_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235501->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235501->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235501->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235501->free_i_203670;
    int64_t gtid_206952 =
            futhark_mc_segmap_parloop_struct_235501->free_gtid_206952;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235501->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235501->free_bytes_217345;
    struct memblock mem_217365 = {.desc ="mem_217365", .mem =
                                  futhark_mc_segmap_parloop_struct_235501->free_mem_217365,
                                  .size =0, .references =NULL};
    size_t mem_221223_cached_sizze_235503 = 0;
    unsigned char *mem_221223 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221272 = start;
    
    if (mem_221223_cached_sizze_235503 < (size_t) bytes_217345) {
        mem_221223 = realloc(mem_221223, bytes_217345);
        mem_221223_cached_sizze_235503 = bytes_217345;
    }
    for (; iter_221272 < end; iter_221272++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221284 = n_p_203492;
        int64_t gtid_221222 = iter_221272;
        int64_t remnant_221285 = iter_221272 - gtid_221222;
        int64_t flat_tid_221273 = (int64_t) 0;
        int32_t num_tasks_221286;
        struct futhark_mc_task_235504 futhark_mc_task_235504;
        
        futhark_mc_task_235504.ctx = ctx;
        futhark_mc_task_235504.free_n_203490 = n_203490;
        futhark_mc_task_235504.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235504.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235504.free_i_203670 = i_203670;
        futhark_mc_task_235504.free_gtid_206952 = gtid_206952;
        futhark_mc_task_235504.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_235504.free_gtid_221222 = gtid_221222;
        futhark_mc_task_235504.free_mem_221223 = mem_221223;
        
        struct scheduler_segop futhark_mc_task_235504_task;
        
        futhark_mc_task_235504_task.args = &futhark_mc_task_235504;
        futhark_mc_task_235504_task.top_level_fn =
            futhark_mc_segmap_task_235505;
        futhark_mc_task_235504_task.name = "futhark_mc_segmap_task_235505";
        futhark_mc_task_235504_task.iterations = defunc_0_f_res_203631;
        futhark_mc_task_235504_task.task_time =
            &ctx->futhark_mc_segmap_task_235505_total_time;
        futhark_mc_task_235504_task.task_iter =
            &ctx->futhark_mc_segmap_task_235505_total_iter;
        futhark_mc_task_235504_task.sched = STATIC;
        futhark_mc_task_235504_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235505_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235504_task);
        
        if (futhark_mc_segmap_task_235505_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217365.mem + gtid_221222 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_221223 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221223);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235502_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235502_end -
                 futhark_mc_segmap_parloop_235502_start;
        
        ctx->futhark_mc_segmap_parloop_235502_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235502_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235502_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235500(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221221 = tid;
    int num_tasks_221255 = info.nsubtasks;
    struct futhark_mc_task_235495 *futhark_mc_task_235495 =
                                  (struct futhark_mc_task_235495 *) args;
    struct futhark_context *ctx = futhark_mc_task_235495->ctx;
    uint64_t futhark_mc_segmap_nested_task_235500_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235500_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235495->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235495->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235495->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235495->free_i_203670;
    int64_t gtid_206952 = futhark_mc_task_235495->free_gtid_206952;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235495->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217345 = futhark_mc_task_235495->free_bytes_217345;
    struct memblock mem_217365 = {.desc ="mem_217365", .mem =
                                  futhark_mc_task_235495->free_mem_217365,
                                  .size =0, .references =NULL};
    int64_t iter_221272;
    struct futhark_mc_segmap_parloop_struct_235501
    futhark_mc_segmap_parloop_struct_235501;
    
    futhark_mc_segmap_parloop_struct_235501.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235501.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235501.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235501.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235501.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235501.free_gtid_206952 = gtid_206952;
    futhark_mc_segmap_parloop_struct_235501.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235501.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235501.free_mem_217365 = mem_217365.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235502_task;
    
    futhark_mc_segmap_parloop_235502_task.name =
        "futhark_mc_segmap_parloop_235502";
    futhark_mc_segmap_parloop_235502_task.fn = futhark_mc_segmap_parloop_235502;
    futhark_mc_segmap_parloop_235502_task.args =
        &futhark_mc_segmap_parloop_struct_235501;
    futhark_mc_segmap_parloop_235502_task.iterations = iterations;
    futhark_mc_segmap_parloop_235502_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235502_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235502_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235502_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235502_task);
    
    if (futhark_mc_segmap_parloop_235502_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235502_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235502_total_end -
                 futhark_mc_segmap_parloop_235502_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235502_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235502_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235502_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235500_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235500_end -
                 futhark_mc_segmap_nested_task_235500_start;
        
        ctx->futhark_mc_segmap_nested_task_235500_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235500_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235500_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235493(void *args, int64_t start,
                                            int64_t end, int flat_tid_206951,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235492
    *futhark_mc_segmap_parloop_struct_235492 =
    (struct futhark_mc_segmap_parloop_struct_235492 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235492->ctx;
    uint64_t futhark_mc_segmap_parloop_235493_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235493_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235492->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235492->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235492->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235492->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235492->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235492->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235492->free_bytes_217345;
    int64_t bytes_217364 =
            futhark_mc_segmap_parloop_struct_235492->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_segmap_parloop_struct_235492->free_mem_217414,
                                  .size =0, .references =NULL};
    size_t mem_217365_cached_sizze_235494 = 0;
    unsigned char *mem_217365 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221220 = start;
    
    if (mem_217365_cached_sizze_235494 < (size_t) bytes_217364) {
        mem_217365 = realloc(mem_217365, bytes_217364);
        mem_217365_cached_sizze_235494 = bytes_217364;
    }
    for (; iter_221220 < end; iter_221220++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221253 = partition_sizze_203577;
        int64_t gtid_206952 = iter_221220;
        int64_t remnant_221254 = iter_221220 - gtid_206952;
        int64_t flat_tid_221236 = (int64_t) 0;
        int32_t num_tasks_221255;
        int64_t flat_tid_221221 = (int64_t) 0;
        struct futhark_mc_task_235495 futhark_mc_task_235495;
        
        futhark_mc_task_235495.ctx = ctx;
        futhark_mc_task_235495.free_n_203490 = n_203490;
        futhark_mc_task_235495.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235495.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235495.free_i_203670 = i_203670;
        futhark_mc_task_235495.free_gtid_206952 = gtid_206952;
        futhark_mc_task_235495.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_235495.free_bytes_217345 = bytes_217345;
        futhark_mc_task_235495.free_mem_217365 = mem_217365;
        
        struct scheduler_segop futhark_mc_task_235495_task;
        
        futhark_mc_task_235495_task.args = &futhark_mc_task_235495;
        futhark_mc_task_235495_task.top_level_fn =
            futhark_mc_segmap_task_235496;
        futhark_mc_task_235495_task.name = "futhark_mc_segmap_task_235496";
        futhark_mc_task_235495_task.iterations = n_p_203492;
        futhark_mc_task_235495_task.task_time =
            &ctx->futhark_mc_segmap_task_235496_total_time;
        futhark_mc_task_235495_task.task_iter =
            &ctx->futhark_mc_segmap_task_235496_total_iter;
        futhark_mc_task_235495_task.sched = STATIC;
        futhark_mc_task_235495_task.nested_fn =
            futhark_mc_segmap_nested_task_235500;
        
        int futhark_mc_segmap_task_235496_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235495_task);
        
        if (futhark_mc_segmap_task_235496_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217414.mem + gtid_206952 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217365 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217365);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235493_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235493_end -
                 futhark_mc_segmap_parloop_235493_start;
        
        ctx->futhark_mc_segmap_parloop_235493_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235493_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235493_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235491(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206951 = tid;
    int num_tasks_221199 = info.nsubtasks;
    struct futhark_mc_task_235486 *futhark_mc_task_235486 =
                                  (struct futhark_mc_task_235486 *) args;
    struct futhark_context *ctx = futhark_mc_task_235486->ctx;
    uint64_t futhark_mc_segmap_nested_task_235491_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235491_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235486->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235486->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235486->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235486->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235486->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235486->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217345 = futhark_mc_task_235486->free_bytes_217345;
    int64_t bytes_217364 = futhark_mc_task_235486->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235486->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t iter_221220;
    struct futhark_mc_segmap_parloop_struct_235492
    futhark_mc_segmap_parloop_struct_235492;
    
    futhark_mc_segmap_parloop_struct_235492.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235492.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235492.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235492.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235492.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235492.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235492.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235492.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235492.free_bytes_217364 = bytes_217364;
    futhark_mc_segmap_parloop_struct_235492.free_mem_217414 = mem_217414.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235493_task;
    
    futhark_mc_segmap_parloop_235493_task.name =
        "futhark_mc_segmap_parloop_235493";
    futhark_mc_segmap_parloop_235493_task.fn = futhark_mc_segmap_parloop_235493;
    futhark_mc_segmap_parloop_235493_task.args =
        &futhark_mc_segmap_parloop_struct_235492;
    futhark_mc_segmap_parloop_235493_task.iterations = iterations;
    futhark_mc_segmap_parloop_235493_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235493_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235493_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235493_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235493_task);
    
    if (futhark_mc_segmap_parloop_235493_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235493_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235493_total_end -
                 futhark_mc_segmap_parloop_235493_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235493_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235493_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235493_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235491_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235491_end -
                 futhark_mc_segmap_nested_task_235491_start;
        
        ctx->futhark_mc_segmap_nested_task_235491_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235491_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235491_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235508 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203718;
    int64_t free_bytes_217345;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217414;
    int64_t free_bytes_217456;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
};
struct futhark_mc_segmap_parloop_struct_235510 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203718;
    int64_t free_bytes_217345;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217414;
    int64_t free_bytes_217456;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
};
static int futhark_mc_segmap_parloop_235511(void *args, int64_t start,
                                            int64_t end, int flat_tid_206985,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235510
    *futhark_mc_segmap_parloop_struct_235510 =
    (struct futhark_mc_segmap_parloop_struct_235510 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235510->ctx;
    uint64_t futhark_mc_segmap_parloop_235511_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235511_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235510->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235510->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235510->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235510->free_i_203718;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235510->free_bytes_217345;
    int64_t bytes_217364 =
            futhark_mc_segmap_parloop_struct_235510->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_segmap_parloop_struct_235510->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t bytes_217456 =
            futhark_mc_segmap_parloop_struct_235510->free_bytes_217456;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235510->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235510->free_mem_217540,
                                  .size =0, .references =NULL};
    size_t mem_217461_cached_sizze_235512 = 0;
    unsigned char *mem_217461 = NULL;
    size_t mem_217464_cached_sizze_235513 = 0;
    unsigned char *mem_217464 = NULL;
    size_t mem_217484_cached_sizze_235514 = 0;
    unsigned char *mem_217484 = NULL;
    size_t mem_217499_cached_sizze_235515 = 0;
    unsigned char *mem_217499 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221296 = start;
    
    if (mem_217461_cached_sizze_235512 < (size_t) bytes_217364) {
        mem_217461 = realloc(mem_217461, bytes_217364);
        mem_217461_cached_sizze_235512 = bytes_217364;
    }
    if (mem_217464_cached_sizze_235513 < (size_t) bytes_217456) {
        mem_217464 = realloc(mem_217464, bytes_217456);
        mem_217464_cached_sizze_235513 = bytes_217456;
    }
    if (mem_217484_cached_sizze_235514 < (size_t) bytes_217345) {
        mem_217484 = realloc(mem_217484, bytes_217345);
        mem_217484_cached_sizze_235514 = bytes_217345;
    }
    if (mem_217499_cached_sizze_235515 < (size_t) bytes_217345) {
        mem_217499 = realloc(mem_217499, bytes_217345);
        mem_217499_cached_sizze_235515 = bytes_217345;
    }
    for (; iter_221296 < end; iter_221296++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221325 = partition_sizze_203577;
        int64_t gtid_206986 = iter_221296;
        int64_t remnant_221326 = iter_221296 - gtid_206986;
        
        for (int64_t i_221327 = 0; i_221327 < defunc_0_f_res_203631;
             i_221327++) {
            ((int64_t *) mem_217499)[i_221327] = (int64_t) -1;
        }
        for (int64_t i_221297 = 0; i_221297 < n_p_203492; i_221297++) {
            int64_t discard_221301;
            int64_t scanacc_221304 = (int64_t) 0;
            
            for (int64_t i_221303 = 0; i_221303 < defunc_0_f_res_203631;
                 i_221303++) {
                double x_221306;
                
                x_221306 = ((double *) mem_217414.mem)[gtid_206986 *
                                                       (defunc_0_f_res_203631 *
                                                        n_p_203492) + i_221297 *
                                                       defunc_0_f_res_203631 +
                                                       i_221303];
                
                bool isnan_res_221307;
                
                isnan_res_221307 = futrts_isnan64(x_221306);
                
                bool defunc_0_p_res_221308 = !isnan_res_221307;
                int64_t defunc_0_f_res_221309 =
                        btoi_bool_i64(defunc_0_p_res_221308);
                int64_t defunc_1_op_res_221310 = add64(defunc_0_f_res_221309,
                                                       scanacc_221304);
                
                ((int64_t *) mem_217484)[i_221303] = defunc_1_op_res_221310;
                
                int64_t scanacc_tmp_221330 = defunc_1_op_res_221310;
                
                scanacc_221304 = scanacc_tmp_221330;
            }
            discard_221301 = scanacc_221304;
            if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
                memmove(mem_217461 + i_221297 * defunc_0_f_res_203631 *
                        (int64_t) 8, mem_217499 + (int64_t) 0,
                        defunc_0_f_res_203631 * (int64_t) 8);
            for (int64_t write_iter_221314 = 0; write_iter_221314 <
                 defunc_0_f_res_203631; write_iter_221314++) {
                double write_iv_221316;
                
                write_iv_221316 = ((double *) mem_217414.mem)[gtid_206986 *
                                                              (defunc_0_f_res_203631 *
                                                               n_p_203492) +
                                                              i_221297 *
                                                              defunc_0_f_res_203631 +
                                                              write_iter_221314];
                
                bool isnan_res_221317;
                
                isnan_res_221317 = futrts_isnan64(write_iv_221316);
                
                bool defunc_0_p_res_221318 = !isnan_res_221317;
                int64_t defunc_1_f_res_221319;
                
                if (defunc_0_p_res_221318) {
                    int64_t write_iv_221320;
                    
                    write_iv_221320 =
                        ((int64_t *) mem_217484)[write_iter_221314];
                    
                    int64_t defunc_1_f_res_t_res_221321 = sub64(write_iv_221320,
                                                                (int64_t) 1);
                    
                    defunc_1_f_res_221319 = defunc_1_f_res_t_res_221321;
                } else {
                    defunc_1_f_res_221319 = (int64_t) -1;
                }
                if ((sle64((int64_t) 0, i_221297) && slt64(i_221297,
                                                           n_p_203492)) &&
                    (sle64((int64_t) 0, defunc_1_f_res_221319) &&
                     slt64(defunc_1_f_res_221319, defunc_0_f_res_203631))) {
                    ((int64_t *) mem_217461)[i_221297 * defunc_0_f_res_203631 +
                                             defunc_1_f_res_221319] =
                        write_iter_221314;
                }
            }
            if ((int64_t) 8 > 0)
                memmove(mem_217464 + i_221297 * (int64_t) 8, mem_217484 +
                        i_203718 * (int64_t) 8, (int64_t) 8);
        }
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217536.mem + gtid_206986 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217461 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
        if (n_p_203492 * (int64_t) 8 > 0)
            memmove(mem_217540.mem + gtid_206986 * n_p_203492 * (int64_t) 8,
                    mem_217464 + (int64_t) 0, n_p_203492 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217461);
    free(mem_217464);
    free(mem_217484);
    free(mem_217499);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235511_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235511_end -
                 futhark_mc_segmap_parloop_235511_start;
        
        ctx->futhark_mc_segmap_parloop_235511_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235511_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235511_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235509(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206985 = tid;
    int num_tasks_221295 = info.nsubtasks;
    struct futhark_mc_task_235508 *futhark_mc_task_235508 =
                                  (struct futhark_mc_task_235508 *) args;
    struct futhark_context *ctx = futhark_mc_task_235508->ctx;
    uint64_t futhark_mc_segmap_task_235509_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235509_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235508->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235508->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235508->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_task_235508->free_i_203718;
    int64_t bytes_217345 = futhark_mc_task_235508->free_bytes_217345;
    int64_t bytes_217364 = futhark_mc_task_235508->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235508->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t bytes_217456 = futhark_mc_task_235508->free_bytes_217456;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235508->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235508->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t iter_221296;
    struct futhark_mc_segmap_parloop_struct_235510
    futhark_mc_segmap_parloop_struct_235510;
    
    futhark_mc_segmap_parloop_struct_235510.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235510.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235510.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235510.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235510.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235510.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235510.free_bytes_217364 = bytes_217364;
    futhark_mc_segmap_parloop_struct_235510.free_mem_217414 = mem_217414.mem;
    futhark_mc_segmap_parloop_struct_235510.free_bytes_217456 = bytes_217456;
    futhark_mc_segmap_parloop_struct_235510.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235510.free_mem_217540 = mem_217540.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235511_task;
    
    futhark_mc_segmap_parloop_235511_task.name =
        "futhark_mc_segmap_parloop_235511";
    futhark_mc_segmap_parloop_235511_task.fn = futhark_mc_segmap_parloop_235511;
    futhark_mc_segmap_parloop_235511_task.args =
        &futhark_mc_segmap_parloop_struct_235510;
    futhark_mc_segmap_parloop_235511_task.iterations = iterations;
    futhark_mc_segmap_parloop_235511_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235511_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235511_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235511_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235511_task);
    
    if (futhark_mc_segmap_parloop_235511_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235511_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235511_total_end -
                 futhark_mc_segmap_parloop_235511_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235511_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235511_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235511_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235509_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235509_end -
                 futhark_mc_segmap_task_235509_start;
        
        ctx->futhark_mc_segmap_task_235509_runs[tid]++;
        ctx->futhark_mc_segmap_task_235509_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235509_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235517 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203718;
    int64_t free_bytes_217345;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217414;
    int64_t free_bytes_217456;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
};
struct futhark_mc_task_235521 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203718;
    int64_t free_gtid_207023;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217414;
    unsigned char *free_mem_217454;
    unsigned char *free_mem_217457;
};
struct futhark_mc_segmap_parloop_struct_235523 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203718;
    int64_t free_gtid_207023;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217414;
    unsigned char *free_mem_217454;
    unsigned char *free_mem_217457;
};
static int futhark_mc_segmap_parloop_235524(void *args, int64_t start,
                                            int64_t end, int flat_tid_221359,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235523
    *futhark_mc_segmap_parloop_struct_235523 =
    (struct futhark_mc_segmap_parloop_struct_235523 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235523->ctx;
    uint64_t futhark_mc_segmap_parloop_235524_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235524_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235523->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235523->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235523->free_i_203718;
    int64_t gtid_207023 =
            futhark_mc_segmap_parloop_struct_235523->free_gtid_207023;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235523->free_bytes_217345;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_segmap_parloop_struct_235523->free_mem_217414,
                                  .size =0, .references =NULL};
    struct memblock mem_217454 = {.desc ="mem_217454", .mem =
                                  futhark_mc_segmap_parloop_struct_235523->free_mem_217454,
                                  .size =0, .references =NULL};
    struct memblock mem_217457 = {.desc ="mem_217457", .mem =
                                  futhark_mc_segmap_parloop_struct_235523->free_mem_217457,
                                  .size =0, .references =NULL};
    size_t mem_221361_cached_sizze_235525 = 0;
    unsigned char *mem_221361 = NULL;
    size_t mem_221375_cached_sizze_235526 = 0;
    unsigned char *mem_221375 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221390 = start;
    
    if (mem_221361_cached_sizze_235525 < (size_t) bytes_217345) {
        mem_221361 = realloc(mem_221361, bytes_217345);
        mem_221361_cached_sizze_235525 = bytes_217345;
    }
    if (mem_221375_cached_sizze_235526 < (size_t) bytes_217345) {
        mem_221375 = realloc(mem_221375, bytes_217345);
        mem_221375_cached_sizze_235526 = bytes_217345;
    }
    for (; iter_221390 < end; iter_221390++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221409 = n_p_203492;
        int64_t gtid_221360 = iter_221390;
        int64_t remnant_221410 = iter_221390 - gtid_221360;
        int64_t discard_221363;
        int64_t scanacc_221392 = (int64_t) 0;
        
        for (int64_t i_221391 = 0; i_221391 < defunc_0_f_res_203631;
             i_221391++) {
            double x_221394;
            
            x_221394 = ((double *) mem_217414.mem)[gtid_207023 *
                                                   (defunc_0_f_res_203631 *
                                                    n_p_203492) + gtid_221360 *
                                                   defunc_0_f_res_203631 +
                                                   i_221391];
            
            bool isnan_res_221395;
            
            isnan_res_221395 = futrts_isnan64(x_221394);
            
            bool defunc_0_p_res_221396 = !isnan_res_221395;
            int64_t defunc_0_f_res_221397 =
                    btoi_bool_i64(defunc_0_p_res_221396);
            int64_t defunc_1_op_res_221398 = add64(defunc_0_f_res_221397,
                                                   scanacc_221392);
            
            ((int64_t *) mem_221361)[i_221391] = defunc_1_op_res_221398;
            
            int64_t scanacc_tmp_221411 = defunc_1_op_res_221398;
            
            scanacc_221392 = scanacc_tmp_221411;
        }
        discard_221363 = scanacc_221392;
        
        int64_t last_res_221374;
        
        last_res_221374 = ((int64_t *) mem_221361)[i_203718];
        for (int64_t i_221413 = 0; i_221413 < defunc_0_f_res_203631;
             i_221413++) {
            ((int64_t *) mem_221375)[i_221413] = (int64_t) -1;
        }
        for (int64_t write_iter_221400 = 0; write_iter_221400 <
             defunc_0_f_res_203631; write_iter_221400++) {
            double write_iv_221402;
            
            write_iv_221402 = ((double *) mem_217414.mem)[gtid_207023 *
                                                          (defunc_0_f_res_203631 *
                                                           n_p_203492) +
                                                          gtid_221360 *
                                                          defunc_0_f_res_203631 +
                                                          write_iter_221400];
            
            bool isnan_res_221403;
            
            isnan_res_221403 = futrts_isnan64(write_iv_221402);
            
            bool defunc_0_p_res_221404 = !isnan_res_221403;
            int64_t defunc_1_f_res_221405;
            
            if (defunc_0_p_res_221404) {
                int64_t write_iv_221406;
                
                write_iv_221406 = ((int64_t *) mem_221361)[write_iter_221400];
                
                int64_t defunc_1_f_res_t_res_221407 = sub64(write_iv_221406,
                                                            (int64_t) 1);
                
                defunc_1_f_res_221405 = defunc_1_f_res_t_res_221407;
            } else {
                defunc_1_f_res_221405 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_221405) &&
                slt64(defunc_1_f_res_221405, defunc_0_f_res_203631)) {
                ((int64_t *) mem_221375)[defunc_1_f_res_221405] =
                    write_iter_221400;
            }
        }
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217454.mem + gtid_221360 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_221375 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
        ((int64_t *) mem_217457.mem)[gtid_221360] = last_res_221374;
    }
    
  cleanup:
    { }
    free(mem_221361);
    free(mem_221375);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235524_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235524_end -
                 futhark_mc_segmap_parloop_235524_start;
        
        ctx->futhark_mc_segmap_parloop_235524_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235524_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235524_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235522(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221359 = tid;
    int num_tasks_221389 = info.nsubtasks;
    struct futhark_mc_task_235521 *futhark_mc_task_235521 =
                                  (struct futhark_mc_task_235521 *) args;
    struct futhark_context *ctx = futhark_mc_task_235521->ctx;
    uint64_t futhark_mc_segmap_task_235522_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235522_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235521->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235521->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_task_235521->free_i_203718;
    int64_t gtid_207023 = futhark_mc_task_235521->free_gtid_207023;
    int64_t bytes_217345 = futhark_mc_task_235521->free_bytes_217345;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235521->free_mem_217414,
                                  .size =0, .references =NULL};
    struct memblock mem_217454 = {.desc ="mem_217454", .mem =
                                  futhark_mc_task_235521->free_mem_217454,
                                  .size =0, .references =NULL};
    struct memblock mem_217457 = {.desc ="mem_217457", .mem =
                                  futhark_mc_task_235521->free_mem_217457,
                                  .size =0, .references =NULL};
    int64_t iter_221390;
    struct futhark_mc_segmap_parloop_struct_235523
    futhark_mc_segmap_parloop_struct_235523;
    
    futhark_mc_segmap_parloop_struct_235523.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235523.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235523.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235523.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235523.free_gtid_207023 = gtid_207023;
    futhark_mc_segmap_parloop_struct_235523.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235523.free_mem_217414 = mem_217414.mem;
    futhark_mc_segmap_parloop_struct_235523.free_mem_217454 = mem_217454.mem;
    futhark_mc_segmap_parloop_struct_235523.free_mem_217457 = mem_217457.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235524_task;
    
    futhark_mc_segmap_parloop_235524_task.name =
        "futhark_mc_segmap_parloop_235524";
    futhark_mc_segmap_parloop_235524_task.fn = futhark_mc_segmap_parloop_235524;
    futhark_mc_segmap_parloop_235524_task.args =
        &futhark_mc_segmap_parloop_struct_235523;
    futhark_mc_segmap_parloop_235524_task.iterations = iterations;
    futhark_mc_segmap_parloop_235524_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235524_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235524_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235524_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235524_task);
    
    if (futhark_mc_segmap_parloop_235524_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235524_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235524_total_end -
                 futhark_mc_segmap_parloop_235524_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235524_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235524_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235524_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235522_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235522_end -
                 futhark_mc_segmap_task_235522_start;
        
        ctx->futhark_mc_segmap_task_235522_runs[tid]++;
        ctx->futhark_mc_segmap_task_235522_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235522_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235528 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203718;
    int64_t free_gtid_207023;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217414;
    unsigned char *free_mem_217454;
    unsigned char *free_mem_217457;
};
struct futhark_mc_task_235532 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_207023;
    unsigned char *free_mem_217414;
    int64_t free_gtid_221335;
    unsigned char *free_mem_221336;
};
struct futhark_mc_scan_stage_1_parloop_struct_235535 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_207023;
    unsigned char *free_mem_217414;
    int64_t free_gtid_221335;
    unsigned char *free_mem_221336;
};
static int futhark_mc_scan_stage_1_parloop_235536(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221416, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_235535
    *futhark_mc_scan_stage_1_parloop_struct_235535 =
    (struct futhark_mc_scan_stage_1_parloop_struct_235535 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_235535->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_235536_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235536_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_scan_stage_1_parloop_struct_235535->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_scan_stage_1_parloop_struct_235535->free_defunc_0_f_res_203631;
    int64_t gtid_207023 =
            futhark_mc_scan_stage_1_parloop_struct_235535->free_gtid_207023;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235535->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t gtid_221335 =
            futhark_mc_scan_stage_1_parloop_struct_235535->free_gtid_221335;
    struct memblock mem_221336 = {.desc ="mem_221336", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235535->free_mem_221336,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221436 = start;
    int64_t x_221418;
    int64_t x_221419;
    
    x_221418 = (int64_t) 0;
    for (; iter_221436 < end; iter_221436++) {
        int64_t gtid_221417 = iter_221436;
        
        // stage 1 scan body
        {
            double x_221421;
            
            x_221421 = ((double *) mem_217414.mem)[gtid_207023 *
                                                   (defunc_0_f_res_203631 *
                                                    n_p_203492) + gtid_221335 *
                                                   defunc_0_f_res_203631 +
                                                   gtid_221417];
            
            bool isnan_res_221422;
            
            isnan_res_221422 = futrts_isnan64(x_221421);
            
            bool defunc_0_p_res_221423 = !isnan_res_221422;
            int64_t defunc_0_f_res_221424 =
                    btoi_bool_i64(defunc_0_p_res_221423);
            
            // write mapped values results to memory
            { }
            x_221418 = x_221418;
            // Read next values
            {
                x_221419 = defunc_0_f_res_221424;
            }
            
            int64_t defunc_1_op_res_221420 = add64(x_221418, x_221419);
            
            ((int64_t *) mem_221336.mem)[gtid_221417] = defunc_1_op_res_221420;
            x_221418 = defunc_1_op_res_221420;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235536_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235536_end -
                 futhark_mc_scan_stage_1_parloop_235536_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_235536_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_235536_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_235536_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_235537 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_207023;
    unsigned char *free_mem_217414;
    int64_t free_gtid_221335;
    unsigned char *free_mem_221336;
};
static int futhark_mc_scan_stage_3_parloop_235538(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221416, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_235537
    *futhark_mc_scan_stage_3_parloop_struct_235537 =
    (struct futhark_mc_scan_stage_3_parloop_struct_235537 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_235537->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_235538_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_235538_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_scan_stage_3_parloop_struct_235537->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_scan_stage_3_parloop_struct_235537->free_defunc_0_f_res_203631;
    int64_t gtid_207023 =
            futhark_mc_scan_stage_3_parloop_struct_235537->free_gtid_207023;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235537->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t gtid_221335 =
            futhark_mc_scan_stage_3_parloop_struct_235537->free_gtid_221335;
    struct memblock mem_221336 = {.desc ="mem_221336", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235537->free_mem_221336,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221448 = start;
    int64_t x_221445;
    int64_t x_221446;
    
    if (iter_221448 == (int64_t) 0) {
        x_221445 = (int64_t) 0;
    } else {
        x_221445 = ((int64_t *) mem_221336.mem)[iter_221448 - (int64_t) 1];
    }
    for (; iter_221448 < end; iter_221448++) {
        int64_t gtid_221417 = iter_221448;
        
        // stage 3 scan body
        {
            double x_221421;
            
            x_221421 = ((double *) mem_217414.mem)[gtid_207023 *
                                                   (defunc_0_f_res_203631 *
                                                    n_p_203492) + gtid_221335 *
                                                   defunc_0_f_res_203631 +
                                                   gtid_221417];
            
            bool isnan_res_221422;
            
            isnan_res_221422 = futrts_isnan64(x_221421);
            
            bool defunc_0_p_res_221423 = !isnan_res_221422;
            int64_t defunc_0_f_res_221424 =
                    btoi_bool_i64(defunc_0_p_res_221423);
            
            x_221445 = x_221445;
            x_221446 = defunc_0_f_res_221424;
            
            int64_t defunc_1_op_res_221447 = add64(x_221445, x_221446);
            
            ((int64_t *) mem_221336.mem)[gtid_221417] = defunc_1_op_res_221447;
            x_221445 = defunc_1_op_res_221447;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_235538_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_235538_end -
                 futhark_mc_scan_stage_3_parloop_235538_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_235538_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_235538_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_235538_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_235533(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221416 = tid;
    int num_tasks_221435 = info.nsubtasks;
    struct futhark_mc_task_235532 *futhark_mc_task_235532 =
                                  (struct futhark_mc_task_235532 *) args;
    struct futhark_context *ctx = futhark_mc_task_235532->ctx;
    uint64_t futhark_mc_segscan_task_235533_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_235533_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235532->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235532->free_defunc_0_f_res_203631;
    int64_t gtid_207023 = futhark_mc_task_235532->free_gtid_207023;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235532->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t gtid_221335 = futhark_mc_task_235532->free_gtid_221335;
    struct memblock mem_221336 = {.desc ="mem_221336", .mem =
                                  futhark_mc_task_235532->free_mem_221336,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_221442_cached_sizze_235534 = 0;
    unsigned char *scan_stage_2_accum_mem_221442 = NULL;
    int64_t iter_221436;
    struct futhark_mc_scan_stage_1_parloop_struct_235535
    futhark_mc_scan_stage_1_parloop_struct_235535;
    
    futhark_mc_scan_stage_1_parloop_struct_235535.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_235535.free_n_p_203492 = n_p_203492;
    futhark_mc_scan_stage_1_parloop_struct_235535.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_scan_stage_1_parloop_struct_235535.free_gtid_207023 =
        gtid_207023;
    futhark_mc_scan_stage_1_parloop_struct_235535.free_mem_217414 =
        mem_217414.mem;
    futhark_mc_scan_stage_1_parloop_struct_235535.free_gtid_221335 =
        gtid_221335;
    futhark_mc_scan_stage_1_parloop_struct_235535.free_mem_221336 =
        mem_221336.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_235536_task;
    
    futhark_mc_scan_stage_1_parloop_235536_task.name =
        "futhark_mc_scan_stage_1_parloop_235536";
    futhark_mc_scan_stage_1_parloop_235536_task.fn =
        futhark_mc_scan_stage_1_parloop_235536;
    futhark_mc_scan_stage_1_parloop_235536_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_235535;
    futhark_mc_scan_stage_1_parloop_235536_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_235536_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_235536_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235536_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_235536_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_235536_task);
    
    if (futhark_mc_scan_stage_1_parloop_235536_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235536_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235536_total_end -
                 futhark_mc_scan_stage_1_parloop_235536_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235536_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235536_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235536_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_221435)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_221437;
        int64_t x_221438;
        int64_t offset_221440 = (int64_t) 0;
        int64_t offset_index_221441 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_221442_cached_sizze_235534 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_221442 =
                realloc(scan_stage_2_accum_mem_221442, (int64_t) 8);
            scan_stage_2_accum_mem_221442_cached_sizze_235534 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_221442)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_221444 = 0; i_221444 < num_tasks_221435 - 1;
             i_221444++) {
            offset_221440 = squot64(defunc_0_f_res_203631,
                                    sext_i32_i64(num_tasks_221435));
            if (slt64(sext_i32_i64(i_221444), srem64(defunc_0_f_res_203631,
                                                     sext_i32_i64(num_tasks_221435)))) {
                offset_221440 += (int64_t) 1;
            }
            offset_index_221441 += offset_221440;
            
            int64_t gtid_221417 = offset_index_221441;
            double x_221421;
            
            x_221421 = ((double *) mem_217414.mem)[gtid_207023 *
                                                   (defunc_0_f_res_203631 *
                                                    n_p_203492) + gtid_221335 *
                                                   defunc_0_f_res_203631 +
                                                   gtid_221417];
            
            bool isnan_res_221422;
            
            isnan_res_221422 = futrts_isnan64(x_221421);
            
            bool defunc_0_p_res_221423 = !isnan_res_221422;
            int64_t defunc_0_f_res_221424 =
                    btoi_bool_i64(defunc_0_p_res_221423);
            
            // Read carry in
            {
                x_221437 =
                    ((int64_t *) scan_stage_2_accum_mem_221442)[(int64_t) 0];
            }
            // Read next values
            {
                x_221438 = ((int64_t *) mem_221336.mem)[offset_index_221441 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_221439 = add64(x_221437, x_221438);
            
            ((int64_t *) mem_221336.mem)[offset_index_221441 - (int64_t) 1] =
                defunc_1_op_res_221439;
            ((int64_t *) scan_stage_2_accum_mem_221442)[(int64_t) 0] =
                defunc_1_op_res_221439;
        }
        
        int64_t iter_221448 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_235537
        futhark_mc_scan_stage_3_parloop_struct_235537;
        
        futhark_mc_scan_stage_3_parloop_struct_235537.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_235537.free_n_p_203492 =
            n_p_203492;
        futhark_mc_scan_stage_3_parloop_struct_235537.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_scan_stage_3_parloop_struct_235537.free_gtid_207023 =
            gtid_207023;
        futhark_mc_scan_stage_3_parloop_struct_235537.free_mem_217414 =
            mem_217414.mem;
        futhark_mc_scan_stage_3_parloop_struct_235537.free_gtid_221335 =
            gtid_221335;
        futhark_mc_scan_stage_3_parloop_struct_235537.free_mem_221336 =
            mem_221336.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_235538_task;
        
        futhark_mc_scan_stage_3_parloop_235538_task.name =
            "futhark_mc_scan_stage_3_parloop_235538";
        futhark_mc_scan_stage_3_parloop_235538_task.fn =
            futhark_mc_scan_stage_3_parloop_235538;
        futhark_mc_scan_stage_3_parloop_235538_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_235537;
        futhark_mc_scan_stage_3_parloop_235538_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_235538_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_235538_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_235538_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_235538_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_235538_task);
        
        if (futhark_mc_scan_stage_3_parloop_235538_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_235538_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_235538_total_end -
                     futhark_mc_scan_stage_3_parloop_235538_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235538_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235538_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235538_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_221442);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_235533_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_235533_end -
                 futhark_mc_segscan_task_235533_start;
        
        ctx->futhark_mc_segscan_task_235533_runs[tid]++;
        ctx->futhark_mc_segscan_task_235533_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_235533_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235539 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_207023;
    unsigned char *free_mem_217414;
    int64_t free_gtid_221335;
    unsigned char *free_mem_221336;
    unsigned char *free_mem_221348;
};
struct futhark_mc_segmap_parloop_struct_235541 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_207023;
    unsigned char *free_mem_217414;
    int64_t free_gtid_221335;
    unsigned char *free_mem_221336;
    unsigned char *free_mem_221348;
};
static int futhark_mc_segmap_parloop_235542(void *args, int64_t start,
                                            int64_t end, int flat_tid_221425,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235541
    *futhark_mc_segmap_parloop_struct_235541 =
    (struct futhark_mc_segmap_parloop_struct_235541 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235541->ctx;
    uint64_t futhark_mc_segmap_parloop_235542_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235542_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235541->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235541->free_defunc_0_f_res_203631;
    int64_t gtid_207023 =
            futhark_mc_segmap_parloop_struct_235541->free_gtid_207023;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_segmap_parloop_struct_235541->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t gtid_221335 =
            futhark_mc_segmap_parloop_struct_235541->free_gtid_221335;
    struct memblock mem_221336 = {.desc ="mem_221336", .mem =
                                  futhark_mc_segmap_parloop_struct_235541->free_mem_221336,
                                  .size =0, .references =NULL};
    struct memblock mem_221348 = {.desc ="mem_221348", .mem =
                                  futhark_mc_segmap_parloop_struct_235541->free_mem_221348,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221451 = start;
    
    for (; iter_221451 < end; iter_221451++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221454 = defunc_0_f_res_203631;
        int64_t gtid_221426 = iter_221451;
        int64_t remnant_221455 = iter_221451 - gtid_221426;
        double x_221427;
        
        x_221427 = ((double *) mem_217414.mem)[gtid_207023 *
                                               (defunc_0_f_res_203631 *
                                                n_p_203492) + gtid_221335 *
                                               defunc_0_f_res_203631 +
                                               gtid_221426];
        
        bool isnan_res_221428;
        
        isnan_res_221428 = futrts_isnan64(x_221427);
        
        bool defunc_0_p_res_221429 = !isnan_res_221428;
        int64_t defunc_1_f_res_221430;
        
        if (defunc_0_p_res_221429) {
            int64_t x_221452;
            
            x_221452 = ((int64_t *) mem_221336.mem)[gtid_221426];
            
            int64_t defunc_1_f_res_t_res_221453 = sub64(x_221452, (int64_t) 1);
            
            defunc_1_f_res_221430 = defunc_1_f_res_t_res_221453;
        } else {
            defunc_1_f_res_221430 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_221430) &&
            slt64(defunc_1_f_res_221430, defunc_0_f_res_203631)) {
            ((int64_t *) mem_221348.mem)[defunc_1_f_res_221430] = gtid_221426;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235542_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235542_end -
                 futhark_mc_segmap_parloop_235542_start;
        
        ctx->futhark_mc_segmap_parloop_235542_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235542_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235542_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235540(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221425 = tid;
    int num_tasks_221450 = info.nsubtasks;
    struct futhark_mc_task_235539 *futhark_mc_task_235539 =
                                  (struct futhark_mc_task_235539 *) args;
    struct futhark_context *ctx = futhark_mc_task_235539->ctx;
    uint64_t futhark_mc_segmap_task_235540_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235540_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235539->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235539->free_defunc_0_f_res_203631;
    int64_t gtid_207023 = futhark_mc_task_235539->free_gtid_207023;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235539->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t gtid_221335 = futhark_mc_task_235539->free_gtid_221335;
    struct memblock mem_221336 = {.desc ="mem_221336", .mem =
                                  futhark_mc_task_235539->free_mem_221336,
                                  .size =0, .references =NULL};
    struct memblock mem_221348 = {.desc ="mem_221348", .mem =
                                  futhark_mc_task_235539->free_mem_221348,
                                  .size =0, .references =NULL};
    int64_t iter_221451;
    struct futhark_mc_segmap_parloop_struct_235541
    futhark_mc_segmap_parloop_struct_235541;
    
    futhark_mc_segmap_parloop_struct_235541.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235541.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235541.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235541.free_gtid_207023 = gtid_207023;
    futhark_mc_segmap_parloop_struct_235541.free_mem_217414 = mem_217414.mem;
    futhark_mc_segmap_parloop_struct_235541.free_gtid_221335 = gtid_221335;
    futhark_mc_segmap_parloop_struct_235541.free_mem_221336 = mem_221336.mem;
    futhark_mc_segmap_parloop_struct_235541.free_mem_221348 = mem_221348.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235542_task;
    
    futhark_mc_segmap_parloop_235542_task.name =
        "futhark_mc_segmap_parloop_235542";
    futhark_mc_segmap_parloop_235542_task.fn = futhark_mc_segmap_parloop_235542;
    futhark_mc_segmap_parloop_235542_task.args =
        &futhark_mc_segmap_parloop_struct_235541;
    futhark_mc_segmap_parloop_235542_task.iterations = iterations;
    futhark_mc_segmap_parloop_235542_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235542_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235542_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235542_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235542_task);
    
    if (futhark_mc_segmap_parloop_235542_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235542_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235542_total_end -
                 futhark_mc_segmap_parloop_235542_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235542_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235542_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235542_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235540_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235540_end -
                 futhark_mc_segmap_task_235540_start;
        
        ctx->futhark_mc_segmap_task_235540_runs[tid]++;
        ctx->futhark_mc_segmap_task_235540_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235540_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235529(void *args, int64_t start,
                                            int64_t end, int flat_tid_221334,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235528
    *futhark_mc_segmap_parloop_struct_235528 =
    (struct futhark_mc_segmap_parloop_struct_235528 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235528->ctx;
    uint64_t futhark_mc_segmap_parloop_235529_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235529_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235528->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235528->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235528->free_i_203718;
    int64_t gtid_207023 =
            futhark_mc_segmap_parloop_struct_235528->free_gtid_207023;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235528->free_bytes_217345;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_segmap_parloop_struct_235528->free_mem_217414,
                                  .size =0, .references =NULL};
    struct memblock mem_217454 = {.desc ="mem_217454", .mem =
                                  futhark_mc_segmap_parloop_struct_235528->free_mem_217454,
                                  .size =0, .references =NULL};
    struct memblock mem_217457 = {.desc ="mem_217457", .mem =
                                  futhark_mc_segmap_parloop_struct_235528->free_mem_217457,
                                  .size =0, .references =NULL};
    size_t mem_221336_cached_sizze_235530 = 0;
    unsigned char *mem_221336 = NULL;
    size_t mem_221348_cached_sizze_235531 = 0;
    unsigned char *mem_221348 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221415 = start;
    
    if (mem_221336_cached_sizze_235530 < (size_t) bytes_217345) {
        mem_221336 = realloc(mem_221336, bytes_217345);
        mem_221336_cached_sizze_235530 = bytes_217345;
    }
    if (mem_221348_cached_sizze_235531 < (size_t) bytes_217345) {
        mem_221348 = realloc(mem_221348, bytes_217345);
        mem_221348_cached_sizze_235531 = bytes_217345;
    }
    for (; iter_221415 < end; iter_221415++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221433 = n_p_203492;
        int64_t gtid_221335 = iter_221415;
        int64_t remnant_221434 = iter_221415 - gtid_221335;
        int64_t flat_tid_221416 = (int64_t) 0;
        int32_t num_tasks_221435;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_235532 futhark_mc_task_235532;
        
        futhark_mc_task_235532.ctx = ctx;
        futhark_mc_task_235532.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235532.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235532.free_gtid_207023 = gtid_207023;
        futhark_mc_task_235532.free_mem_217414 = mem_217414.mem;
        futhark_mc_task_235532.free_gtid_221335 = gtid_221335;
        futhark_mc_task_235532.free_mem_221336 = mem_221336;
        
        struct scheduler_segop futhark_mc_task_235532_task;
        
        futhark_mc_task_235532_task.args = &futhark_mc_task_235532;
        futhark_mc_task_235532_task.top_level_fn =
            futhark_mc_segscan_task_235533;
        futhark_mc_task_235532_task.name = "futhark_mc_segscan_task_235533";
        futhark_mc_task_235532_task.iterations = defunc_0_f_res_203631;
        futhark_mc_task_235532_task.task_time =
            &ctx->futhark_mc_segscan_task_235533_total_time;
        futhark_mc_task_235532_task.task_iter =
            &ctx->futhark_mc_segscan_task_235533_total_iter;
        futhark_mc_task_235532_task.sched = STATIC;
        futhark_mc_task_235532_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_235533_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235532_task);
        
        if (futhark_mc_segscan_task_235533_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_221347;
        
        last_res_221347 = ((int64_t *) mem_221336)[i_203718];
        for (int64_t i_221449 = 0; i_221449 < defunc_0_f_res_203631;
             i_221449++) {
            ((int64_t *) mem_221348)[i_221449] = (int64_t) -1;
        }
        
        int64_t flat_tid_221425 = (int64_t) 0;
        int32_t num_tasks_221450;
        struct futhark_mc_task_235539 futhark_mc_task_235539;
        
        futhark_mc_task_235539.ctx = ctx;
        futhark_mc_task_235539.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235539.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235539.free_gtid_207023 = gtid_207023;
        futhark_mc_task_235539.free_mem_217414 = mem_217414.mem;
        futhark_mc_task_235539.free_gtid_221335 = gtid_221335;
        futhark_mc_task_235539.free_mem_221336 = mem_221336;
        futhark_mc_task_235539.free_mem_221348 = mem_221348;
        
        struct scheduler_segop futhark_mc_task_235539_task;
        
        futhark_mc_task_235539_task.args = &futhark_mc_task_235539;
        futhark_mc_task_235539_task.top_level_fn =
            futhark_mc_segmap_task_235540;
        futhark_mc_task_235539_task.name = "futhark_mc_segmap_task_235540";
        futhark_mc_task_235539_task.iterations = defunc_0_f_res_203631;
        futhark_mc_task_235539_task.task_time =
            &ctx->futhark_mc_segmap_task_235540_total_time;
        futhark_mc_task_235539_task.task_iter =
            &ctx->futhark_mc_segmap_task_235540_total_iter;
        futhark_mc_task_235539_task.sched = STATIC;
        futhark_mc_task_235539_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235540_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235539_task);
        
        if (futhark_mc_segmap_task_235540_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217454.mem + gtid_221335 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_221348 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
        ((int64_t *) mem_217457.mem)[gtid_221335] = last_res_221347;
    }
    
  cleanup:
    { }
    free(mem_221336);
    free(mem_221348);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235529_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235529_end -
                 futhark_mc_segmap_parloop_235529_start;
        
        ctx->futhark_mc_segmap_parloop_235529_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235529_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235529_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235527(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221334 = tid;
    int num_tasks_221389 = info.nsubtasks;
    struct futhark_mc_task_235521 *futhark_mc_task_235521 =
                                  (struct futhark_mc_task_235521 *) args;
    struct futhark_context *ctx = futhark_mc_task_235521->ctx;
    uint64_t futhark_mc_segmap_nested_task_235527_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235527_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235521->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235521->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_task_235521->free_i_203718;
    int64_t gtid_207023 = futhark_mc_task_235521->free_gtid_207023;
    int64_t bytes_217345 = futhark_mc_task_235521->free_bytes_217345;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235521->free_mem_217414,
                                  .size =0, .references =NULL};
    struct memblock mem_217454 = {.desc ="mem_217454", .mem =
                                  futhark_mc_task_235521->free_mem_217454,
                                  .size =0, .references =NULL};
    struct memblock mem_217457 = {.desc ="mem_217457", .mem =
                                  futhark_mc_task_235521->free_mem_217457,
                                  .size =0, .references =NULL};
    int64_t iter_221415;
    struct futhark_mc_segmap_parloop_struct_235528
    futhark_mc_segmap_parloop_struct_235528;
    
    futhark_mc_segmap_parloop_struct_235528.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235528.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235528.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235528.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235528.free_gtid_207023 = gtid_207023;
    futhark_mc_segmap_parloop_struct_235528.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235528.free_mem_217414 = mem_217414.mem;
    futhark_mc_segmap_parloop_struct_235528.free_mem_217454 = mem_217454.mem;
    futhark_mc_segmap_parloop_struct_235528.free_mem_217457 = mem_217457.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235529_task;
    
    futhark_mc_segmap_parloop_235529_task.name =
        "futhark_mc_segmap_parloop_235529";
    futhark_mc_segmap_parloop_235529_task.fn = futhark_mc_segmap_parloop_235529;
    futhark_mc_segmap_parloop_235529_task.args =
        &futhark_mc_segmap_parloop_struct_235528;
    futhark_mc_segmap_parloop_235529_task.iterations = iterations;
    futhark_mc_segmap_parloop_235529_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235529_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235529_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235529_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235529_task);
    
    if (futhark_mc_segmap_parloop_235529_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235529_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235529_total_end -
                 futhark_mc_segmap_parloop_235529_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235529_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235529_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235529_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235527_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235527_end -
                 futhark_mc_segmap_nested_task_235527_start;
        
        ctx->futhark_mc_segmap_nested_task_235527_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235527_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235527_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235518(void *args, int64_t start,
                                            int64_t end, int flat_tid_207022,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235517
    *futhark_mc_segmap_parloop_struct_235517 =
    (struct futhark_mc_segmap_parloop_struct_235517 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235517->ctx;
    uint64_t futhark_mc_segmap_parloop_235518_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235518_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235517->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235517->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235517->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235517->free_i_203718;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235517->free_bytes_217345;
    int64_t bytes_217364 =
            futhark_mc_segmap_parloop_struct_235517->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_segmap_parloop_struct_235517->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t bytes_217456 =
            futhark_mc_segmap_parloop_struct_235517->free_bytes_217456;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235517->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235517->free_mem_217540,
                                  .size =0, .references =NULL};
    size_t mem_217454_cached_sizze_235519 = 0;
    unsigned char *mem_217454 = NULL;
    size_t mem_217457_cached_sizze_235520 = 0;
    unsigned char *mem_217457 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221333 = start;
    
    if (mem_217454_cached_sizze_235519 < (size_t) bytes_217364) {
        mem_217454 = realloc(mem_217454, bytes_217364);
        mem_217454_cached_sizze_235519 = bytes_217364;
    }
    if (mem_217457_cached_sizze_235520 < (size_t) bytes_217456) {
        mem_217457 = realloc(mem_217457, bytes_217456);
        mem_217457_cached_sizze_235520 = bytes_217456;
    }
    for (; iter_221333 < end; iter_221333++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221387 = partition_sizze_203577;
        int64_t gtid_207023 = iter_221333;
        int64_t remnant_221388 = iter_221333 - gtid_207023;
        int64_t flat_tid_221359 = (int64_t) 0;
        int32_t num_tasks_221389;
        int64_t flat_tid_221334 = (int64_t) 0;
        struct futhark_mc_task_235521 futhark_mc_task_235521;
        
        futhark_mc_task_235521.ctx = ctx;
        futhark_mc_task_235521.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235521.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235521.free_i_203718 = i_203718;
        futhark_mc_task_235521.free_gtid_207023 = gtid_207023;
        futhark_mc_task_235521.free_bytes_217345 = bytes_217345;
        futhark_mc_task_235521.free_mem_217414 = mem_217414.mem;
        futhark_mc_task_235521.free_mem_217454 = mem_217454;
        futhark_mc_task_235521.free_mem_217457 = mem_217457;
        
        struct scheduler_segop futhark_mc_task_235521_task;
        
        futhark_mc_task_235521_task.args = &futhark_mc_task_235521;
        futhark_mc_task_235521_task.top_level_fn =
            futhark_mc_segmap_task_235522;
        futhark_mc_task_235521_task.name = "futhark_mc_segmap_task_235522";
        futhark_mc_task_235521_task.iterations = n_p_203492;
        futhark_mc_task_235521_task.task_time =
            &ctx->futhark_mc_segmap_task_235522_total_time;
        futhark_mc_task_235521_task.task_iter =
            &ctx->futhark_mc_segmap_task_235522_total_iter;
        futhark_mc_task_235521_task.sched = STATIC;
        futhark_mc_task_235521_task.nested_fn =
            futhark_mc_segmap_nested_task_235527;
        
        int futhark_mc_segmap_task_235522_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235521_task);
        
        if (futhark_mc_segmap_task_235522_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217536.mem + gtid_207023 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217454 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
        if (n_p_203492 * (int64_t) 8 > 0)
            memmove(mem_217540.mem + gtid_207023 * n_p_203492 * (int64_t) 8,
                    mem_217457 + (int64_t) 0, n_p_203492 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217454);
    free(mem_217457);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235518_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235518_end -
                 futhark_mc_segmap_parloop_235518_start;
        
        ctx->futhark_mc_segmap_parloop_235518_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235518_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235518_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235516(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207022 = tid;
    int num_tasks_221295 = info.nsubtasks;
    struct futhark_mc_task_235508 *futhark_mc_task_235508 =
                                  (struct futhark_mc_task_235508 *) args;
    struct futhark_context *ctx = futhark_mc_task_235508->ctx;
    uint64_t futhark_mc_segmap_nested_task_235516_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235516_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235508->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235508->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235508->free_defunc_0_f_res_203631;
    int64_t i_203718 = futhark_mc_task_235508->free_i_203718;
    int64_t bytes_217345 = futhark_mc_task_235508->free_bytes_217345;
    int64_t bytes_217364 = futhark_mc_task_235508->free_bytes_217364;
    struct memblock mem_217414 = {.desc ="mem_217414", .mem =
                                  futhark_mc_task_235508->free_mem_217414,
                                  .size =0, .references =NULL};
    int64_t bytes_217456 = futhark_mc_task_235508->free_bytes_217456;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235508->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235508->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t iter_221333;
    struct futhark_mc_segmap_parloop_struct_235517
    futhark_mc_segmap_parloop_struct_235517;
    
    futhark_mc_segmap_parloop_struct_235517.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235517.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235517.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235517.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235517.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235517.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235517.free_bytes_217364 = bytes_217364;
    futhark_mc_segmap_parloop_struct_235517.free_mem_217414 = mem_217414.mem;
    futhark_mc_segmap_parloop_struct_235517.free_bytes_217456 = bytes_217456;
    futhark_mc_segmap_parloop_struct_235517.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235517.free_mem_217540 = mem_217540.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235518_task;
    
    futhark_mc_segmap_parloop_235518_task.name =
        "futhark_mc_segmap_parloop_235518";
    futhark_mc_segmap_parloop_235518_task.fn = futhark_mc_segmap_parloop_235518;
    futhark_mc_segmap_parloop_235518_task.args =
        &futhark_mc_segmap_parloop_struct_235517;
    futhark_mc_segmap_parloop_235518_task.iterations = iterations;
    futhark_mc_segmap_parloop_235518_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235518_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235518_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235518_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235518_task);
    
    if (futhark_mc_segmap_parloop_235518_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235518_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235518_total_end -
                 futhark_mc_segmap_parloop_235518_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235518_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235518_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235518_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235516_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235516_end -
                 futhark_mc_segmap_nested_task_235516_start;
        
        ctx->futhark_mc_segmap_nested_task_235516_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235516_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235516_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235543 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    double free_i64_res_203755;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
};
struct futhark_mc_segmap_parloop_struct_235545 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    double free_i64_res_203755;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
};
static int futhark_mc_segmap_parloop_235546(void *args, int64_t start,
                                            int64_t end, int flat_tid_207073,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235545
    *futhark_mc_segmap_parloop_struct_235545 =
    (struct futhark_mc_segmap_parloop_struct_235545 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235545->ctx;
    uint64_t futhark_mc_segmap_parloop_235546_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235546_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235545->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235545->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235545->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235545->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235545->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235545->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235545->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235545->free_i_203718;
    bool x_203719 = futhark_mc_segmap_parloop_struct_235545->free_x_203719;
    int64_t min_res_203749 =
            futhark_mc_segmap_parloop_struct_235545->free_min_res_203749;
    bool loop_cond_203754 =
         futhark_mc_segmap_parloop_struct_235545->free_loop_cond_203754;
    double i64_res_203755 =
           futhark_mc_segmap_parloop_struct_235545->free_i64_res_203755;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235545->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235545->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235545->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235545->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235545->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235545->free_mem_217715,
                                  .size =0, .references =NULL};
    size_t mem_217606_cached_sizze_235547 = 0;
    unsigned char *mem_217606 = NULL;
    size_t mem_217610_cached_sizze_235548 = 0;
    unsigned char *mem_217610 = NULL;
    size_t mem_217633_cached_sizze_235549 = 0;
    unsigned char *mem_217633 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221457 = start;
    
    if (mem_217606_cached_sizze_235547 < (size_t) bytes_217597) {
        mem_217606 = realloc(mem_217606, bytes_217597);
        mem_217606_cached_sizze_235547 = bytes_217597;
    }
    if (mem_217610_cached_sizze_235548 < (size_t) bytes_217597) {
        mem_217610 = realloc(mem_217610, bytes_217597);
        mem_217610_cached_sizze_235548 = bytes_217597;
    }
    if (mem_217633_cached_sizze_235549 < (size_t) bytes_217345) {
        mem_217633 = realloc(mem_217633, bytes_217345);
        mem_217633_cached_sizze_235549 = bytes_217345;
    }
    for (; iter_221457 < end; iter_221457++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221585 = partition_sizze_203577;
        int64_t gtid_207074 = iter_221457;
        int64_t remnant_221586 = iter_221457 - gtid_207074;
        
        for (int64_t i_221458 = 0; i_221458 < n_p_203492; i_221458++) {
            int64_t x_221461;
            
            x_221461 = ((int64_t *) mem_217540.mem)[gtid_207074 * n_p_203492 +
                                                    i_221458];
            for (int64_t i_221464 = 0; i_221464 < defunc_0_f_res_203631;
                 i_221464++) {
                int64_t x_221466;
                
                x_221466 = ((int64_t *) mem_217536.mem)[gtid_207074 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_221458 *
                                                        defunc_0_f_res_203631 +
                                                        i_221464];
                
                int64_t defunc_0_f_res_221467 = add64((int64_t) 1, x_221466);
                
                ((int64_t *) mem_217633)[i_221464] = defunc_0_f_res_221467;
            }
            
            int64_t min_arg_221469 = sub64(x_221461, (int64_t) 1);
            int64_t min_arg_221470 = sub64(x_221461, min_res_203749);
            int64_t min_res_221471 = smin64(q_s_203493, x_221461);
            double i64_res_221472 = sitofp_i64_f64(x_221461);
            double x_221473 = i64_res_203755 - i64_res_221472;
            double max_arg_221474 = x_221473 / 2.0;
            double max_res_221475 = fmax64(0.0, max_arg_221474);
            
            for (int64_t i_221478 = 0; i_221478 < s_n_m_203636; i_221478++) {
                bool cond_221481 = i_221478 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_221482;
                
                if (cond_221481) {
                    defunc_0_m_fun_res_221482 = (int64_t) 0;
                } else {
                    int64_t y_221483 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_221484 = i_221478 == y_221483;
                    int64_t defunc_0_m_fun_res_f_res_221485;
                    
                    if (cond_221484) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_221486 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_221485 =
                            defunc_0_m_fun_res_f_res_t_res_221486;
                    } else {
                        int64_t x_221487 = sub64(i_221478, (int64_t) 1);
                        int64_t x_221488 = mul64(jump_s_203499, x_221487);
                        int64_t min_arg_221489 = add64((int64_t) 1, x_221488);
                        int64_t min_res_221490 = smin64(defunc_0_f_res_203631,
                                                        min_arg_221489);
                        
                        defunc_0_m_fun_res_f_res_221485 = min_res_221490;
                    }
                    defunc_0_m_fun_res_221482 = defunc_0_m_fun_res_f_res_221485;
                }
                
                bool init_idx_221491;
                int64_t init_idx_221492;
                int64_t init_idx_221493;
                bool loop_while_221494;
                int64_t low_221495;
                int64_t high_221496;
                
                loop_while_221494 = x_203719;
                low_221495 = (int64_t) 0;
                high_221496 = i_203718;
                while (loop_while_221494) {
                    int64_t x_221497 = add64(low_221495, high_221496);
                    int64_t mid_221498 = sdiv64(x_221497, (int64_t) 2);
                    bool x_221499 = sle64((int64_t) 0, mid_221498);
                    bool y_221500 = slt64(mid_221498, defunc_0_f_res_203631);
                    bool bounds_check_221501 = x_221499 && y_221500;
                    bool index_certs_221502;
                    
                    if (!bounds_check_221501) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) mid_221498,
                                      "] out of bounds for array of shape [",
                                      (long long) defunc_0_f_res_203631, "].",
                                      "-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t mid_id_221503;
                    
                    mid_id_221503 = ((int64_t *) mem_217633)[mid_221498];
                    
                    bool cond_221504 = slt64(mid_id_221503, (int64_t) 0);
                    int64_t mid_idx_221505;
                    
                    if (cond_221504) {
                        mid_idx_221505 = (int64_t) 9223372036854775807;
                    } else {
                        mid_idx_221505 = mid_id_221503;
                    }
                    
                    bool cond_221506 = sle64(defunc_0_m_fun_res_221482,
                                             mid_idx_221505);
                    int64_t loopres_221507;
                    int64_t loopres_221508;
                    
                    if (cond_221506) {
                        int64_t loopres_t_res_221509 = sub64(mid_221498,
                                                             (int64_t) 1);
                        
                        loopres_221507 = low_221495;
                        loopres_221508 = loopres_t_res_221509;
                    } else {
                        int64_t loopres_f_res_221510 = add64((int64_t) 1,
                                                             mid_221498);
                        
                        loopres_221507 = loopres_f_res_221510;
                        loopres_221508 = high_221496;
                    }
                    
                    bool loop_cond_221511 = sle64(loopres_221507,
                                                  loopres_221508);
                    bool loop_while_tmp_221592 = loop_cond_221511;
                    int64_t low_tmp_221593 = loopres_221507;
                    int64_t high_tmp_221594 = loopres_221508;
                    
                    loop_while_221494 = loop_while_tmp_221592;
                    low_221495 = low_tmp_221593;
                    high_221496 = high_tmp_221594;
                }
                init_idx_221491 = loop_while_221494;
                init_idx_221492 = low_221495;
                init_idx_221493 = high_221496;
                
                bool idx_221512;
                int64_t idx_221513;
                int64_t idx_221514;
                int64_t idx_221515;
                bool loop_while_221516;
                int64_t l_idx_221517;
                int64_t r_idx_221518;
                int64_t span_221519;
                
                loop_while_221516 = loop_cond_203754;
                l_idx_221517 = init_idx_221492;
                r_idx_221518 = init_idx_221492;
                span_221519 = (int64_t) 1;
                while (loop_while_221516) {
                    int64_t max_arg_221520 = sub64(l_idx_221517, (int64_t) 1);
                    int64_t max_res_221521 = smax64((int64_t) 0,
                                                    max_arg_221520);
                    int64_t min_arg_221522 = add64((int64_t) 1, r_idx_221518);
                    int64_t min_res_221523 = smin64(min_arg_221469,
                                                    min_arg_221522);
                    bool x_221524 = sle64((int64_t) 0, max_res_221521);
                    bool y_221525 = slt64(max_res_221521,
                                          defunc_0_f_res_203631);
                    bool bounds_check_221526 = x_221524 && y_221525;
                    bool index_certs_221527;
                    
                    if (!bounds_check_221526) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) max_res_221521,
                                      "] out of bounds for array of shape [",
                                      (long long) defunc_0_f_res_203631, "].",
                                      "-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t x_221528;
                    
                    x_221528 = ((int64_t *) mem_217633)[max_res_221521];
                    
                    int64_t abs_arg_221529 = sub64(x_221528,
                                                   defunc_0_m_fun_res_221482);
                    int64_t abs_res_221530 = abs64(abs_arg_221529);
                    bool x_221531 = sle64((int64_t) 0, min_res_221523);
                    bool y_221532 = slt64(min_res_221523,
                                          defunc_0_f_res_203631);
                    bool bounds_check_221533 = x_221531 && y_221532;
                    bool index_certs_221534;
                    
                    if (!bounds_check_221533) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) min_res_221523,
                                      "] out of bounds for array of shape [",
                                      (long long) defunc_0_f_res_203631, "].",
                                      "-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t x_221535;
                    
                    x_221535 = ((int64_t *) mem_217633)[min_res_221523];
                    
                    int64_t abs_arg_221536 = sub64(x_221535,
                                                   defunc_0_m_fun_res_221482);
                    int64_t abs_res_221537 = abs64(abs_arg_221536);
                    bool cond_221538 = max_res_221521 == l_idx_221517;
                    int64_t loopres_221539;
                    int64_t loopres_221540;
                    int64_t loopres_221541;
                    
                    if (cond_221538) {
                        loopres_221539 = l_idx_221517;
                        loopres_221540 = r_idx_221518;
                        loopres_221541 = min_res_203749;
                    } else {
                        bool cond_221542 = slt64(abs_res_221530,
                                                 abs_res_221537);
                        bool cond_f_res_221543 = min_res_221523 == r_idx_221518;
                        bool x_221544 = !cond_221542;
                        bool y_221545 = cond_f_res_221543 && x_221544;
                        bool cond_221546 = cond_221542 || y_221545;
                        int64_t loopres_f_res_221547;
                        
                        if (cond_221546) {
                            loopres_f_res_221547 = max_res_221521;
                        } else {
                            loopres_f_res_221547 = l_idx_221517;
                        }
                        
                        int64_t loopres_f_res_221548;
                        
                        if (cond_221546) {
                            loopres_f_res_221548 = r_idx_221518;
                        } else {
                            loopres_f_res_221548 = min_res_221523;
                        }
                        
                        int64_t loopres_f_res_221549;
                        
                        if (cond_221546) {
                            int64_t loopres_f_res_t_res_221550 =
                                    add64((int64_t) 1, span_221519);
                            
                            loopres_f_res_221549 = loopres_f_res_t_res_221550;
                        } else {
                            int64_t loopres_f_res_f_res_221551 =
                                    add64((int64_t) 1, span_221519);
                            
                            loopres_f_res_221549 = loopres_f_res_f_res_221551;
                        }
                        loopres_221539 = loopres_f_res_221547;
                        loopres_221540 = loopres_f_res_221548;
                        loopres_221541 = loopres_f_res_221549;
                    }
                    
                    bool loop_cond_221552 = slt64(loopres_221541,
                                                  min_res_203749);
                    bool loop_while_tmp_221595 = loop_cond_221552;
                    int64_t l_idx_tmp_221596 = loopres_221539;
                    int64_t r_idx_tmp_221597 = loopres_221540;
                    int64_t span_tmp_221598 = loopres_221541;
                    
                    loop_while_221516 = loop_while_tmp_221595;
                    l_idx_221517 = l_idx_tmp_221596;
                    r_idx_221518 = r_idx_tmp_221597;
                    span_221519 = span_tmp_221598;
                }
                idx_221512 = loop_while_221516;
                idx_221513 = l_idx_221517;
                idx_221514 = r_idx_221518;
                idx_221515 = span_221519;
                
                int64_t min_res_221553 = smin64(min_arg_221470, idx_221513);
                int64_t max_res_221554 = smax64((int64_t) 0, min_res_221553);
                int64_t defunc_0_m_fun_res_221555;
                
                if (cond_221481) {
                    defunc_0_m_fun_res_221555 = (int64_t) 0;
                } else {
                    int64_t y_221556 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_221557 = i_221478 == y_221556;
                    int64_t defunc_0_m_fun_res_f_res_221558;
                    
                    if (cond_221557) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_221559 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_221558 =
                            defunc_0_m_fun_res_f_res_t_res_221559;
                    } else {
                        int64_t x_221560 = sub64(i_221478, (int64_t) 1);
                        int64_t x_221561 = mul64(jump_s_203499, x_221560);
                        int64_t min_arg_221562 = add64((int64_t) 1, x_221561);
                        int64_t min_res_221563 = smin64(defunc_0_f_res_203631,
                                                        min_arg_221562);
                        
                        defunc_0_m_fun_res_f_res_221558 = min_res_221563;
                    }
                    defunc_0_m_fun_res_221555 = defunc_0_m_fun_res_f_res_221558;
                }
                
                int64_t x_221564 = add64(min_res_221471, max_res_221554);
                int64_t r_221565 = sub64(x_221564, (int64_t) 1);
                bool x_221566 = sle64((int64_t) 0, r_221565);
                bool y_221567 = slt64(r_221565, defunc_0_f_res_203631);
                bool bounds_check_221568 = x_221566 && y_221567;
                bool index_certs_221569;
                
                if (!bounds_check_221568) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) r_221565,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203631, "].",
                                  "-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:518:16-54\n   #5  stl.fut:142:20-80\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:141:12-143:40\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:140:5-144:36\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_221570;
                
                x_221570 = ((int64_t *) mem_217633)[r_221565];
                
                int64_t abs_arg_221571 = sub64(x_221570,
                                               defunc_0_m_fun_res_221555);
                int64_t abs_res_221572 = abs64(abs_arg_221571);
                bool x_221573 = sle64((int64_t) 0, max_res_221554);
                bool y_221574 = slt64(max_res_221554, defunc_0_f_res_203631);
                bool bounds_check_221575 = x_221573 && y_221574;
                bool index_certs_221576;
                
                if (!bounds_check_221575) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_221554,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203631, "].",
                                  "-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:518:16-54\n   #5  stl.fut:142:20-80\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:141:12-143:40\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:140:5-144:36\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_221577;
                
                x_221577 = ((int64_t *) mem_217633)[max_res_221554];
                
                int64_t abs_arg_221578 = sub64(x_221577,
                                               defunc_0_m_fun_res_221555);
                int64_t abs_res_221579 = abs64(abs_arg_221578);
                int64_t max_res_221580 = smax64(abs_res_221572, abs_res_221579);
                double defunc_0_f_res_221581 = sitofp_i64_f64(max_res_221580);
                double defunc_1_f_res_221582 = max_res_221475 +
                       defunc_0_f_res_221581;
                
                ((double *) mem_217610)[i_221458 * s_n_m_203636 + i_221478] =
                    defunc_1_f_res_221582;
                ((int64_t *) mem_217606)[i_221458 * s_n_m_203636 + i_221478] =
                    max_res_221554;
            }
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217710.mem + gtid_207074 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_217606 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217715.mem + gtid_207074 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_217610 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217606);
    free(mem_217610);
    free(mem_217633);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235546_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235546_end -
                 futhark_mc_segmap_parloop_235546_start;
        
        ctx->futhark_mc_segmap_parloop_235546_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235546_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235546_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235544(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207073 = tid;
    int num_tasks_221456 = info.nsubtasks;
    struct futhark_mc_task_235543 *futhark_mc_task_235543 =
                                  (struct futhark_mc_task_235543 *) args;
    struct futhark_context *ctx = futhark_mc_task_235543->ctx;
    uint64_t futhark_mc_segmap_task_235544_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235544_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235543->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235543->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235543->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235543->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235543->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235543->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235543->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_task_235543->free_i_203718;
    bool x_203719 = futhark_mc_task_235543->free_x_203719;
    int64_t min_res_203749 = futhark_mc_task_235543->free_min_res_203749;
    bool loop_cond_203754 = futhark_mc_task_235543->free_loop_cond_203754;
    double i64_res_203755 = futhark_mc_task_235543->free_i64_res_203755;
    int64_t bytes_217345 = futhark_mc_task_235543->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235543->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235543->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235543->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235543->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235543->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235543->free_mem_217715,
                                  .size =0, .references =NULL};
    int64_t iter_221457;
    struct futhark_mc_segmap_parloop_struct_235545
    futhark_mc_segmap_parloop_struct_235545;
    
    futhark_mc_segmap_parloop_struct_235545.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235545.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235545.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235545.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235545.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235545.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235545.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235545.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235545.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235545.free_x_203719 = x_203719;
    futhark_mc_segmap_parloop_struct_235545.free_min_res_203749 =
        min_res_203749;
    futhark_mc_segmap_parloop_struct_235545.free_loop_cond_203754 =
        loop_cond_203754;
    futhark_mc_segmap_parloop_struct_235545.free_i64_res_203755 =
        i64_res_203755;
    futhark_mc_segmap_parloop_struct_235545.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235545.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235545.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235545.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235545.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235545.free_mem_217715 = mem_217715.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235546_task;
    
    futhark_mc_segmap_parloop_235546_task.name =
        "futhark_mc_segmap_parloop_235546";
    futhark_mc_segmap_parloop_235546_task.fn = futhark_mc_segmap_parloop_235546;
    futhark_mc_segmap_parloop_235546_task.args =
        &futhark_mc_segmap_parloop_struct_235545;
    futhark_mc_segmap_parloop_235546_task.iterations = iterations;
    futhark_mc_segmap_parloop_235546_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235546_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235546_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235546_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235546_task);
    
    if (futhark_mc_segmap_parloop_235546_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235546_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235546_total_end -
                 futhark_mc_segmap_parloop_235546_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235546_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235546_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235546_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235544_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235544_end -
                 futhark_mc_segmap_task_235544_start;
        
        ctx->futhark_mc_segmap_task_235544_runs[tid]++;
        ctx->futhark_mc_segmap_task_235544_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235544_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235551 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    double free_i64_res_203755;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
};
struct futhark_mc_task_235555 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    double free_i64_res_203755;
    int64_t free_gtid_207209;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217598;
    unsigned char *free_mem_217602;
};
struct futhark_mc_segmap_parloop_struct_235557 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    double free_i64_res_203755;
    int64_t free_gtid_207209;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217598;
    unsigned char *free_mem_217602;
};
static int futhark_mc_segmap_parloop_235558(void *args, int64_t start,
                                            int64_t end, int flat_tid_221724,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235557
    *futhark_mc_segmap_parloop_struct_235557 =
    (struct futhark_mc_segmap_parloop_struct_235557 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235557->ctx;
    uint64_t futhark_mc_segmap_parloop_235558_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235558_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235557->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235557->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235557->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235557->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235557->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235557->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235557->free_i_203718;
    bool x_203719 = futhark_mc_segmap_parloop_struct_235557->free_x_203719;
    int64_t min_res_203749 =
            futhark_mc_segmap_parloop_struct_235557->free_min_res_203749;
    bool loop_cond_203754 =
         futhark_mc_segmap_parloop_struct_235557->free_loop_cond_203754;
    double i64_res_203755 =
           futhark_mc_segmap_parloop_struct_235557->free_i64_res_203755;
    int64_t gtid_207209 =
            futhark_mc_segmap_parloop_struct_235557->free_gtid_207209;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235557->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235557->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235557->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235557->free_bytes_217545;
    struct memblock mem_217598 = {.desc ="mem_217598", .mem =
                                  futhark_mc_segmap_parloop_struct_235557->free_mem_217598,
                                  .size =0, .references =NULL};
    struct memblock mem_217602 = {.desc ="mem_217602", .mem =
                                  futhark_mc_segmap_parloop_struct_235557->free_mem_217602,
                                  .size =0, .references =NULL};
    size_t mem_221727_cached_sizze_235559 = 0;
    unsigned char *mem_221727 = NULL;
    size_t mem_221742_cached_sizze_235560 = 0;
    unsigned char *mem_221742 = NULL;
    size_t mem_221744_cached_sizze_235561 = 0;
    unsigned char *mem_221744 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221858 = start;
    
    if (mem_221727_cached_sizze_235559 < (size_t) bytes_217345) {
        mem_221727 = realloc(mem_221727, bytes_217345);
        mem_221727_cached_sizze_235559 = bytes_217345;
    }
    if (mem_221742_cached_sizze_235560 < (size_t) bytes_217545) {
        mem_221742 = realloc(mem_221742, bytes_217545);
        mem_221742_cached_sizze_235560 = bytes_217545;
    }
    if (mem_221744_cached_sizze_235561 < (size_t) bytes_217545) {
        mem_221744 = realloc(mem_221744, bytes_217545);
        mem_221744_cached_sizze_235561 = bytes_217545;
    }
    for (; iter_221858 < end; iter_221858++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221971 = n_p_203492;
        int64_t gtid_221725 = iter_221858;
        int64_t remnant_221972 = iter_221858 - gtid_221725;
        int64_t x_221726;
        
        x_221726 = ((int64_t *) mem_217540.mem)[gtid_207209 * n_p_203492 +
                                                gtid_221725];
        for (int64_t i_221859 = 0; i_221859 < defunc_0_f_res_203631;
             i_221859++) {
            int64_t x_221861;
            
            x_221861 = ((int64_t *) mem_217536.mem)[gtid_207209 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_221725 *
                                                    defunc_0_f_res_203631 +
                                                    i_221859];
            
            int64_t defunc_0_f_res_221862 = add64((int64_t) 1, x_221861);
            
            ((int64_t *) mem_221727)[i_221859] = defunc_0_f_res_221862;
        }
        
        int64_t min_arg_221735 = sub64(x_221726, (int64_t) 1);
        int64_t min_arg_221736 = sub64(x_221726, min_res_203749);
        int64_t min_res_221737 = smin64(q_s_203493, x_221726);
        double i64_res_221738 = sitofp_i64_f64(x_221726);
        double x_221739 = i64_res_203755 - i64_res_221738;
        double max_arg_221740 = x_221739 / 2.0;
        double max_res_221741 = fmax64(0.0, max_arg_221740);
        
        for (int64_t i_221864 = 0; i_221864 < s_n_m_203636; i_221864++) {
            bool cond_221867 = i_221864 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_221868;
            
            if (cond_221867) {
                defunc_0_m_fun_res_221868 = (int64_t) 0;
            } else {
                int64_t y_221869 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_221870 = i_221864 == y_221869;
                int64_t defunc_0_m_fun_res_f_res_221871;
                
                if (cond_221870) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_221872 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_221871 =
                        defunc_0_m_fun_res_f_res_t_res_221872;
                } else {
                    int64_t x_221873 = sub64(i_221864, (int64_t) 1);
                    int64_t x_221874 = mul64(jump_s_203499, x_221873);
                    int64_t min_arg_221875 = add64((int64_t) 1, x_221874);
                    int64_t min_res_221876 = smin64(defunc_0_f_res_203631,
                                                    min_arg_221875);
                    
                    defunc_0_m_fun_res_f_res_221871 = min_res_221876;
                }
                defunc_0_m_fun_res_221868 = defunc_0_m_fun_res_f_res_221871;
            }
            
            bool init_idx_221877;
            int64_t init_idx_221878;
            int64_t init_idx_221879;
            bool loop_while_221880;
            int64_t low_221881;
            int64_t high_221882;
            
            loop_while_221880 = x_203719;
            low_221881 = (int64_t) 0;
            high_221882 = i_203718;
            while (loop_while_221880) {
                int64_t x_221883 = add64(low_221881, high_221882);
                int64_t mid_221884 = sdiv64(x_221883, (int64_t) 2);
                bool x_221885 = sle64((int64_t) 0, mid_221884);
                bool y_221886 = slt64(mid_221884, defunc_0_f_res_203631);
                bool bounds_check_221887 = x_221885 && y_221886;
                bool index_certs_221888;
                
                if (!bounds_check_221887) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_221884,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203631, "].",
                                  "-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_221889;
                
                mid_id_221889 = ((int64_t *) mem_221727)[mid_221884];
                
                bool cond_221890 = slt64(mid_id_221889, (int64_t) 0);
                int64_t mid_idx_221891;
                
                if (cond_221890) {
                    mid_idx_221891 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_221891 = mid_id_221889;
                }
                
                bool cond_221892 = sle64(defunc_0_m_fun_res_221868,
                                         mid_idx_221891);
                int64_t loopres_221893;
                int64_t loopres_221894;
                
                if (cond_221892) {
                    int64_t loopres_t_res_221895 = sub64(mid_221884,
                                                         (int64_t) 1);
                    
                    loopres_221893 = low_221881;
                    loopres_221894 = loopres_t_res_221895;
                } else {
                    int64_t loopres_f_res_221896 = add64((int64_t) 1,
                                                         mid_221884);
                    
                    loopres_221893 = loopres_f_res_221896;
                    loopres_221894 = high_221882;
                }
                
                bool loop_cond_221897 = sle64(loopres_221893, loopres_221894);
                bool loop_while_tmp_221976 = loop_cond_221897;
                int64_t low_tmp_221977 = loopres_221893;
                int64_t high_tmp_221978 = loopres_221894;
                
                loop_while_221880 = loop_while_tmp_221976;
                low_221881 = low_tmp_221977;
                high_221882 = high_tmp_221978;
            }
            init_idx_221877 = loop_while_221880;
            init_idx_221878 = low_221881;
            init_idx_221879 = high_221882;
            
            bool idx_221898;
            int64_t idx_221899;
            int64_t idx_221900;
            int64_t idx_221901;
            bool loop_while_221902;
            int64_t l_idx_221903;
            int64_t r_idx_221904;
            int64_t span_221905;
            
            loop_while_221902 = loop_cond_203754;
            l_idx_221903 = init_idx_221878;
            r_idx_221904 = init_idx_221878;
            span_221905 = (int64_t) 1;
            while (loop_while_221902) {
                int64_t max_arg_221906 = sub64(l_idx_221903, (int64_t) 1);
                int64_t max_res_221907 = smax64((int64_t) 0, max_arg_221906);
                int64_t min_arg_221908 = add64((int64_t) 1, r_idx_221904);
                int64_t min_res_221909 = smin64(min_arg_221735, min_arg_221908);
                bool x_221910 = sle64((int64_t) 0, max_res_221907);
                bool y_221911 = slt64(max_res_221907, defunc_0_f_res_203631);
                bool bounds_check_221912 = x_221910 && y_221911;
                bool index_certs_221913;
                
                if (!bounds_check_221912) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_221907,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203631, "].",
                                  "-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_221914;
                
                x_221914 = ((int64_t *) mem_221727)[max_res_221907];
                
                int64_t abs_arg_221915 = sub64(x_221914,
                                               defunc_0_m_fun_res_221868);
                int64_t abs_res_221916 = abs64(abs_arg_221915);
                bool x_221917 = sle64((int64_t) 0, min_res_221909);
                bool y_221918 = slt64(min_res_221909, defunc_0_f_res_203631);
                bool bounds_check_221919 = x_221917 && y_221918;
                bool index_certs_221920;
                
                if (!bounds_check_221919) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_221909,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203631, "].",
                                  "-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_221921;
                
                x_221921 = ((int64_t *) mem_221727)[min_res_221909];
                
                int64_t abs_arg_221922 = sub64(x_221921,
                                               defunc_0_m_fun_res_221868);
                int64_t abs_res_221923 = abs64(abs_arg_221922);
                bool cond_221924 = max_res_221907 == l_idx_221903;
                int64_t loopres_221925;
                int64_t loopres_221926;
                int64_t loopres_221927;
                
                if (cond_221924) {
                    loopres_221925 = l_idx_221903;
                    loopres_221926 = r_idx_221904;
                    loopres_221927 = min_res_203749;
                } else {
                    bool cond_221928 = slt64(abs_res_221916, abs_res_221923);
                    bool cond_f_res_221929 = min_res_221909 == r_idx_221904;
                    bool x_221930 = !cond_221928;
                    bool y_221931 = cond_f_res_221929 && x_221930;
                    bool cond_221932 = cond_221928 || y_221931;
                    int64_t loopres_f_res_221933;
                    
                    if (cond_221932) {
                        loopres_f_res_221933 = max_res_221907;
                    } else {
                        loopres_f_res_221933 = l_idx_221903;
                    }
                    
                    int64_t loopres_f_res_221934;
                    
                    if (cond_221932) {
                        loopres_f_res_221934 = r_idx_221904;
                    } else {
                        loopres_f_res_221934 = min_res_221909;
                    }
                    
                    int64_t loopres_f_res_221935;
                    
                    if (cond_221932) {
                        int64_t loopres_f_res_t_res_221936 = add64((int64_t) 1,
                                                                   span_221905);
                        
                        loopres_f_res_221935 = loopres_f_res_t_res_221936;
                    } else {
                        int64_t loopres_f_res_f_res_221937 = add64((int64_t) 1,
                                                                   span_221905);
                        
                        loopres_f_res_221935 = loopres_f_res_f_res_221937;
                    }
                    loopres_221925 = loopres_f_res_221933;
                    loopres_221926 = loopres_f_res_221934;
                    loopres_221927 = loopres_f_res_221935;
                }
                
                bool loop_cond_221938 = slt64(loopres_221927, min_res_203749);
                bool loop_while_tmp_221979 = loop_cond_221938;
                int64_t l_idx_tmp_221980 = loopres_221925;
                int64_t r_idx_tmp_221981 = loopres_221926;
                int64_t span_tmp_221982 = loopres_221927;
                
                loop_while_221902 = loop_while_tmp_221979;
                l_idx_221903 = l_idx_tmp_221980;
                r_idx_221904 = r_idx_tmp_221981;
                span_221905 = span_tmp_221982;
            }
            idx_221898 = loop_while_221902;
            idx_221899 = l_idx_221903;
            idx_221900 = r_idx_221904;
            idx_221901 = span_221905;
            
            int64_t min_res_221939 = smin64(min_arg_221736, idx_221899);
            int64_t max_res_221940 = smax64((int64_t) 0, min_res_221939);
            int64_t defunc_0_m_fun_res_221941;
            
            if (cond_221867) {
                defunc_0_m_fun_res_221941 = (int64_t) 0;
            } else {
                int64_t y_221942 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_221943 = i_221864 == y_221942;
                int64_t defunc_0_m_fun_res_f_res_221944;
                
                if (cond_221943) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_221945 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_221944 =
                        defunc_0_m_fun_res_f_res_t_res_221945;
                } else {
                    int64_t x_221946 = sub64(i_221864, (int64_t) 1);
                    int64_t x_221947 = mul64(jump_s_203499, x_221946);
                    int64_t min_arg_221948 = add64((int64_t) 1, x_221947);
                    int64_t min_res_221949 = smin64(defunc_0_f_res_203631,
                                                    min_arg_221948);
                    
                    defunc_0_m_fun_res_f_res_221944 = min_res_221949;
                }
                defunc_0_m_fun_res_221941 = defunc_0_m_fun_res_f_res_221944;
            }
            
            int64_t x_221950 = add64(min_res_221737, max_res_221940);
            int64_t r_221951 = sub64(x_221950, (int64_t) 1);
            bool x_221952 = sle64((int64_t) 0, r_221951);
            bool y_221953 = slt64(r_221951, defunc_0_f_res_203631);
            bool bounds_check_221954 = x_221952 && y_221953;
            bool index_certs_221955;
            
            if (!bounds_check_221954) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_221951,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203631, "].",
                              "-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:518:16-54\n   #5  stl.fut:142:20-80\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:141:12-143:40\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:140:5-144:36\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_221956;
            
            x_221956 = ((int64_t *) mem_221727)[r_221951];
            
            int64_t abs_arg_221957 = sub64(x_221956, defunc_0_m_fun_res_221941);
            int64_t abs_res_221958 = abs64(abs_arg_221957);
            bool x_221959 = sle64((int64_t) 0, max_res_221940);
            bool y_221960 = slt64(max_res_221940, defunc_0_f_res_203631);
            bool bounds_check_221961 = x_221959 && y_221960;
            bool index_certs_221962;
            
            if (!bounds_check_221961) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_221940,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203631, "].",
                              "-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:518:16-54\n   #5  stl.fut:142:20-80\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:141:12-143:40\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:140:5-144:36\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_221963;
            
            x_221963 = ((int64_t *) mem_221727)[max_res_221940];
            
            int64_t abs_arg_221964 = sub64(x_221963, defunc_0_m_fun_res_221941);
            int64_t abs_res_221965 = abs64(abs_arg_221964);
            int64_t max_res_221966 = smax64(abs_res_221958, abs_res_221965);
            double defunc_0_f_res_221967 = sitofp_i64_f64(max_res_221966);
            double defunc_1_f_res_221968 = max_res_221741 +
                   defunc_0_f_res_221967;
            
            ((double *) mem_221742)[i_221864] = defunc_1_f_res_221968;
            ((int64_t *) mem_221744)[i_221864] = max_res_221940;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217598.mem + gtid_221725 * s_n_m_203636 * (int64_t) 8,
                    mem_221744 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217602.mem + gtid_221725 * s_n_m_203636 * (int64_t) 8,
                    mem_221742 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221727);
    free(mem_221742);
    free(mem_221744);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235558_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235558_end -
                 futhark_mc_segmap_parloop_235558_start;
        
        ctx->futhark_mc_segmap_parloop_235558_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235558_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235558_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235556(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221724 = tid;
    int num_tasks_221857 = info.nsubtasks;
    struct futhark_mc_task_235555 *futhark_mc_task_235555 =
                                  (struct futhark_mc_task_235555 *) args;
    struct futhark_context *ctx = futhark_mc_task_235555->ctx;
    uint64_t futhark_mc_segmap_task_235556_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235556_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235555->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235555->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235555->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235555->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235555->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235555->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_task_235555->free_i_203718;
    bool x_203719 = futhark_mc_task_235555->free_x_203719;
    int64_t min_res_203749 = futhark_mc_task_235555->free_min_res_203749;
    bool loop_cond_203754 = futhark_mc_task_235555->free_loop_cond_203754;
    double i64_res_203755 = futhark_mc_task_235555->free_i64_res_203755;
    int64_t gtid_207209 = futhark_mc_task_235555->free_gtid_207209;
    int64_t bytes_217345 = futhark_mc_task_235555->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235555->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235555->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235555->free_bytes_217545;
    struct memblock mem_217598 = {.desc ="mem_217598", .mem =
                                  futhark_mc_task_235555->free_mem_217598,
                                  .size =0, .references =NULL};
    struct memblock mem_217602 = {.desc ="mem_217602", .mem =
                                  futhark_mc_task_235555->free_mem_217602,
                                  .size =0, .references =NULL};
    int64_t iter_221858;
    struct futhark_mc_segmap_parloop_struct_235557
    futhark_mc_segmap_parloop_struct_235557;
    
    futhark_mc_segmap_parloop_struct_235557.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235557.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235557.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235557.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235557.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235557.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235557.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235557.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235557.free_x_203719 = x_203719;
    futhark_mc_segmap_parloop_struct_235557.free_min_res_203749 =
        min_res_203749;
    futhark_mc_segmap_parloop_struct_235557.free_loop_cond_203754 =
        loop_cond_203754;
    futhark_mc_segmap_parloop_struct_235557.free_i64_res_203755 =
        i64_res_203755;
    futhark_mc_segmap_parloop_struct_235557.free_gtid_207209 = gtid_207209;
    futhark_mc_segmap_parloop_struct_235557.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235557.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235557.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235557.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235557.free_mem_217598 = mem_217598.mem;
    futhark_mc_segmap_parloop_struct_235557.free_mem_217602 = mem_217602.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235558_task;
    
    futhark_mc_segmap_parloop_235558_task.name =
        "futhark_mc_segmap_parloop_235558";
    futhark_mc_segmap_parloop_235558_task.fn = futhark_mc_segmap_parloop_235558;
    futhark_mc_segmap_parloop_235558_task.args =
        &futhark_mc_segmap_parloop_struct_235557;
    futhark_mc_segmap_parloop_235558_task.iterations = iterations;
    futhark_mc_segmap_parloop_235558_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235558_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235558_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235558_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235558_task);
    
    if (futhark_mc_segmap_parloop_235558_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235558_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235558_total_end -
                 futhark_mc_segmap_parloop_235558_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235558_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235558_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235558_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235556_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235556_end -
                 futhark_mc_segmap_task_235556_start;
        
        ctx->futhark_mc_segmap_task_235556_runs[tid]++;
        ctx->futhark_mc_segmap_task_235556_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235556_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235563 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    double free_i64_res_203755;
    int64_t free_gtid_207209;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217598;
    unsigned char *free_mem_217602;
};
struct futhark_mc_task_235568 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_207209;
    unsigned char *free_mem_217536;
    int64_t free_gtid_221601;
    unsigned char *free_mem_221603;
};
struct futhark_mc_segmap_parloop_struct_235570 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_207209;
    unsigned char *free_mem_217536;
    int64_t free_gtid_221601;
    unsigned char *free_mem_221603;
};
static int futhark_mc_segmap_parloop_235571(void *args, int64_t start,
                                            int64_t end, int flat_tid_221984,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235570
    *futhark_mc_segmap_parloop_struct_235570 =
    (struct futhark_mc_segmap_parloop_struct_235570 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235570->ctx;
    uint64_t futhark_mc_segmap_parloop_235571_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235571_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235570->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235570->free_defunc_0_f_res_203631;
    int64_t gtid_207209 =
            futhark_mc_segmap_parloop_struct_235570->free_gtid_207209;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235570->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t gtid_221601 =
            futhark_mc_segmap_parloop_struct_235570->free_gtid_221601;
    struct memblock mem_221603 = {.desc ="mem_221603", .mem =
                                  futhark_mc_segmap_parloop_struct_235570->free_mem_221603,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222095 = start;
    
    for (; iter_222095 < end; iter_222095++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222096 = defunc_0_f_res_203631;
        int64_t gtid_221985 = iter_222095;
        int64_t remnant_222097 = iter_222095 - gtid_221985;
        int64_t x_221986;
        
        x_221986 = ((int64_t *) mem_217536.mem)[gtid_207209 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_221601 *
                                                defunc_0_f_res_203631 +
                                                gtid_221985];
        
        int64_t defunc_0_f_res_221987 = add64((int64_t) 1, x_221986);
        
        ((int64_t *) mem_221603.mem)[gtid_221985] = defunc_0_f_res_221987;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235571_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235571_end -
                 futhark_mc_segmap_parloop_235571_start;
        
        ctx->futhark_mc_segmap_parloop_235571_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235571_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235571_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235569(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221984 = tid;
    int num_tasks_222094 = info.nsubtasks;
    struct futhark_mc_task_235568 *futhark_mc_task_235568 =
                                  (struct futhark_mc_task_235568 *) args;
    struct futhark_context *ctx = futhark_mc_task_235568->ctx;
    uint64_t futhark_mc_segmap_task_235569_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235569_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235568->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235568->free_defunc_0_f_res_203631;
    int64_t gtid_207209 = futhark_mc_task_235568->free_gtid_207209;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235568->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t gtid_221601 = futhark_mc_task_235568->free_gtid_221601;
    struct memblock mem_221603 = {.desc ="mem_221603", .mem =
                                  futhark_mc_task_235568->free_mem_221603,
                                  .size =0, .references =NULL};
    int64_t iter_222095;
    struct futhark_mc_segmap_parloop_struct_235570
    futhark_mc_segmap_parloop_struct_235570;
    
    futhark_mc_segmap_parloop_struct_235570.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235570.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235570.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235570.free_gtid_207209 = gtid_207209;
    futhark_mc_segmap_parloop_struct_235570.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235570.free_gtid_221601 = gtid_221601;
    futhark_mc_segmap_parloop_struct_235570.free_mem_221603 = mem_221603.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235571_task;
    
    futhark_mc_segmap_parloop_235571_task.name =
        "futhark_mc_segmap_parloop_235571";
    futhark_mc_segmap_parloop_235571_task.fn = futhark_mc_segmap_parloop_235571;
    futhark_mc_segmap_parloop_235571_task.args =
        &futhark_mc_segmap_parloop_struct_235570;
    futhark_mc_segmap_parloop_235571_task.iterations = iterations;
    futhark_mc_segmap_parloop_235571_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235571_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235571_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235571_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235571_task);
    
    if (futhark_mc_segmap_parloop_235571_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235571_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235571_total_end -
                 futhark_mc_segmap_parloop_235571_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235571_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235571_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235571_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235569_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235569_end -
                 futhark_mc_segmap_task_235569_start;
        
        ctx->futhark_mc_segmap_task_235569_runs[tid]++;
        ctx->futhark_mc_segmap_task_235569_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235569_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235572 {
    struct futhark_context *ctx;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    unsigned char *free_mem_221603;
    int64_t free_min_arg_221609;
    int64_t free_min_arg_221610;
    int64_t free_min_res_221611;
    double free_max_res_221615;
    unsigned char *free_mem_221616;
    unsigned char *free_mem_221617;
};
struct futhark_mc_segmap_parloop_struct_235574 {
    struct futhark_context *ctx;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_i_203718;
    bool free_x_203719;
    int64_t free_min_res_203749;
    bool free_loop_cond_203754;
    unsigned char *free_mem_221603;
    int64_t free_min_arg_221609;
    int64_t free_min_arg_221610;
    int64_t free_min_res_221611;
    double free_max_res_221615;
    unsigned char *free_mem_221616;
    unsigned char *free_mem_221617;
};
static int futhark_mc_segmap_parloop_235575(void *args, int64_t start,
                                            int64_t end, int flat_tid_221988,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235574
    *futhark_mc_segmap_parloop_struct_235574 =
    (struct futhark_mc_segmap_parloop_struct_235574 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235574->ctx;
    uint64_t futhark_mc_segmap_parloop_235575_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235575_start = get_wall_time();
    
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235574->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235574->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235574->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235574->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235574->free_i_203718;
    bool x_203719 = futhark_mc_segmap_parloop_struct_235574->free_x_203719;
    int64_t min_res_203749 =
            futhark_mc_segmap_parloop_struct_235574->free_min_res_203749;
    bool loop_cond_203754 =
         futhark_mc_segmap_parloop_struct_235574->free_loop_cond_203754;
    struct memblock mem_221603 = {.desc ="mem_221603", .mem =
                                  futhark_mc_segmap_parloop_struct_235574->free_mem_221603,
                                  .size =0, .references =NULL};
    int64_t min_arg_221609 =
            futhark_mc_segmap_parloop_struct_235574->free_min_arg_221609;
    int64_t min_arg_221610 =
            futhark_mc_segmap_parloop_struct_235574->free_min_arg_221610;
    int64_t min_res_221611 =
            futhark_mc_segmap_parloop_struct_235574->free_min_res_221611;
    double max_res_221615 =
           futhark_mc_segmap_parloop_struct_235574->free_max_res_221615;
    struct memblock mem_221616 = {.desc ="mem_221616", .mem =
                                  futhark_mc_segmap_parloop_struct_235574->free_mem_221616,
                                  .size =0, .references =NULL};
    struct memblock mem_221617 = {.desc ="mem_221617", .mem =
                                  futhark_mc_segmap_parloop_struct_235574->free_mem_221617,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222099 = start;
    
    for (; iter_222099 < end; iter_222099++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222171 = s_n_m_203636;
        int64_t gtid_221989 = iter_222099;
        int64_t remnant_222172 = iter_222099 - gtid_221989;
        bool cond_221990 = gtid_221989 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_221991;
        
        if (cond_221990) {
            defunc_0_m_fun_res_221991 = (int64_t) 0;
        } else {
            int64_t y_222100 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_222101 = gtid_221989 == y_222100;
            int64_t defunc_0_m_fun_res_f_res_222102;
            
            if (cond_222101) {
                int64_t defunc_0_m_fun_res_f_res_t_res_222103 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_222102 =
                    defunc_0_m_fun_res_f_res_t_res_222103;
            } else {
                int64_t x_222104 = sub64(gtid_221989, (int64_t) 1);
                int64_t x_222105 = mul64(jump_s_203499, x_222104);
                int64_t min_arg_222106 = add64((int64_t) 1, x_222105);
                int64_t min_res_222107 = smin64(defunc_0_f_res_203631,
                                                min_arg_222106);
                
                defunc_0_m_fun_res_f_res_222102 = min_res_222107;
            }
            defunc_0_m_fun_res_221991 = defunc_0_m_fun_res_f_res_222102;
        }
        
        bool init_idx_222000;
        int64_t init_idx_222001;
        int64_t init_idx_222002;
        bool loop_while_222108;
        int64_t low_222109;
        int64_t high_222110;
        
        loop_while_222108 = x_203719;
        low_222109 = (int64_t) 0;
        high_222110 = i_203718;
        while (loop_while_222108) {
            int64_t x_222111 = add64(low_222109, high_222110);
            int64_t mid_222112 = sdiv64(x_222111, (int64_t) 2);
            bool x_222113 = sle64((int64_t) 0, mid_222112);
            bool y_222114 = slt64(mid_222112, defunc_0_f_res_203631);
            bool bounds_check_222115 = x_222113 && y_222114;
            bool index_certs_222116;
            
            if (!bounds_check_222115) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_222112,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203631, "].",
                              "-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_222117;
            
            mid_id_222117 = ((int64_t *) mem_221603.mem)[mid_222112];
            
            bool cond_222118 = slt64(mid_id_222117, (int64_t) 0);
            int64_t mid_idx_222119;
            
            if (cond_222118) {
                mid_idx_222119 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_222119 = mid_id_222117;
            }
            
            bool cond_222120 = sle64(defunc_0_m_fun_res_221991, mid_idx_222119);
            int64_t loopres_222121;
            int64_t loopres_222122;
            
            if (cond_222120) {
                int64_t loopres_t_res_222123 = sub64(mid_222112, (int64_t) 1);
                
                loopres_222121 = low_222109;
                loopres_222122 = loopres_t_res_222123;
            } else {
                int64_t loopres_f_res_222124 = add64((int64_t) 1, mid_222112);
                
                loopres_222121 = loopres_f_res_222124;
                loopres_222122 = high_222110;
            }
            
            bool loop_cond_222125 = sle64(loopres_222121, loopres_222122);
            bool loop_while_tmp_222173 = loop_cond_222125;
            int64_t low_tmp_222174 = loopres_222121;
            int64_t high_tmp_222175 = loopres_222122;
            
            loop_while_222108 = loop_while_tmp_222173;
            low_222109 = low_tmp_222174;
            high_222110 = high_tmp_222175;
        }
        init_idx_222000 = loop_while_222108;
        init_idx_222001 = low_222109;
        init_idx_222002 = high_222110;
        
        bool idx_222021;
        int64_t idx_222022;
        int64_t idx_222023;
        int64_t idx_222024;
        bool loop_while_222126;
        int64_t l_idx_222127;
        int64_t r_idx_222128;
        int64_t span_222129;
        
        loop_while_222126 = loop_cond_203754;
        l_idx_222127 = init_idx_222001;
        r_idx_222128 = init_idx_222001;
        span_222129 = (int64_t) 1;
        while (loop_while_222126) {
            int64_t max_arg_222130 = sub64(l_idx_222127, (int64_t) 1);
            int64_t max_res_222131 = smax64((int64_t) 0, max_arg_222130);
            int64_t min_arg_222132 = add64((int64_t) 1, r_idx_222128);
            int64_t min_res_222133 = smin64(min_arg_221609, min_arg_222132);
            bool x_222134 = sle64((int64_t) 0, max_res_222131);
            bool y_222135 = slt64(max_res_222131, defunc_0_f_res_203631);
            bool bounds_check_222136 = x_222134 && y_222135;
            bool index_certs_222137;
            
            if (!bounds_check_222136) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222131,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203631, "].",
                              "-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222138;
            
            x_222138 = ((int64_t *) mem_221603.mem)[max_res_222131];
            
            int64_t abs_arg_222139 = sub64(x_222138, defunc_0_m_fun_res_221991);
            int64_t abs_res_222140 = abs64(abs_arg_222139);
            bool x_222141 = sle64((int64_t) 0, min_res_222133);
            bool y_222142 = slt64(min_res_222133, defunc_0_f_res_203631);
            bool bounds_check_222143 = x_222141 && y_222142;
            bool index_certs_222144;
            
            if (!bounds_check_222143) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_222133,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203631, "].",
                              "-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:517:15-50\n   #6  stl.fut:142:20-80\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:141:12-143:40\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:140:5-144:36\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222145;
            
            x_222145 = ((int64_t *) mem_221603.mem)[min_res_222133];
            
            int64_t abs_arg_222146 = sub64(x_222145, defunc_0_m_fun_res_221991);
            int64_t abs_res_222147 = abs64(abs_arg_222146);
            bool cond_222148 = max_res_222131 == l_idx_222127;
            int64_t loopres_222149;
            int64_t loopres_222150;
            int64_t loopres_222151;
            
            if (cond_222148) {
                loopres_222149 = l_idx_222127;
                loopres_222150 = r_idx_222128;
                loopres_222151 = min_res_203749;
            } else {
                bool cond_222152 = slt64(abs_res_222140, abs_res_222147);
                bool cond_f_res_222153 = min_res_222133 == r_idx_222128;
                bool x_222154 = !cond_222152;
                bool y_222155 = cond_f_res_222153 && x_222154;
                bool cond_222156 = cond_222152 || y_222155;
                int64_t loopres_f_res_222157;
                
                if (cond_222156) {
                    loopres_f_res_222157 = max_res_222131;
                } else {
                    loopres_f_res_222157 = l_idx_222127;
                }
                
                int64_t loopres_f_res_222158;
                
                if (cond_222156) {
                    loopres_f_res_222158 = r_idx_222128;
                } else {
                    loopres_f_res_222158 = min_res_222133;
                }
                
                int64_t loopres_f_res_222159;
                
                if (cond_222156) {
                    int64_t loopres_f_res_t_res_222160 = add64((int64_t) 1,
                                                               span_222129);
                    
                    loopres_f_res_222159 = loopres_f_res_t_res_222160;
                } else {
                    int64_t loopres_f_res_f_res_222161 = add64((int64_t) 1,
                                                               span_222129);
                    
                    loopres_f_res_222159 = loopres_f_res_f_res_222161;
                }
                loopres_222149 = loopres_f_res_222157;
                loopres_222150 = loopres_f_res_222158;
                loopres_222151 = loopres_f_res_222159;
            }
            
            bool loop_cond_222162 = slt64(loopres_222151, min_res_203749);
            bool loop_while_tmp_222176 = loop_cond_222162;
            int64_t l_idx_tmp_222177 = loopres_222149;
            int64_t r_idx_tmp_222178 = loopres_222150;
            int64_t span_tmp_222179 = loopres_222151;
            
            loop_while_222126 = loop_while_tmp_222176;
            l_idx_222127 = l_idx_tmp_222177;
            r_idx_222128 = r_idx_tmp_222178;
            span_222129 = span_tmp_222179;
        }
        idx_222021 = loop_while_222126;
        idx_222022 = l_idx_222127;
        idx_222023 = r_idx_222128;
        idx_222024 = span_222129;
        
        int64_t min_res_222062 = smin64(min_arg_221610, idx_222022);
        int64_t max_res_222063 = smax64((int64_t) 0, min_res_222062);
        int64_t defunc_0_m_fun_res_222064;
        
        if (cond_221990) {
            defunc_0_m_fun_res_222064 = (int64_t) 0;
        } else {
            int64_t y_222163 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_222164 = gtid_221989 == y_222163;
            int64_t defunc_0_m_fun_res_f_res_222165;
            
            if (cond_222164) {
                int64_t defunc_0_m_fun_res_f_res_t_res_222166 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_222165 =
                    defunc_0_m_fun_res_f_res_t_res_222166;
            } else {
                int64_t x_222167 = sub64(gtid_221989, (int64_t) 1);
                int64_t x_222168 = mul64(jump_s_203499, x_222167);
                int64_t min_arg_222169 = add64((int64_t) 1, x_222168);
                int64_t min_res_222170 = smin64(defunc_0_f_res_203631,
                                                min_arg_222169);
                
                defunc_0_m_fun_res_f_res_222165 = min_res_222170;
            }
            defunc_0_m_fun_res_222064 = defunc_0_m_fun_res_f_res_222165;
        }
        
        int64_t x_222073 = add64(min_res_221611, max_res_222063);
        int64_t r_222074 = sub64(x_222073, (int64_t) 1);
        bool x_222075 = sle64((int64_t) 0, r_222074);
        bool y_222076 = slt64(r_222074, defunc_0_f_res_203631);
        bool bounds_check_222077 = x_222075 && y_222076;
        bool index_certs_222078;
        
        if (!bounds_check_222077) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_222074,
                                   "] out of bounds for array of shape [",
                                   (long long) defunc_0_f_res_203631, "].",
                                   "-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:518:16-54\n   #5  stl.fut:142:20-80\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:141:12-143:40\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:140:5-144:36\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_222079;
        
        x_222079 = ((int64_t *) mem_221603.mem)[r_222074];
        
        int64_t abs_arg_222080 = sub64(x_222079, defunc_0_m_fun_res_222064);
        int64_t abs_res_222081 = abs64(abs_arg_222080);
        bool x_222082 = sle64((int64_t) 0, max_res_222063);
        bool y_222083 = slt64(max_res_222063, defunc_0_f_res_203631);
        bool bounds_check_222084 = x_222082 && y_222083;
        bool index_certs_222085;
        
        if (!bounds_check_222084) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_222063,
                                   "] out of bounds for array of shape [",
                                   (long long) defunc_0_f_res_203631, "].",
                                   "-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:518:16-54\n   #5  stl.fut:142:20-80\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:141:12-143:40\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:140:5-144:36\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_222086;
        
        x_222086 = ((int64_t *) mem_221603.mem)[max_res_222063];
        
        int64_t abs_arg_222087 = sub64(x_222086, defunc_0_m_fun_res_222064);
        int64_t abs_res_222088 = abs64(abs_arg_222087);
        int64_t max_res_222089 = smax64(abs_res_222081, abs_res_222088);
        double defunc_0_f_res_222090 = sitofp_i64_f64(max_res_222089);
        double defunc_1_f_res_222091 = max_res_221615 + defunc_0_f_res_222090;
        
        ((double *) mem_221616.mem)[gtid_221989] = defunc_1_f_res_222091;
        ((int64_t *) mem_221617.mem)[gtid_221989] = max_res_222063;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235575_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235575_end -
                 futhark_mc_segmap_parloop_235575_start;
        
        ctx->futhark_mc_segmap_parloop_235575_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235575_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235575_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235573(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221988 = tid;
    int num_tasks_222098 = info.nsubtasks;
    struct futhark_mc_task_235572 *futhark_mc_task_235572 =
                                  (struct futhark_mc_task_235572 *) args;
    struct futhark_context *ctx = futhark_mc_task_235572->ctx;
    uint64_t futhark_mc_segmap_task_235573_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235573_start = get_wall_time();
    
    int64_t jump_s_203499 = futhark_mc_task_235572->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235572->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235572->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235572->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_task_235572->free_i_203718;
    bool x_203719 = futhark_mc_task_235572->free_x_203719;
    int64_t min_res_203749 = futhark_mc_task_235572->free_min_res_203749;
    bool loop_cond_203754 = futhark_mc_task_235572->free_loop_cond_203754;
    struct memblock mem_221603 = {.desc ="mem_221603", .mem =
                                  futhark_mc_task_235572->free_mem_221603,
                                  .size =0, .references =NULL};
    int64_t min_arg_221609 = futhark_mc_task_235572->free_min_arg_221609;
    int64_t min_arg_221610 = futhark_mc_task_235572->free_min_arg_221610;
    int64_t min_res_221611 = futhark_mc_task_235572->free_min_res_221611;
    double max_res_221615 = futhark_mc_task_235572->free_max_res_221615;
    struct memblock mem_221616 = {.desc ="mem_221616", .mem =
                                  futhark_mc_task_235572->free_mem_221616,
                                  .size =0, .references =NULL};
    struct memblock mem_221617 = {.desc ="mem_221617", .mem =
                                  futhark_mc_task_235572->free_mem_221617,
                                  .size =0, .references =NULL};
    int64_t iter_222099;
    struct futhark_mc_segmap_parloop_struct_235574
    futhark_mc_segmap_parloop_struct_235574;
    
    futhark_mc_segmap_parloop_struct_235574.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235574.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235574.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235574.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235574.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235574.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235574.free_x_203719 = x_203719;
    futhark_mc_segmap_parloop_struct_235574.free_min_res_203749 =
        min_res_203749;
    futhark_mc_segmap_parloop_struct_235574.free_loop_cond_203754 =
        loop_cond_203754;
    futhark_mc_segmap_parloop_struct_235574.free_mem_221603 = mem_221603.mem;
    futhark_mc_segmap_parloop_struct_235574.free_min_arg_221609 =
        min_arg_221609;
    futhark_mc_segmap_parloop_struct_235574.free_min_arg_221610 =
        min_arg_221610;
    futhark_mc_segmap_parloop_struct_235574.free_min_res_221611 =
        min_res_221611;
    futhark_mc_segmap_parloop_struct_235574.free_max_res_221615 =
        max_res_221615;
    futhark_mc_segmap_parloop_struct_235574.free_mem_221616 = mem_221616.mem;
    futhark_mc_segmap_parloop_struct_235574.free_mem_221617 = mem_221617.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235575_task;
    
    futhark_mc_segmap_parloop_235575_task.name =
        "futhark_mc_segmap_parloop_235575";
    futhark_mc_segmap_parloop_235575_task.fn = futhark_mc_segmap_parloop_235575;
    futhark_mc_segmap_parloop_235575_task.args =
        &futhark_mc_segmap_parloop_struct_235574;
    futhark_mc_segmap_parloop_235575_task.iterations = iterations;
    futhark_mc_segmap_parloop_235575_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235575_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235575_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235575_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235575_task);
    
    if (futhark_mc_segmap_parloop_235575_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235575_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235575_total_end -
                 futhark_mc_segmap_parloop_235575_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235575_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235575_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235575_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235573_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235573_end -
                 futhark_mc_segmap_task_235573_start;
        
        ctx->futhark_mc_segmap_task_235573_runs[tid]++;
        ctx->futhark_mc_segmap_task_235573_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235573_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235564(void *args, int64_t start,
                                            int64_t end, int flat_tid_221600,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235563
    *futhark_mc_segmap_parloop_struct_235563 =
    (struct futhark_mc_segmap_parloop_struct_235563 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235563->ctx;
    uint64_t futhark_mc_segmap_parloop_235564_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235564_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235563->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235563->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235563->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235563->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235563->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235563->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235563->free_i_203718;
    bool x_203719 = futhark_mc_segmap_parloop_struct_235563->free_x_203719;
    int64_t min_res_203749 =
            futhark_mc_segmap_parloop_struct_235563->free_min_res_203749;
    bool loop_cond_203754 =
         futhark_mc_segmap_parloop_struct_235563->free_loop_cond_203754;
    double i64_res_203755 =
           futhark_mc_segmap_parloop_struct_235563->free_i64_res_203755;
    int64_t gtid_207209 =
            futhark_mc_segmap_parloop_struct_235563->free_gtid_207209;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235563->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235563->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235563->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235563->free_bytes_217545;
    struct memblock mem_217598 = {.desc ="mem_217598", .mem =
                                  futhark_mc_segmap_parloop_struct_235563->free_mem_217598,
                                  .size =0, .references =NULL};
    struct memblock mem_217602 = {.desc ="mem_217602", .mem =
                                  futhark_mc_segmap_parloop_struct_235563->free_mem_217602,
                                  .size =0, .references =NULL};
    size_t mem_221603_cached_sizze_235565 = 0;
    unsigned char *mem_221603 = NULL;
    size_t mem_221616_cached_sizze_235566 = 0;
    unsigned char *mem_221616 = NULL;
    size_t mem_221617_cached_sizze_235567 = 0;
    unsigned char *mem_221617 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221983 = start;
    
    if (mem_221603_cached_sizze_235565 < (size_t) bytes_217345) {
        mem_221603 = realloc(mem_221603, bytes_217345);
        mem_221603_cached_sizze_235565 = bytes_217345;
    }
    if (mem_221616_cached_sizze_235566 < (size_t) bytes_217545) {
        mem_221616 = realloc(mem_221616, bytes_217545);
        mem_221616_cached_sizze_235566 = bytes_217545;
    }
    if (mem_221617_cached_sizze_235567 < (size_t) bytes_217545) {
        mem_221617 = realloc(mem_221617, bytes_217545);
        mem_221617_cached_sizze_235567 = bytes_217545;
    }
    for (; iter_221983 < end; iter_221983++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222092 = n_p_203492;
        int64_t gtid_221601 = iter_221983;
        int64_t remnant_222093 = iter_221983 - gtid_221601;
        int64_t x_221602;
        
        x_221602 = ((int64_t *) mem_217540.mem)[gtid_207209 * n_p_203492 +
                                                gtid_221601];
        
        int64_t flat_tid_221984 = (int64_t) 0;
        int32_t num_tasks_222094;
        struct futhark_mc_task_235568 futhark_mc_task_235568;
        
        futhark_mc_task_235568.ctx = ctx;
        futhark_mc_task_235568.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235568.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235568.free_gtid_207209 = gtid_207209;
        futhark_mc_task_235568.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235568.free_gtid_221601 = gtid_221601;
        futhark_mc_task_235568.free_mem_221603 = mem_221603;
        
        struct scheduler_segop futhark_mc_task_235568_task;
        
        futhark_mc_task_235568_task.args = &futhark_mc_task_235568;
        futhark_mc_task_235568_task.top_level_fn =
            futhark_mc_segmap_task_235569;
        futhark_mc_task_235568_task.name = "futhark_mc_segmap_task_235569";
        futhark_mc_task_235568_task.iterations = defunc_0_f_res_203631;
        futhark_mc_task_235568_task.task_time =
            &ctx->futhark_mc_segmap_task_235569_total_time;
        futhark_mc_task_235568_task.task_iter =
            &ctx->futhark_mc_segmap_task_235569_total_iter;
        futhark_mc_task_235568_task.sched = STATIC;
        futhark_mc_task_235568_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235569_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235568_task);
        
        if (futhark_mc_segmap_task_235569_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_221609 = sub64(x_221602, (int64_t) 1);
        int64_t min_arg_221610 = sub64(x_221602, min_res_203749);
        int64_t min_res_221611 = smin64(q_s_203493, x_221602);
        double i64_res_221612 = sitofp_i64_f64(x_221602);
        double x_221613 = i64_res_203755 - i64_res_221612;
        double max_arg_221614 = x_221613 / 2.0;
        double max_res_221615 = fmax64(0.0, max_arg_221614);
        int64_t flat_tid_221988 = (int64_t) 0;
        int32_t num_tasks_222098;
        struct futhark_mc_task_235572 futhark_mc_task_235572;
        
        futhark_mc_task_235572.ctx = ctx;
        futhark_mc_task_235572.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235572.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235572.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235572.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235572.free_i_203718 = i_203718;
        futhark_mc_task_235572.free_x_203719 = x_203719;
        futhark_mc_task_235572.free_min_res_203749 = min_res_203749;
        futhark_mc_task_235572.free_loop_cond_203754 = loop_cond_203754;
        futhark_mc_task_235572.free_mem_221603 = mem_221603;
        futhark_mc_task_235572.free_min_arg_221609 = min_arg_221609;
        futhark_mc_task_235572.free_min_arg_221610 = min_arg_221610;
        futhark_mc_task_235572.free_min_res_221611 = min_res_221611;
        futhark_mc_task_235572.free_max_res_221615 = max_res_221615;
        futhark_mc_task_235572.free_mem_221616 = mem_221616;
        futhark_mc_task_235572.free_mem_221617 = mem_221617;
        
        struct scheduler_segop futhark_mc_task_235572_task;
        
        futhark_mc_task_235572_task.args = &futhark_mc_task_235572;
        futhark_mc_task_235572_task.top_level_fn =
            futhark_mc_segmap_task_235573;
        futhark_mc_task_235572_task.name = "futhark_mc_segmap_task_235573";
        futhark_mc_task_235572_task.iterations = s_n_m_203636;
        futhark_mc_task_235572_task.task_time =
            &ctx->futhark_mc_segmap_task_235573_total_time;
        futhark_mc_task_235572_task.task_iter =
            &ctx->futhark_mc_segmap_task_235573_total_iter;
        futhark_mc_task_235572_task.sched = DYNAMIC;
        futhark_mc_task_235572_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235573_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235572_task);
        
        if (futhark_mc_segmap_task_235573_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217598.mem + gtid_221601 * s_n_m_203636 * (int64_t) 8,
                    mem_221617 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217602.mem + gtid_221601 * s_n_m_203636 * (int64_t) 8,
                    mem_221616 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221603);
    free(mem_221616);
    free(mem_221617);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235564_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235564_end -
                 futhark_mc_segmap_parloop_235564_start;
        
        ctx->futhark_mc_segmap_parloop_235564_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235564_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235564_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235562(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221600 = tid;
    int num_tasks_221857 = info.nsubtasks;
    struct futhark_mc_task_235555 *futhark_mc_task_235555 =
                                  (struct futhark_mc_task_235555 *) args;
    struct futhark_context *ctx = futhark_mc_task_235555->ctx;
    uint64_t futhark_mc_segmap_nested_task_235562_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235562_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235555->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235555->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235555->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235555->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235555->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235555->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_task_235555->free_i_203718;
    bool x_203719 = futhark_mc_task_235555->free_x_203719;
    int64_t min_res_203749 = futhark_mc_task_235555->free_min_res_203749;
    bool loop_cond_203754 = futhark_mc_task_235555->free_loop_cond_203754;
    double i64_res_203755 = futhark_mc_task_235555->free_i64_res_203755;
    int64_t gtid_207209 = futhark_mc_task_235555->free_gtid_207209;
    int64_t bytes_217345 = futhark_mc_task_235555->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235555->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235555->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235555->free_bytes_217545;
    struct memblock mem_217598 = {.desc ="mem_217598", .mem =
                                  futhark_mc_task_235555->free_mem_217598,
                                  .size =0, .references =NULL};
    struct memblock mem_217602 = {.desc ="mem_217602", .mem =
                                  futhark_mc_task_235555->free_mem_217602,
                                  .size =0, .references =NULL};
    int64_t iter_221983;
    struct futhark_mc_segmap_parloop_struct_235563
    futhark_mc_segmap_parloop_struct_235563;
    
    futhark_mc_segmap_parloop_struct_235563.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235563.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235563.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235563.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235563.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235563.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235563.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235563.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235563.free_x_203719 = x_203719;
    futhark_mc_segmap_parloop_struct_235563.free_min_res_203749 =
        min_res_203749;
    futhark_mc_segmap_parloop_struct_235563.free_loop_cond_203754 =
        loop_cond_203754;
    futhark_mc_segmap_parloop_struct_235563.free_i64_res_203755 =
        i64_res_203755;
    futhark_mc_segmap_parloop_struct_235563.free_gtid_207209 = gtid_207209;
    futhark_mc_segmap_parloop_struct_235563.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235563.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235563.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235563.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235563.free_mem_217598 = mem_217598.mem;
    futhark_mc_segmap_parloop_struct_235563.free_mem_217602 = mem_217602.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235564_task;
    
    futhark_mc_segmap_parloop_235564_task.name =
        "futhark_mc_segmap_parloop_235564";
    futhark_mc_segmap_parloop_235564_task.fn = futhark_mc_segmap_parloop_235564;
    futhark_mc_segmap_parloop_235564_task.args =
        &futhark_mc_segmap_parloop_struct_235563;
    futhark_mc_segmap_parloop_235564_task.iterations = iterations;
    futhark_mc_segmap_parloop_235564_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235564_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235564_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235564_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235564_task);
    
    if (futhark_mc_segmap_parloop_235564_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235564_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235564_total_end -
                 futhark_mc_segmap_parloop_235564_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235564_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235564_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235564_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235562_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235562_end -
                 futhark_mc_segmap_nested_task_235562_start;
        
        ctx->futhark_mc_segmap_nested_task_235562_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235562_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235562_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235552(void *args, int64_t start,
                                            int64_t end, int flat_tid_207208,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235551
    *futhark_mc_segmap_parloop_struct_235551 =
    (struct futhark_mc_segmap_parloop_struct_235551 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235551->ctx;
    uint64_t futhark_mc_segmap_parloop_235552_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235552_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235551->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235551->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235551->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235551->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235551->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235551->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235551->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_segmap_parloop_struct_235551->free_i_203718;
    bool x_203719 = futhark_mc_segmap_parloop_struct_235551->free_x_203719;
    int64_t min_res_203749 =
            futhark_mc_segmap_parloop_struct_235551->free_min_res_203749;
    bool loop_cond_203754 =
         futhark_mc_segmap_parloop_struct_235551->free_loop_cond_203754;
    double i64_res_203755 =
           futhark_mc_segmap_parloop_struct_235551->free_i64_res_203755;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235551->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235551->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235551->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235551->free_bytes_217545;
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235551->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235551->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235551->free_mem_217715,
                                  .size =0, .references =NULL};
    size_t mem_217598_cached_sizze_235553 = 0;
    unsigned char *mem_217598 = NULL;
    size_t mem_217602_cached_sizze_235554 = 0;
    unsigned char *mem_217602 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221599 = start;
    
    if (mem_217598_cached_sizze_235553 < (size_t) bytes_217597) {
        mem_217598 = realloc(mem_217598, bytes_217597);
        mem_217598_cached_sizze_235553 = bytes_217597;
    }
    if (mem_217602_cached_sizze_235554 < (size_t) bytes_217597) {
        mem_217602 = realloc(mem_217602, bytes_217597);
        mem_217602_cached_sizze_235554 = bytes_217597;
    }
    for (; iter_221599 < end; iter_221599++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221855 = partition_sizze_203577;
        int64_t gtid_207209 = iter_221599;
        int64_t remnant_221856 = iter_221599 - gtid_207209;
        int64_t flat_tid_221724 = (int64_t) 0;
        int32_t num_tasks_221857;
        int64_t flat_tid_221600 = (int64_t) 0;
        struct futhark_mc_task_235555 futhark_mc_task_235555;
        
        futhark_mc_task_235555.ctx = ctx;
        futhark_mc_task_235555.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235555.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235555.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235555.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235555.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235555.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235555.free_i_203718 = i_203718;
        futhark_mc_task_235555.free_x_203719 = x_203719;
        futhark_mc_task_235555.free_min_res_203749 = min_res_203749;
        futhark_mc_task_235555.free_loop_cond_203754 = loop_cond_203754;
        futhark_mc_task_235555.free_i64_res_203755 = i64_res_203755;
        futhark_mc_task_235555.free_gtid_207209 = gtid_207209;
        futhark_mc_task_235555.free_bytes_217345 = bytes_217345;
        futhark_mc_task_235555.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235555.free_mem_217540 = mem_217540.mem;
        futhark_mc_task_235555.free_bytes_217545 = bytes_217545;
        futhark_mc_task_235555.free_mem_217598 = mem_217598;
        futhark_mc_task_235555.free_mem_217602 = mem_217602;
        
        struct scheduler_segop futhark_mc_task_235555_task;
        
        futhark_mc_task_235555_task.args = &futhark_mc_task_235555;
        futhark_mc_task_235555_task.top_level_fn =
            futhark_mc_segmap_task_235556;
        futhark_mc_task_235555_task.name = "futhark_mc_segmap_task_235556";
        futhark_mc_task_235555_task.iterations = n_p_203492;
        futhark_mc_task_235555_task.task_time =
            &ctx->futhark_mc_segmap_task_235556_total_time;
        futhark_mc_task_235555_task.task_iter =
            &ctx->futhark_mc_segmap_task_235556_total_iter;
        futhark_mc_task_235555_task.sched = DYNAMIC;
        futhark_mc_task_235555_task.nested_fn =
            futhark_mc_segmap_nested_task_235562;
        
        int futhark_mc_segmap_task_235556_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235555_task);
        
        if (futhark_mc_segmap_task_235556_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217710.mem + gtid_207209 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_217598 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_217715.mem + gtid_207209 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_217602 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217598);
    free(mem_217602);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235552_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235552_end -
                 futhark_mc_segmap_parloop_235552_start;
        
        ctx->futhark_mc_segmap_parloop_235552_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235552_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235552_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235550(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207208 = tid;
    int num_tasks_221456 = info.nsubtasks;
    struct futhark_mc_task_235543 *futhark_mc_task_235543 =
                                  (struct futhark_mc_task_235543 *) args;
    struct futhark_context *ctx = futhark_mc_task_235543->ctx;
    uint64_t futhark_mc_segmap_nested_task_235550_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235550_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235543->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235543->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235543->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235543->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235543->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235543->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235543->free_s_n_m_203636;
    int64_t i_203718 = futhark_mc_task_235543->free_i_203718;
    bool x_203719 = futhark_mc_task_235543->free_x_203719;
    int64_t min_res_203749 = futhark_mc_task_235543->free_min_res_203749;
    bool loop_cond_203754 = futhark_mc_task_235543->free_loop_cond_203754;
    double i64_res_203755 = futhark_mc_task_235543->free_i64_res_203755;
    int64_t bytes_217345 = futhark_mc_task_235543->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235543->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235543->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235543->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235543->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235543->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235543->free_mem_217715,
                                  .size =0, .references =NULL};
    int64_t iter_221599;
    struct futhark_mc_segmap_parloop_struct_235551
    futhark_mc_segmap_parloop_struct_235551;
    
    futhark_mc_segmap_parloop_struct_235551.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235551.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235551.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235551.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235551.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235551.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235551.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235551.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235551.free_i_203718 = i_203718;
    futhark_mc_segmap_parloop_struct_235551.free_x_203719 = x_203719;
    futhark_mc_segmap_parloop_struct_235551.free_min_res_203749 =
        min_res_203749;
    futhark_mc_segmap_parloop_struct_235551.free_loop_cond_203754 =
        loop_cond_203754;
    futhark_mc_segmap_parloop_struct_235551.free_i64_res_203755 =
        i64_res_203755;
    futhark_mc_segmap_parloop_struct_235551.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235551.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235551.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235551.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235551.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235551.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235551.free_mem_217715 = mem_217715.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235552_task;
    
    futhark_mc_segmap_parloop_235552_task.name =
        "futhark_mc_segmap_parloop_235552";
    futhark_mc_segmap_parloop_235552_task.fn = futhark_mc_segmap_parloop_235552;
    futhark_mc_segmap_parloop_235552_task.args =
        &futhark_mc_segmap_parloop_struct_235551;
    futhark_mc_segmap_parloop_235552_task.iterations = iterations;
    futhark_mc_segmap_parloop_235552_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235552_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235552_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235552_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235552_task);
    
    if (futhark_mc_segmap_parloop_235552_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235552_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235552_total_end -
                 futhark_mc_segmap_parloop_235552_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235552_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235552_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235552_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235550_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235550_end -
                 futhark_mc_segmap_nested_task_235550_start;
        
        ctx->futhark_mc_segmap_nested_task_235550_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235550_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235550_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235576 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_l_203501;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203881;
    bool free_loop_cond_203886;
    double free_i64_res_203887;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
};
struct futhark_mc_segmap_parloop_struct_235578 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_l_203501;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203881;
    bool free_loop_cond_203886;
    double free_i64_res_203887;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
};
static int futhark_mc_segmap_parloop_235579(void *args, int64_t start,
                                            int64_t end, int flat_tid_207456,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235578
    *futhark_mc_segmap_parloop_struct_235578 =
    (struct futhark_mc_segmap_parloop_struct_235578 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235578->ctx;
    uint64_t futhark_mc_segmap_parloop_235579_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235579_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235578->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_235578->free_q_l_203495;
    int64_t jump_l_203501 =
            futhark_mc_segmap_parloop_struct_235578->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235578->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_235578->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235578->free_i_203670;
    bool x_203671 = futhark_mc_segmap_parloop_struct_235578->free_x_203671;
    int64_t min_res_203881 =
            futhark_mc_segmap_parloop_struct_235578->free_min_res_203881;
    bool loop_cond_203886 =
         futhark_mc_segmap_parloop_struct_235578->free_loop_cond_203886;
    double i64_res_203887 =
           futhark_mc_segmap_parloop_struct_235578->free_i64_res_203887;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235578->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235578->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_235578->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_235578->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_235578->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_235578->free_mem_217777,
                                  .size =0, .references =NULL};
    size_t mem_217727_cached_sizze_235580 = 0;
    unsigned char *mem_217727 = NULL;
    size_t mem_217742_cached_sizze_235581 = 0;
    unsigned char *mem_217742 = NULL;
    size_t mem_217745_cached_sizze_235582 = 0;
    unsigned char *mem_217745 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222181 = start;
    
    if (mem_217727_cached_sizze_235580 < (size_t) bytes_217302) {
        mem_217727 = realloc(mem_217727, bytes_217302);
        mem_217727_cached_sizze_235580 = bytes_217302;
    }
    if (mem_217742_cached_sizze_235581 < (size_t) bytes_217720) {
        mem_217742 = realloc(mem_217742, bytes_217720);
        mem_217742_cached_sizze_235581 = bytes_217720;
    }
    if (mem_217745_cached_sizze_235582 < (size_t) bytes_217720) {
        mem_217745 = realloc(mem_217745, bytes_217720);
        mem_217745_cached_sizze_235582 = bytes_217720;
    }
    for (; iter_222181 < end; iter_222181++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222278 = partition_sizze_203577;
        int64_t gtid_207457 = iter_222181;
        int64_t remnant_222279 = iter_222181 - gtid_207457;
        int64_t x_203891;
        
        x_203891 = ((int64_t *) mem_217343.mem)[gtid_207457];
        for (int64_t i_222182 = 0; i_222182 < n_203490; i_222182++) {
            int64_t x_222184;
            
            x_222184 = ((int64_t *) mem_217340.mem)[gtid_207457 * n_203490 +
                                                    i_222182];
            
            int64_t defunc_0_f_res_222185 = add64((int64_t) 1, x_222184);
            
            ((int64_t *) mem_217727)[i_222182] = defunc_0_f_res_222185;
        }
        
        int64_t min_arg_203895 = sub64(x_203891, (int64_t) 1);
        int64_t min_arg_203896 = sub64(x_203891, min_res_203881);
        int64_t min_res_203897 = smin64(q_l_203495, x_203891);
        double i64_res_203898 = sitofp_i64_f64(x_203891);
        double x_203899 = i64_res_203887 - i64_res_203898;
        double max_arg_203900 = x_203899 / 2.0;
        double max_res_203901 = fmax64(0.0, max_arg_203900);
        
        for (int64_t i_222187 = 0; i_222187 < l_n_m_203643; i_222187++) {
            int64_t min_arg_222190 = mul64(jump_l_203501, i_222187);
            int64_t min_res_222191 = smin64(i_203670, min_arg_222190);
            int64_t defunc_0_g_res_222192 = add64((int64_t) 1, min_res_222191);
            bool init_idx_222193;
            int64_t init_idx_222194;
            int64_t init_idx_222195;
            bool loop_while_222196;
            int64_t low_222197;
            int64_t high_222198;
            
            loop_while_222196 = x_203671;
            low_222197 = (int64_t) 0;
            high_222198 = i_203670;
            while (loop_while_222196) {
                int64_t x_222199 = add64(low_222197, high_222198);
                int64_t mid_222200 = sdiv64(x_222199, (int64_t) 2);
                bool x_222201 = sle64((int64_t) 0, mid_222200);
                bool y_222202 = slt64(mid_222200, n_203490);
                bool bounds_check_222203 = x_222201 && y_222202;
                bool index_certs_222204;
                
                if (!bounds_check_222203) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_222200,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:150:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:148:5-151:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_222205;
                
                mid_id_222205 = ((int64_t *) mem_217727)[mid_222200];
                
                bool cond_222206 = slt64(mid_id_222205, (int64_t) 0);
                int64_t mid_idx_222207;
                
                if (cond_222206) {
                    mid_idx_222207 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_222207 = mid_id_222205;
                }
                
                bool cond_222208 = sle64(defunc_0_g_res_222192, mid_idx_222207);
                int64_t loopres_222209;
                int64_t loopres_222210;
                
                if (cond_222208) {
                    int64_t loopres_t_res_222211 = sub64(mid_222200,
                                                         (int64_t) 1);
                    
                    loopres_222209 = low_222197;
                    loopres_222210 = loopres_t_res_222211;
                } else {
                    int64_t loopres_f_res_222212 = add64((int64_t) 1,
                                                         mid_222200);
                    
                    loopres_222209 = loopres_f_res_222212;
                    loopres_222210 = high_222198;
                }
                
                bool loop_cond_222213 = sle64(loopres_222209, loopres_222210);
                bool loop_while_tmp_222283 = loop_cond_222213;
                int64_t low_tmp_222284 = loopres_222209;
                int64_t high_tmp_222285 = loopres_222210;
                
                loop_while_222196 = loop_while_tmp_222283;
                low_222197 = low_tmp_222284;
                high_222198 = high_tmp_222285;
            }
            init_idx_222193 = loop_while_222196;
            init_idx_222194 = low_222197;
            init_idx_222195 = high_222198;
            
            bool idx_222214;
            int64_t idx_222215;
            int64_t idx_222216;
            int64_t idx_222217;
            bool loop_while_222218;
            int64_t l_idx_222219;
            int64_t r_idx_222220;
            int64_t span_222221;
            
            loop_while_222218 = loop_cond_203886;
            l_idx_222219 = init_idx_222194;
            r_idx_222220 = init_idx_222194;
            span_222221 = (int64_t) 1;
            while (loop_while_222218) {
                int64_t max_arg_222222 = sub64(l_idx_222219, (int64_t) 1);
                int64_t max_res_222223 = smax64((int64_t) 0, max_arg_222222);
                int64_t min_arg_222224 = add64((int64_t) 1, r_idx_222220);
                int64_t min_res_222225 = smin64(min_arg_203895, min_arg_222224);
                bool x_222226 = sle64((int64_t) 0, max_res_222223);
                bool y_222227 = slt64(max_res_222223, n_203490);
                bool bounds_check_222228 = x_222226 && y_222227;
                bool index_certs_222229;
                
                if (!bounds_check_222228) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_222223,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:150:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:148:5-151:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_222230;
                
                x_222230 = ((int64_t *) mem_217727)[max_res_222223];
                
                int64_t abs_arg_222231 = sub64(x_222230, defunc_0_g_res_222192);
                int64_t abs_res_222232 = abs64(abs_arg_222231);
                bool x_222233 = sle64((int64_t) 0, min_res_222225);
                bool y_222234 = slt64(min_res_222225, n_203490);
                bool bounds_check_222235 = x_222233 && y_222234;
                bool index_certs_222236;
                
                if (!bounds_check_222235) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_222225,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:150:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:148:5-151:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_222237;
                
                x_222237 = ((int64_t *) mem_217727)[min_res_222225];
                
                int64_t abs_arg_222238 = sub64(x_222237, defunc_0_g_res_222192);
                int64_t abs_res_222239 = abs64(abs_arg_222238);
                bool cond_222240 = max_res_222223 == l_idx_222219;
                int64_t loopres_222241;
                int64_t loopres_222242;
                int64_t loopres_222243;
                
                if (cond_222240) {
                    loopres_222241 = l_idx_222219;
                    loopres_222242 = r_idx_222220;
                    loopres_222243 = min_res_203881;
                } else {
                    bool cond_222244 = slt64(abs_res_222232, abs_res_222239);
                    bool cond_f_res_222245 = min_res_222225 == r_idx_222220;
                    bool x_222246 = !cond_222244;
                    bool y_222247 = cond_f_res_222245 && x_222246;
                    bool cond_222248 = cond_222244 || y_222247;
                    int64_t loopres_f_res_222249;
                    
                    if (cond_222248) {
                        loopres_f_res_222249 = max_res_222223;
                    } else {
                        loopres_f_res_222249 = l_idx_222219;
                    }
                    
                    int64_t loopres_f_res_222250;
                    
                    if (cond_222248) {
                        loopres_f_res_222250 = r_idx_222220;
                    } else {
                        loopres_f_res_222250 = min_res_222225;
                    }
                    
                    int64_t loopres_f_res_222251;
                    
                    if (cond_222248) {
                        int64_t loopres_f_res_t_res_222252 = add64((int64_t) 1,
                                                                   span_222221);
                        
                        loopres_f_res_222251 = loopres_f_res_t_res_222252;
                    } else {
                        int64_t loopres_f_res_f_res_222253 = add64((int64_t) 1,
                                                                   span_222221);
                        
                        loopres_f_res_222251 = loopres_f_res_f_res_222253;
                    }
                    loopres_222241 = loopres_f_res_222249;
                    loopres_222242 = loopres_f_res_222250;
                    loopres_222243 = loopres_f_res_222251;
                }
                
                bool loop_cond_222254 = slt64(loopres_222243, min_res_203881);
                bool loop_while_tmp_222286 = loop_cond_222254;
                int64_t l_idx_tmp_222287 = loopres_222241;
                int64_t r_idx_tmp_222288 = loopres_222242;
                int64_t span_tmp_222289 = loopres_222243;
                
                loop_while_222218 = loop_while_tmp_222286;
                l_idx_222219 = l_idx_tmp_222287;
                r_idx_222220 = r_idx_tmp_222288;
                span_222221 = span_tmp_222289;
            }
            idx_222214 = loop_while_222218;
            idx_222215 = l_idx_222219;
            idx_222216 = r_idx_222220;
            idx_222217 = span_222221;
            
            int64_t min_res_222255 = smin64(min_arg_203896, idx_222215);
            int64_t max_res_222256 = smax64((int64_t) 0, min_res_222255);
            int64_t x_222257 = add64(min_res_203897, max_res_222256);
            int64_t r_222258 = sub64(x_222257, (int64_t) 1);
            bool x_222259 = sle64((int64_t) 0, r_222258);
            bool y_222260 = slt64(r_222258, n_203490);
            bool bounds_check_222261 = x_222259 && y_222260;
            bool index_certs_222262;
            
            if (!bounds_check_222261) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_222258,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:150:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:148:5-151:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222263;
            
            x_222263 = ((int64_t *) mem_217340.mem)[gtid_207457 * n_203490 +
                                                    r_222258];
            
            int64_t abs_arg_222264 = sub64(x_222263, min_res_222191);
            int64_t abs_res_222265 = abs64(abs_arg_222264);
            bool x_222266 = sle64((int64_t) 0, max_res_222256);
            bool y_222267 = slt64(max_res_222256, n_203490);
            bool bounds_check_222268 = x_222266 && y_222267;
            bool index_certs_222269;
            
            if (!bounds_check_222268) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222256,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:150:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:148:5-151:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222270;
            
            x_222270 = ((int64_t *) mem_217340.mem)[gtid_207457 * n_203490 +
                                                    max_res_222256];
            
            int64_t abs_arg_222271 = sub64(x_222270, min_res_222191);
            int64_t abs_res_222272 = abs64(abs_arg_222271);
            int64_t max_res_222273 = smax64(abs_res_222265, abs_res_222272);
            double defunc_0_f_res_222274 = sitofp_i64_f64(max_res_222273);
            double defunc_1_f_res_222275 = max_res_203901 +
                   defunc_0_f_res_222274;
            
            ((double *) mem_217742)[i_222187] = defunc_1_f_res_222275;
            ((int64_t *) mem_217745)[i_222187] = max_res_222256;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_217773.mem + gtid_207457 * l_n_m_203643 * (int64_t) 8,
                    mem_217745 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_217777.mem + gtid_207457 * l_n_m_203643 * (int64_t) 8,
                    mem_217742 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217727);
    free(mem_217742);
    free(mem_217745);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235579_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235579_end -
                 futhark_mc_segmap_parloop_235579_start;
        
        ctx->futhark_mc_segmap_parloop_235579_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235579_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235579_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235577(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207456 = tid;
    int num_tasks_222180 = info.nsubtasks;
    struct futhark_mc_task_235576 *futhark_mc_task_235576 =
                                  (struct futhark_mc_task_235576 *) args;
    struct futhark_context *ctx = futhark_mc_task_235576->ctx;
    uint64_t futhark_mc_segmap_task_235577_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235577_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235576->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_235576->free_q_l_203495;
    int64_t jump_l_203501 = futhark_mc_task_235576->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235576->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_235576->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_235576->free_i_203670;
    bool x_203671 = futhark_mc_task_235576->free_x_203671;
    int64_t min_res_203881 = futhark_mc_task_235576->free_min_res_203881;
    bool loop_cond_203886 = futhark_mc_task_235576->free_loop_cond_203886;
    double i64_res_203887 = futhark_mc_task_235576->free_i64_res_203887;
    int64_t bytes_217302 = futhark_mc_task_235576->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235576->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_235576->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217720 = futhark_mc_task_235576->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_235576->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_235576->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t iter_222181;
    struct futhark_mc_segmap_parloop_struct_235578
    futhark_mc_segmap_parloop_struct_235578;
    
    futhark_mc_segmap_parloop_struct_235578.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235578.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235578.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_235578.free_jump_l_203501 = jump_l_203501;
    futhark_mc_segmap_parloop_struct_235578.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235578.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_235578.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235578.free_x_203671 = x_203671;
    futhark_mc_segmap_parloop_struct_235578.free_min_res_203881 =
        min_res_203881;
    futhark_mc_segmap_parloop_struct_235578.free_loop_cond_203886 =
        loop_cond_203886;
    futhark_mc_segmap_parloop_struct_235578.free_i64_res_203887 =
        i64_res_203887;
    futhark_mc_segmap_parloop_struct_235578.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235578.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235578.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_235578.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_235578.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_235578.free_mem_217777 = mem_217777.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235579_task;
    
    futhark_mc_segmap_parloop_235579_task.name =
        "futhark_mc_segmap_parloop_235579";
    futhark_mc_segmap_parloop_235579_task.fn = futhark_mc_segmap_parloop_235579;
    futhark_mc_segmap_parloop_235579_task.args =
        &futhark_mc_segmap_parloop_struct_235578;
    futhark_mc_segmap_parloop_235579_task.iterations = iterations;
    futhark_mc_segmap_parloop_235579_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235579_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235579_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235579_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235579_task);
    
    if (futhark_mc_segmap_parloop_235579_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235579_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235579_total_end -
                 futhark_mc_segmap_parloop_235579_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235579_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235579_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235579_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235577_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235577_end -
                 futhark_mc_segmap_task_235577_start;
        
        ctx->futhark_mc_segmap_task_235577_runs[tid]++;
        ctx->futhark_mc_segmap_task_235577_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235577_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235584 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_l_203501;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203881;
    bool free_loop_cond_203886;
    double free_i64_res_203887;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
};
struct futhark_mc_task_235589 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_207465;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217718;
};
struct futhark_mc_segmap_parloop_struct_235591 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_207465;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217718;
};
static int futhark_mc_segmap_parloop_235592(void *args, int64_t start,
                                            int64_t end, int flat_tid_222291,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235591
    *futhark_mc_segmap_parloop_struct_235591 =
    (struct futhark_mc_segmap_parloop_struct_235591 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235591->ctx;
    uint64_t futhark_mc_segmap_parloop_235592_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235592_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235591->free_n_203490;
    int64_t gtid_207465 =
            futhark_mc_segmap_parloop_struct_235591->free_gtid_207465;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235591->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217718 = {.desc ="mem_217718", .mem =
                                  futhark_mc_segmap_parloop_struct_235591->free_mem_217718,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222386 = start;
    
    for (; iter_222386 < end; iter_222386++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222387 = n_203490;
        int64_t gtid_222292 = iter_222386;
        int64_t remnant_222388 = iter_222386 - gtid_222292;
        int64_t x_222293;
        
        x_222293 = ((int64_t *) mem_217340.mem)[gtid_207465 * n_203490 +
                                                gtid_222292];
        
        int64_t defunc_0_f_res_222294 = add64((int64_t) 1, x_222293);
        
        ((int64_t *) mem_217718.mem)[gtid_222292] = defunc_0_f_res_222294;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235592_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235592_end -
                 futhark_mc_segmap_parloop_235592_start;
        
        ctx->futhark_mc_segmap_parloop_235592_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235592_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235592_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235590(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222291 = tid;
    int num_tasks_222385 = info.nsubtasks;
    struct futhark_mc_task_235589 *futhark_mc_task_235589 =
                                  (struct futhark_mc_task_235589 *) args;
    struct futhark_context *ctx = futhark_mc_task_235589->ctx;
    uint64_t futhark_mc_segmap_task_235590_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235590_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235589->free_n_203490;
    int64_t gtid_207465 = futhark_mc_task_235589->free_gtid_207465;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235589->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217718 = {.desc ="mem_217718", .mem =
                                  futhark_mc_task_235589->free_mem_217718,
                                  .size =0, .references =NULL};
    int64_t iter_222386;
    struct futhark_mc_segmap_parloop_struct_235591
    futhark_mc_segmap_parloop_struct_235591;
    
    futhark_mc_segmap_parloop_struct_235591.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235591.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235591.free_gtid_207465 = gtid_207465;
    futhark_mc_segmap_parloop_struct_235591.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235591.free_mem_217718 = mem_217718.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235592_task;
    
    futhark_mc_segmap_parloop_235592_task.name =
        "futhark_mc_segmap_parloop_235592";
    futhark_mc_segmap_parloop_235592_task.fn = futhark_mc_segmap_parloop_235592;
    futhark_mc_segmap_parloop_235592_task.args =
        &futhark_mc_segmap_parloop_struct_235591;
    futhark_mc_segmap_parloop_235592_task.iterations = iterations;
    futhark_mc_segmap_parloop_235592_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235592_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235592_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235592_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235592_task);
    
    if (futhark_mc_segmap_parloop_235592_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235592_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235592_total_end -
                 futhark_mc_segmap_parloop_235592_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235592_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235592_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235592_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235590_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235590_end -
                 futhark_mc_segmap_task_235590_start;
        
        ctx->futhark_mc_segmap_task_235590_runs[tid]++;
        ctx->futhark_mc_segmap_task_235590_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235590_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235593 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_l_203501;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203881;
    bool free_loop_cond_203886;
    int64_t free_gtid_207465;
    int64_t free_min_arg_207473;
    int64_t free_min_arg_207474;
    int64_t free_min_res_207475;
    double free_max_res_207479;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217718;
    unsigned char *free_mem_217721;
    unsigned char *free_mem_217724;
};
struct futhark_mc_segmap_parloop_struct_235595 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_l_203501;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203881;
    bool free_loop_cond_203886;
    int64_t free_gtid_207465;
    int64_t free_min_arg_207473;
    int64_t free_min_arg_207474;
    int64_t free_min_res_207475;
    double free_max_res_207479;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217718;
    unsigned char *free_mem_217721;
    unsigned char *free_mem_217724;
};
static int futhark_mc_segmap_parloop_235596(void *args, int64_t start,
                                            int64_t end, int flat_tid_222295,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235595
    *futhark_mc_segmap_parloop_struct_235595 =
    (struct futhark_mc_segmap_parloop_struct_235595 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235595->ctx;
    uint64_t futhark_mc_segmap_parloop_235596_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235596_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235595->free_n_203490;
    int64_t jump_l_203501 =
            futhark_mc_segmap_parloop_struct_235595->free_jump_l_203501;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_235595->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235595->free_i_203670;
    bool x_203671 = futhark_mc_segmap_parloop_struct_235595->free_x_203671;
    int64_t min_res_203881 =
            futhark_mc_segmap_parloop_struct_235595->free_min_res_203881;
    bool loop_cond_203886 =
         futhark_mc_segmap_parloop_struct_235595->free_loop_cond_203886;
    int64_t gtid_207465 =
            futhark_mc_segmap_parloop_struct_235595->free_gtid_207465;
    int64_t min_arg_207473 =
            futhark_mc_segmap_parloop_struct_235595->free_min_arg_207473;
    int64_t min_arg_207474 =
            futhark_mc_segmap_parloop_struct_235595->free_min_arg_207474;
    int64_t min_res_207475 =
            futhark_mc_segmap_parloop_struct_235595->free_min_res_207475;
    double max_res_207479 =
           futhark_mc_segmap_parloop_struct_235595->free_max_res_207479;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235595->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217718 = {.desc ="mem_217718", .mem =
                                  futhark_mc_segmap_parloop_struct_235595->free_mem_217718,
                                  .size =0, .references =NULL};
    struct memblock mem_217721 = {.desc ="mem_217721", .mem =
                                  futhark_mc_segmap_parloop_struct_235595->free_mem_217721,
                                  .size =0, .references =NULL};
    struct memblock mem_217724 = {.desc ="mem_217724", .mem =
                                  futhark_mc_segmap_parloop_struct_235595->free_mem_217724,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222390 = start;
    
    for (; iter_222390 < end; iter_222390++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222446 = l_n_m_203643;
        int64_t gtid_222296 = iter_222390;
        int64_t remnant_222447 = iter_222390 - gtid_222296;
        int64_t min_arg_222297 = mul64(jump_l_203501, gtid_222296);
        int64_t min_res_222298 = smin64(i_203670, min_arg_222297);
        int64_t defunc_0_g_res_222299 = add64((int64_t) 1, min_res_222298);
        bool init_idx_222300;
        int64_t init_idx_222301;
        int64_t init_idx_222302;
        bool loop_while_222391;
        int64_t low_222392;
        int64_t high_222393;
        
        loop_while_222391 = x_203671;
        low_222392 = (int64_t) 0;
        high_222393 = i_203670;
        while (loop_while_222391) {
            int64_t x_222394 = add64(low_222392, high_222393);
            int64_t mid_222395 = sdiv64(x_222394, (int64_t) 2);
            bool x_222396 = sle64((int64_t) 0, mid_222395);
            bool y_222397 = slt64(mid_222395, n_203490);
            bool bounds_check_222398 = x_222396 && y_222397;
            bool index_certs_222399;
            
            if (!bounds_check_222398) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_222395,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:150:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:148:5-151:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_222400;
            
            mid_id_222400 = ((int64_t *) mem_217718.mem)[mid_222395];
            
            bool cond_222401 = slt64(mid_id_222400, (int64_t) 0);
            int64_t mid_idx_222402;
            
            if (cond_222401) {
                mid_idx_222402 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_222402 = mid_id_222400;
            }
            
            bool cond_222403 = sle64(defunc_0_g_res_222299, mid_idx_222402);
            int64_t loopres_222404;
            int64_t loopres_222405;
            
            if (cond_222403) {
                int64_t loopres_t_res_222406 = sub64(mid_222395, (int64_t) 1);
                
                loopres_222404 = low_222392;
                loopres_222405 = loopres_t_res_222406;
            } else {
                int64_t loopres_f_res_222407 = add64((int64_t) 1, mid_222395);
                
                loopres_222404 = loopres_f_res_222407;
                loopres_222405 = high_222393;
            }
            
            bool loop_cond_222408 = sle64(loopres_222404, loopres_222405);
            bool loop_while_tmp_222448 = loop_cond_222408;
            int64_t low_tmp_222449 = loopres_222404;
            int64_t high_tmp_222450 = loopres_222405;
            
            loop_while_222391 = loop_while_tmp_222448;
            low_222392 = low_tmp_222449;
            high_222393 = high_tmp_222450;
        }
        init_idx_222300 = loop_while_222391;
        init_idx_222301 = low_222392;
        init_idx_222302 = high_222393;
        
        bool idx_222321;
        int64_t idx_222322;
        int64_t idx_222323;
        int64_t idx_222324;
        bool loop_while_222409;
        int64_t l_idx_222410;
        int64_t r_idx_222411;
        int64_t span_222412;
        
        loop_while_222409 = loop_cond_203886;
        l_idx_222410 = init_idx_222301;
        r_idx_222411 = init_idx_222301;
        span_222412 = (int64_t) 1;
        while (loop_while_222409) {
            int64_t max_arg_222413 = sub64(l_idx_222410, (int64_t) 1);
            int64_t max_res_222414 = smax64((int64_t) 0, max_arg_222413);
            int64_t min_arg_222415 = add64((int64_t) 1, r_idx_222411);
            int64_t min_res_222416 = smin64(min_arg_207473, min_arg_222415);
            bool x_222417 = sle64((int64_t) 0, max_res_222414);
            bool y_222418 = slt64(max_res_222414, n_203490);
            bool bounds_check_222419 = x_222417 && y_222418;
            bool index_certs_222420;
            
            if (!bounds_check_222419) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222414,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:150:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:148:5-151:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222421;
            
            x_222421 = ((int64_t *) mem_217718.mem)[max_res_222414];
            
            int64_t abs_arg_222422 = sub64(x_222421, defunc_0_g_res_222299);
            int64_t abs_res_222423 = abs64(abs_arg_222422);
            bool x_222424 = sle64((int64_t) 0, min_res_222416);
            bool y_222425 = slt64(min_res_222416, n_203490);
            bool bounds_check_222426 = x_222424 && y_222425;
            bool index_certs_222427;
            
            if (!bounds_check_222426) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_222416,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:150:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:148:5-151:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222428;
            
            x_222428 = ((int64_t *) mem_217718.mem)[min_res_222416];
            
            int64_t abs_arg_222429 = sub64(x_222428, defunc_0_g_res_222299);
            int64_t abs_res_222430 = abs64(abs_arg_222429);
            bool cond_222431 = max_res_222414 == l_idx_222410;
            int64_t loopres_222432;
            int64_t loopres_222433;
            int64_t loopres_222434;
            
            if (cond_222431) {
                loopres_222432 = l_idx_222410;
                loopres_222433 = r_idx_222411;
                loopres_222434 = min_res_203881;
            } else {
                bool cond_222435 = slt64(abs_res_222423, abs_res_222430);
                bool cond_f_res_222436 = min_res_222416 == r_idx_222411;
                bool x_222437 = !cond_222435;
                bool y_222438 = cond_f_res_222436 && x_222437;
                bool cond_222439 = cond_222435 || y_222438;
                int64_t loopres_f_res_222440;
                
                if (cond_222439) {
                    loopres_f_res_222440 = max_res_222414;
                } else {
                    loopres_f_res_222440 = l_idx_222410;
                }
                
                int64_t loopres_f_res_222441;
                
                if (cond_222439) {
                    loopres_f_res_222441 = r_idx_222411;
                } else {
                    loopres_f_res_222441 = min_res_222416;
                }
                
                int64_t loopres_f_res_222442;
                
                if (cond_222439) {
                    int64_t loopres_f_res_t_res_222443 = add64((int64_t) 1,
                                                               span_222412);
                    
                    loopres_f_res_222442 = loopres_f_res_t_res_222443;
                } else {
                    int64_t loopres_f_res_f_res_222444 = add64((int64_t) 1,
                                                               span_222412);
                    
                    loopres_f_res_222442 = loopres_f_res_f_res_222444;
                }
                loopres_222432 = loopres_f_res_222440;
                loopres_222433 = loopres_f_res_222441;
                loopres_222434 = loopres_f_res_222442;
            }
            
            bool loop_cond_222445 = slt64(loopres_222434, min_res_203881);
            bool loop_while_tmp_222451 = loop_cond_222445;
            int64_t l_idx_tmp_222452 = loopres_222432;
            int64_t r_idx_tmp_222453 = loopres_222433;
            int64_t span_tmp_222454 = loopres_222434;
            
            loop_while_222409 = loop_while_tmp_222451;
            l_idx_222410 = l_idx_tmp_222452;
            r_idx_222411 = r_idx_tmp_222453;
            span_222412 = span_tmp_222454;
        }
        idx_222321 = loop_while_222409;
        idx_222322 = l_idx_222410;
        idx_222323 = r_idx_222411;
        idx_222324 = span_222412;
        
        int64_t min_res_222362 = smin64(min_arg_207474, idx_222322);
        int64_t max_res_222363 = smax64((int64_t) 0, min_res_222362);
        int64_t x_222364 = add64(min_res_207475, max_res_222363);
        int64_t r_222365 = sub64(x_222364, (int64_t) 1);
        bool x_222366 = sle64((int64_t) 0, r_222365);
        bool y_222367 = slt64(r_222365, n_203490);
        bool bounds_check_222368 = x_222366 && y_222367;
        bool index_certs_222369;
        
        if (!bounds_check_222368) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_222365,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203490, "].",
                                   "-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:150:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:148:5-151:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_222370;
        
        x_222370 = ((int64_t *) mem_217340.mem)[gtid_207465 * n_203490 +
                                                r_222365];
        
        int64_t abs_arg_222371 = sub64(x_222370, min_res_222298);
        int64_t abs_res_222372 = abs64(abs_arg_222371);
        bool x_222373 = sle64((int64_t) 0, max_res_222363);
        bool y_222374 = slt64(max_res_222363, n_203490);
        bool bounds_check_222375 = x_222373 && y_222374;
        bool index_certs_222376;
        
        if (!bounds_check_222375) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_222363,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203490, "].",
                                   "-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:150:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:148:5-151:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_222377;
        
        x_222377 = ((int64_t *) mem_217340.mem)[gtid_207465 * n_203490 +
                                                max_res_222363];
        
        int64_t abs_arg_222378 = sub64(x_222377, min_res_222298);
        int64_t abs_res_222379 = abs64(abs_arg_222378);
        int64_t max_res_222380 = smax64(abs_res_222372, abs_res_222379);
        double defunc_0_f_res_222381 = sitofp_i64_f64(max_res_222380);
        double defunc_1_f_res_222382 = max_res_207479 + defunc_0_f_res_222381;
        
        ((double *) mem_217721.mem)[gtid_222296] = defunc_1_f_res_222382;
        ((int64_t *) mem_217724.mem)[gtid_222296] = max_res_222363;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235596_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235596_end -
                 futhark_mc_segmap_parloop_235596_start;
        
        ctx->futhark_mc_segmap_parloop_235596_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235596_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235596_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235594(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222295 = tid;
    int num_tasks_222389 = info.nsubtasks;
    struct futhark_mc_task_235593 *futhark_mc_task_235593 =
                                  (struct futhark_mc_task_235593 *) args;
    struct futhark_context *ctx = futhark_mc_task_235593->ctx;
    uint64_t futhark_mc_segmap_task_235594_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235594_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235593->free_n_203490;
    int64_t jump_l_203501 = futhark_mc_task_235593->free_jump_l_203501;
    int64_t l_n_m_203643 = futhark_mc_task_235593->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_235593->free_i_203670;
    bool x_203671 = futhark_mc_task_235593->free_x_203671;
    int64_t min_res_203881 = futhark_mc_task_235593->free_min_res_203881;
    bool loop_cond_203886 = futhark_mc_task_235593->free_loop_cond_203886;
    int64_t gtid_207465 = futhark_mc_task_235593->free_gtid_207465;
    int64_t min_arg_207473 = futhark_mc_task_235593->free_min_arg_207473;
    int64_t min_arg_207474 = futhark_mc_task_235593->free_min_arg_207474;
    int64_t min_res_207475 = futhark_mc_task_235593->free_min_res_207475;
    double max_res_207479 = futhark_mc_task_235593->free_max_res_207479;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235593->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217718 = {.desc ="mem_217718", .mem =
                                  futhark_mc_task_235593->free_mem_217718,
                                  .size =0, .references =NULL};
    struct memblock mem_217721 = {.desc ="mem_217721", .mem =
                                  futhark_mc_task_235593->free_mem_217721,
                                  .size =0, .references =NULL};
    struct memblock mem_217724 = {.desc ="mem_217724", .mem =
                                  futhark_mc_task_235593->free_mem_217724,
                                  .size =0, .references =NULL};
    int64_t iter_222390;
    struct futhark_mc_segmap_parloop_struct_235595
    futhark_mc_segmap_parloop_struct_235595;
    
    futhark_mc_segmap_parloop_struct_235595.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235595.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235595.free_jump_l_203501 = jump_l_203501;
    futhark_mc_segmap_parloop_struct_235595.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_235595.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235595.free_x_203671 = x_203671;
    futhark_mc_segmap_parloop_struct_235595.free_min_res_203881 =
        min_res_203881;
    futhark_mc_segmap_parloop_struct_235595.free_loop_cond_203886 =
        loop_cond_203886;
    futhark_mc_segmap_parloop_struct_235595.free_gtid_207465 = gtid_207465;
    futhark_mc_segmap_parloop_struct_235595.free_min_arg_207473 =
        min_arg_207473;
    futhark_mc_segmap_parloop_struct_235595.free_min_arg_207474 =
        min_arg_207474;
    futhark_mc_segmap_parloop_struct_235595.free_min_res_207475 =
        min_res_207475;
    futhark_mc_segmap_parloop_struct_235595.free_max_res_207479 =
        max_res_207479;
    futhark_mc_segmap_parloop_struct_235595.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235595.free_mem_217718 = mem_217718.mem;
    futhark_mc_segmap_parloop_struct_235595.free_mem_217721 = mem_217721.mem;
    futhark_mc_segmap_parloop_struct_235595.free_mem_217724 = mem_217724.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235596_task;
    
    futhark_mc_segmap_parloop_235596_task.name =
        "futhark_mc_segmap_parloop_235596";
    futhark_mc_segmap_parloop_235596_task.fn = futhark_mc_segmap_parloop_235596;
    futhark_mc_segmap_parloop_235596_task.args =
        &futhark_mc_segmap_parloop_struct_235595;
    futhark_mc_segmap_parloop_235596_task.iterations = iterations;
    futhark_mc_segmap_parloop_235596_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235596_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235596_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235596_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235596_task);
    
    if (futhark_mc_segmap_parloop_235596_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235596_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235596_total_end -
                 futhark_mc_segmap_parloop_235596_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235596_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235596_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235596_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235594_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235594_end -
                 futhark_mc_segmap_task_235594_start;
        
        ctx->futhark_mc_segmap_task_235594_runs[tid]++;
        ctx->futhark_mc_segmap_task_235594_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235594_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235585(void *args, int64_t start,
                                            int64_t end, int flat_tid_207464,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235584
    *futhark_mc_segmap_parloop_struct_235584 =
    (struct futhark_mc_segmap_parloop_struct_235584 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235584->ctx;
    uint64_t futhark_mc_segmap_parloop_235585_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235585_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235584->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_235584->free_q_l_203495;
    int64_t jump_l_203501 =
            futhark_mc_segmap_parloop_struct_235584->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235584->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_235584->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235584->free_i_203670;
    bool x_203671 = futhark_mc_segmap_parloop_struct_235584->free_x_203671;
    int64_t min_res_203881 =
            futhark_mc_segmap_parloop_struct_235584->free_min_res_203881;
    bool loop_cond_203886 =
         futhark_mc_segmap_parloop_struct_235584->free_loop_cond_203886;
    double i64_res_203887 =
           futhark_mc_segmap_parloop_struct_235584->free_i64_res_203887;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235584->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235584->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_235584->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_235584->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_235584->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_235584->free_mem_217777,
                                  .size =0, .references =NULL};
    size_t mem_217718_cached_sizze_235586 = 0;
    unsigned char *mem_217718 = NULL;
    size_t mem_217721_cached_sizze_235587 = 0;
    unsigned char *mem_217721 = NULL;
    size_t mem_217724_cached_sizze_235588 = 0;
    unsigned char *mem_217724 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222290 = start;
    
    if (mem_217718_cached_sizze_235586 < (size_t) bytes_217302) {
        mem_217718 = realloc(mem_217718, bytes_217302);
        mem_217718_cached_sizze_235586 = bytes_217302;
    }
    if (mem_217721_cached_sizze_235587 < (size_t) bytes_217720) {
        mem_217721 = realloc(mem_217721, bytes_217720);
        mem_217721_cached_sizze_235587 = bytes_217720;
    }
    if (mem_217724_cached_sizze_235588 < (size_t) bytes_217720) {
        mem_217724 = realloc(mem_217724, bytes_217720);
        mem_217724_cached_sizze_235588 = bytes_217720;
    }
    for (; iter_222290 < end; iter_222290++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222383 = partition_sizze_203577;
        int64_t gtid_207465 = iter_222290;
        int64_t remnant_222384 = iter_222290 - gtid_207465;
        int64_t x_207467;
        
        x_207467 = ((int64_t *) mem_217343.mem)[gtid_207465];
        
        int64_t flat_tid_222291 = (int64_t) 0;
        int32_t num_tasks_222385;
        struct futhark_mc_task_235589 futhark_mc_task_235589;
        
        futhark_mc_task_235589.ctx = ctx;
        futhark_mc_task_235589.free_n_203490 = n_203490;
        futhark_mc_task_235589.free_gtid_207465 = gtid_207465;
        futhark_mc_task_235589.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_235589.free_mem_217718 = mem_217718;
        
        struct scheduler_segop futhark_mc_task_235589_task;
        
        futhark_mc_task_235589_task.args = &futhark_mc_task_235589;
        futhark_mc_task_235589_task.top_level_fn =
            futhark_mc_segmap_task_235590;
        futhark_mc_task_235589_task.name = "futhark_mc_segmap_task_235590";
        futhark_mc_task_235589_task.iterations = n_203490;
        futhark_mc_task_235589_task.task_time =
            &ctx->futhark_mc_segmap_task_235590_total_time;
        futhark_mc_task_235589_task.task_iter =
            &ctx->futhark_mc_segmap_task_235590_total_iter;
        futhark_mc_task_235589_task.sched = STATIC;
        futhark_mc_task_235589_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235590_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235589_task);
        
        if (futhark_mc_segmap_task_235590_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_207473 = sub64(x_207467, (int64_t) 1);
        int64_t min_arg_207474 = sub64(x_207467, min_res_203881);
        int64_t min_res_207475 = smin64(q_l_203495, x_207467);
        double i64_res_207476 = sitofp_i64_f64(x_207467);
        double x_207477 = i64_res_203887 - i64_res_207476;
        double max_arg_207478 = x_207477 / 2.0;
        double max_res_207479 = fmax64(0.0, max_arg_207478);
        int64_t flat_tid_222295 = (int64_t) 0;
        int32_t num_tasks_222389;
        struct futhark_mc_task_235593 futhark_mc_task_235593;
        
        futhark_mc_task_235593.ctx = ctx;
        futhark_mc_task_235593.free_n_203490 = n_203490;
        futhark_mc_task_235593.free_jump_l_203501 = jump_l_203501;
        futhark_mc_task_235593.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_235593.free_i_203670 = i_203670;
        futhark_mc_task_235593.free_x_203671 = x_203671;
        futhark_mc_task_235593.free_min_res_203881 = min_res_203881;
        futhark_mc_task_235593.free_loop_cond_203886 = loop_cond_203886;
        futhark_mc_task_235593.free_gtid_207465 = gtid_207465;
        futhark_mc_task_235593.free_min_arg_207473 = min_arg_207473;
        futhark_mc_task_235593.free_min_arg_207474 = min_arg_207474;
        futhark_mc_task_235593.free_min_res_207475 = min_res_207475;
        futhark_mc_task_235593.free_max_res_207479 = max_res_207479;
        futhark_mc_task_235593.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_235593.free_mem_217718 = mem_217718;
        futhark_mc_task_235593.free_mem_217721 = mem_217721;
        futhark_mc_task_235593.free_mem_217724 = mem_217724;
        
        struct scheduler_segop futhark_mc_task_235593_task;
        
        futhark_mc_task_235593_task.args = &futhark_mc_task_235593;
        futhark_mc_task_235593_task.top_level_fn =
            futhark_mc_segmap_task_235594;
        futhark_mc_task_235593_task.name = "futhark_mc_segmap_task_235594";
        futhark_mc_task_235593_task.iterations = l_n_m_203643;
        futhark_mc_task_235593_task.task_time =
            &ctx->futhark_mc_segmap_task_235594_total_time;
        futhark_mc_task_235593_task.task_iter =
            &ctx->futhark_mc_segmap_task_235594_total_iter;
        futhark_mc_task_235593_task.sched = DYNAMIC;
        futhark_mc_task_235593_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235594_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235593_task);
        
        if (futhark_mc_segmap_task_235594_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_217773.mem + gtid_207465 * l_n_m_203643 * (int64_t) 8,
                    mem_217724 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_217777.mem + gtid_207465 * l_n_m_203643 * (int64_t) 8,
                    mem_217721 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217718);
    free(mem_217721);
    free(mem_217724);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235585_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235585_end -
                 futhark_mc_segmap_parloop_235585_start;
        
        ctx->futhark_mc_segmap_parloop_235585_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235585_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235585_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235583(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207464 = tid;
    int num_tasks_222180 = info.nsubtasks;
    struct futhark_mc_task_235576 *futhark_mc_task_235576 =
                                  (struct futhark_mc_task_235576 *) args;
    struct futhark_context *ctx = futhark_mc_task_235576->ctx;
    uint64_t futhark_mc_segmap_nested_task_235583_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235583_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235576->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_235576->free_q_l_203495;
    int64_t jump_l_203501 = futhark_mc_task_235576->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235576->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_235576->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_235576->free_i_203670;
    bool x_203671 = futhark_mc_task_235576->free_x_203671;
    int64_t min_res_203881 = futhark_mc_task_235576->free_min_res_203881;
    bool loop_cond_203886 = futhark_mc_task_235576->free_loop_cond_203886;
    double i64_res_203887 = futhark_mc_task_235576->free_i64_res_203887;
    int64_t bytes_217302 = futhark_mc_task_235576->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235576->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_235576->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217720 = futhark_mc_task_235576->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_235576->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_235576->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t iter_222290;
    struct futhark_mc_segmap_parloop_struct_235584
    futhark_mc_segmap_parloop_struct_235584;
    
    futhark_mc_segmap_parloop_struct_235584.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235584.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235584.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_235584.free_jump_l_203501 = jump_l_203501;
    futhark_mc_segmap_parloop_struct_235584.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235584.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_235584.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235584.free_x_203671 = x_203671;
    futhark_mc_segmap_parloop_struct_235584.free_min_res_203881 =
        min_res_203881;
    futhark_mc_segmap_parloop_struct_235584.free_loop_cond_203886 =
        loop_cond_203886;
    futhark_mc_segmap_parloop_struct_235584.free_i64_res_203887 =
        i64_res_203887;
    futhark_mc_segmap_parloop_struct_235584.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235584.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235584.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_235584.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_235584.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_235584.free_mem_217777 = mem_217777.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235585_task;
    
    futhark_mc_segmap_parloop_235585_task.name =
        "futhark_mc_segmap_parloop_235585";
    futhark_mc_segmap_parloop_235585_task.fn = futhark_mc_segmap_parloop_235585;
    futhark_mc_segmap_parloop_235585_task.args =
        &futhark_mc_segmap_parloop_struct_235584;
    futhark_mc_segmap_parloop_235585_task.iterations = iterations;
    futhark_mc_segmap_parloop_235585_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235585_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235585_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235585_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235585_task);
    
    if (futhark_mc_segmap_parloop_235585_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235585_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235585_total_end -
                 futhark_mc_segmap_parloop_235585_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235585_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235585_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235585_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235583_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235583_end -
                 futhark_mc_segmap_nested_task_235583_start;
        
        ctx->futhark_mc_segmap_nested_task_235583_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235583_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235583_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235597 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203993;
    bool free_loop_cond_203998;
    double free_i64_res_203999;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
};
struct futhark_mc_segmap_parloop_struct_235599 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203993;
    bool free_loop_cond_203998;
    double free_i64_res_203999;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
};
static int futhark_mc_segmap_parloop_235600(void *args, int64_t start,
                                            int64_t end, int flat_tid_207571,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235599
    *futhark_mc_segmap_parloop_struct_235599 =
    (struct futhark_mc_segmap_parloop_struct_235599 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235599->ctx;
    uint64_t futhark_mc_segmap_parloop_235600_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235600_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235599->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_235599->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_235599->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235599->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_235599->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235599->free_i_203670;
    bool x_203671 = futhark_mc_segmap_parloop_struct_235599->free_x_203671;
    int64_t min_res_203993 =
            futhark_mc_segmap_parloop_struct_235599->free_min_res_203993;
    bool loop_cond_203998 =
         futhark_mc_segmap_parloop_struct_235599->free_loop_cond_203998;
    double i64_res_203999 =
           futhark_mc_segmap_parloop_struct_235599->free_i64_res_203999;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235599->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235599->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_235599->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_235599->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_235599->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_235599->free_mem_217839,
                                  .size =0, .references =NULL};
    size_t mem_217789_cached_sizze_235601 = 0;
    unsigned char *mem_217789 = NULL;
    size_t mem_217804_cached_sizze_235602 = 0;
    unsigned char *mem_217804 = NULL;
    size_t mem_217807_cached_sizze_235603 = 0;
    unsigned char *mem_217807 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222456 = start;
    
    if (mem_217789_cached_sizze_235601 < (size_t) bytes_217302) {
        mem_217789 = realloc(mem_217789, bytes_217302);
        mem_217789_cached_sizze_235601 = bytes_217302;
    }
    if (mem_217804_cached_sizze_235602 < (size_t) bytes_217782) {
        mem_217804 = realloc(mem_217804, bytes_217782);
        mem_217804_cached_sizze_235602 = bytes_217782;
    }
    if (mem_217807_cached_sizze_235603 < (size_t) bytes_217782) {
        mem_217807 = realloc(mem_217807, bytes_217782);
        mem_217807_cached_sizze_235603 = bytes_217782;
    }
    for (; iter_222456 < end; iter_222456++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222553 = partition_sizze_203577;
        int64_t gtid_207572 = iter_222456;
        int64_t remnant_222554 = iter_222456 - gtid_207572;
        int64_t x_204003;
        
        x_204003 = ((int64_t *) mem_217343.mem)[gtid_207572];
        for (int64_t i_222457 = 0; i_222457 < n_203490; i_222457++) {
            int64_t x_222459;
            
            x_222459 = ((int64_t *) mem_217340.mem)[gtid_207572 * n_203490 +
                                                    i_222457];
            
            int64_t defunc_0_f_res_222460 = add64((int64_t) 1, x_222459);
            
            ((int64_t *) mem_217789)[i_222457] = defunc_0_f_res_222460;
        }
        
        int64_t min_arg_204007 = sub64(x_204003, (int64_t) 1);
        int64_t min_arg_204008 = sub64(x_204003, min_res_203993);
        int64_t min_res_204009 = smin64(q_t_203494, x_204003);
        double i64_res_204010 = sitofp_i64_f64(x_204003);
        double x_204011 = i64_res_203999 - i64_res_204010;
        double max_arg_204012 = x_204011 / 2.0;
        double max_res_204013 = fmax64(0.0, max_arg_204012);
        
        for (int64_t i_222462 = 0; i_222462 < t_n_m_203650; i_222462++) {
            int64_t min_arg_222465 = mul64(jump_t_203500, i_222462);
            int64_t min_res_222466 = smin64(i_203670, min_arg_222465);
            int64_t defunc_0_g_res_222467 = add64((int64_t) 1, min_res_222466);
            bool init_idx_222468;
            int64_t init_idx_222469;
            int64_t init_idx_222470;
            bool loop_while_222471;
            int64_t low_222472;
            int64_t high_222473;
            
            loop_while_222471 = x_203671;
            low_222472 = (int64_t) 0;
            high_222473 = i_203670;
            while (loop_while_222471) {
                int64_t x_222474 = add64(low_222472, high_222473);
                int64_t mid_222475 = sdiv64(x_222474, (int64_t) 2);
                bool x_222476 = sle64((int64_t) 0, mid_222475);
                bool y_222477 = slt64(mid_222475, n_203490);
                bool bounds_check_222478 = x_222476 && y_222477;
                bool index_certs_222479;
                
                if (!bounds_check_222478) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_222475,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:157:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:155:5-158:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_222480;
                
                mid_id_222480 = ((int64_t *) mem_217789)[mid_222475];
                
                bool cond_222481 = slt64(mid_id_222480, (int64_t) 0);
                int64_t mid_idx_222482;
                
                if (cond_222481) {
                    mid_idx_222482 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_222482 = mid_id_222480;
                }
                
                bool cond_222483 = sle64(defunc_0_g_res_222467, mid_idx_222482);
                int64_t loopres_222484;
                int64_t loopres_222485;
                
                if (cond_222483) {
                    int64_t loopres_t_res_222486 = sub64(mid_222475,
                                                         (int64_t) 1);
                    
                    loopres_222484 = low_222472;
                    loopres_222485 = loopres_t_res_222486;
                } else {
                    int64_t loopres_f_res_222487 = add64((int64_t) 1,
                                                         mid_222475);
                    
                    loopres_222484 = loopres_f_res_222487;
                    loopres_222485 = high_222473;
                }
                
                bool loop_cond_222488 = sle64(loopres_222484, loopres_222485);
                bool loop_while_tmp_222558 = loop_cond_222488;
                int64_t low_tmp_222559 = loopres_222484;
                int64_t high_tmp_222560 = loopres_222485;
                
                loop_while_222471 = loop_while_tmp_222558;
                low_222472 = low_tmp_222559;
                high_222473 = high_tmp_222560;
            }
            init_idx_222468 = loop_while_222471;
            init_idx_222469 = low_222472;
            init_idx_222470 = high_222473;
            
            bool idx_222489;
            int64_t idx_222490;
            int64_t idx_222491;
            int64_t idx_222492;
            bool loop_while_222493;
            int64_t l_idx_222494;
            int64_t r_idx_222495;
            int64_t span_222496;
            
            loop_while_222493 = loop_cond_203998;
            l_idx_222494 = init_idx_222469;
            r_idx_222495 = init_idx_222469;
            span_222496 = (int64_t) 1;
            while (loop_while_222493) {
                int64_t max_arg_222497 = sub64(l_idx_222494, (int64_t) 1);
                int64_t max_res_222498 = smax64((int64_t) 0, max_arg_222497);
                int64_t min_arg_222499 = add64((int64_t) 1, r_idx_222495);
                int64_t min_res_222500 = smin64(min_arg_204007, min_arg_222499);
                bool x_222501 = sle64((int64_t) 0, max_res_222498);
                bool y_222502 = slt64(max_res_222498, n_203490);
                bool bounds_check_222503 = x_222501 && y_222502;
                bool index_certs_222504;
                
                if (!bounds_check_222503) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_222498,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:157:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:155:5-158:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_222505;
                
                x_222505 = ((int64_t *) mem_217789)[max_res_222498];
                
                int64_t abs_arg_222506 = sub64(x_222505, defunc_0_g_res_222467);
                int64_t abs_res_222507 = abs64(abs_arg_222506);
                bool x_222508 = sle64((int64_t) 0, min_res_222500);
                bool y_222509 = slt64(min_res_222500, n_203490);
                bool bounds_check_222510 = x_222508 && y_222509;
                bool index_certs_222511;
                
                if (!bounds_check_222510) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_222500,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:157:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:155:5-158:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_222512;
                
                x_222512 = ((int64_t *) mem_217789)[min_res_222500];
                
                int64_t abs_arg_222513 = sub64(x_222512, defunc_0_g_res_222467);
                int64_t abs_res_222514 = abs64(abs_arg_222513);
                bool cond_222515 = max_res_222498 == l_idx_222494;
                int64_t loopres_222516;
                int64_t loopres_222517;
                int64_t loopres_222518;
                
                if (cond_222515) {
                    loopres_222516 = l_idx_222494;
                    loopres_222517 = r_idx_222495;
                    loopres_222518 = min_res_203993;
                } else {
                    bool cond_222519 = slt64(abs_res_222507, abs_res_222514);
                    bool cond_f_res_222520 = min_res_222500 == r_idx_222495;
                    bool x_222521 = !cond_222519;
                    bool y_222522 = cond_f_res_222520 && x_222521;
                    bool cond_222523 = cond_222519 || y_222522;
                    int64_t loopres_f_res_222524;
                    
                    if (cond_222523) {
                        loopres_f_res_222524 = max_res_222498;
                    } else {
                        loopres_f_res_222524 = l_idx_222494;
                    }
                    
                    int64_t loopres_f_res_222525;
                    
                    if (cond_222523) {
                        loopres_f_res_222525 = r_idx_222495;
                    } else {
                        loopres_f_res_222525 = min_res_222500;
                    }
                    
                    int64_t loopres_f_res_222526;
                    
                    if (cond_222523) {
                        int64_t loopres_f_res_t_res_222527 = add64((int64_t) 1,
                                                                   span_222496);
                        
                        loopres_f_res_222526 = loopres_f_res_t_res_222527;
                    } else {
                        int64_t loopres_f_res_f_res_222528 = add64((int64_t) 1,
                                                                   span_222496);
                        
                        loopres_f_res_222526 = loopres_f_res_f_res_222528;
                    }
                    loopres_222516 = loopres_f_res_222524;
                    loopres_222517 = loopres_f_res_222525;
                    loopres_222518 = loopres_f_res_222526;
                }
                
                bool loop_cond_222529 = slt64(loopres_222518, min_res_203993);
                bool loop_while_tmp_222561 = loop_cond_222529;
                int64_t l_idx_tmp_222562 = loopres_222516;
                int64_t r_idx_tmp_222563 = loopres_222517;
                int64_t span_tmp_222564 = loopres_222518;
                
                loop_while_222493 = loop_while_tmp_222561;
                l_idx_222494 = l_idx_tmp_222562;
                r_idx_222495 = r_idx_tmp_222563;
                span_222496 = span_tmp_222564;
            }
            idx_222489 = loop_while_222493;
            idx_222490 = l_idx_222494;
            idx_222491 = r_idx_222495;
            idx_222492 = span_222496;
            
            int64_t min_res_222530 = smin64(min_arg_204008, idx_222490);
            int64_t max_res_222531 = smax64((int64_t) 0, min_res_222530);
            int64_t x_222532 = add64(min_res_204009, max_res_222531);
            int64_t r_222533 = sub64(x_222532, (int64_t) 1);
            bool x_222534 = sle64((int64_t) 0, r_222533);
            bool y_222535 = slt64(r_222533, n_203490);
            bool bounds_check_222536 = x_222534 && y_222535;
            bool index_certs_222537;
            
            if (!bounds_check_222536) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_222533,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:157:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:155:5-158:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222538;
            
            x_222538 = ((int64_t *) mem_217340.mem)[gtid_207572 * n_203490 +
                                                    r_222533];
            
            int64_t abs_arg_222539 = sub64(x_222538, min_res_222466);
            int64_t abs_res_222540 = abs64(abs_arg_222539);
            bool x_222541 = sle64((int64_t) 0, max_res_222531);
            bool y_222542 = slt64(max_res_222531, n_203490);
            bool bounds_check_222543 = x_222541 && y_222542;
            bool index_certs_222544;
            
            if (!bounds_check_222543) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222531,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:157:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:155:5-158:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222545;
            
            x_222545 = ((int64_t *) mem_217340.mem)[gtid_207572 * n_203490 +
                                                    max_res_222531];
            
            int64_t abs_arg_222546 = sub64(x_222545, min_res_222466);
            int64_t abs_res_222547 = abs64(abs_arg_222546);
            int64_t max_res_222548 = smax64(abs_res_222540, abs_res_222547);
            double defunc_0_f_res_222549 = sitofp_i64_f64(max_res_222548);
            double defunc_1_f_res_222550 = max_res_204013 +
                   defunc_0_f_res_222549;
            
            ((double *) mem_217804)[i_222462] = defunc_1_f_res_222550;
            ((int64_t *) mem_217807)[i_222462] = max_res_222531;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_217835.mem + gtid_207572 * t_n_m_203650 * (int64_t) 8,
                    mem_217807 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_217839.mem + gtid_207572 * t_n_m_203650 * (int64_t) 8,
                    mem_217804 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217789);
    free(mem_217804);
    free(mem_217807);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235600_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235600_end -
                 futhark_mc_segmap_parloop_235600_start;
        
        ctx->futhark_mc_segmap_parloop_235600_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235600_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235600_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235598(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207571 = tid;
    int num_tasks_222455 = info.nsubtasks;
    struct futhark_mc_task_235597 *futhark_mc_task_235597 =
                                  (struct futhark_mc_task_235597 *) args;
    struct futhark_context *ctx = futhark_mc_task_235597->ctx;
    uint64_t futhark_mc_segmap_task_235598_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235598_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235597->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_235597->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_235597->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235597->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_235597->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_235597->free_i_203670;
    bool x_203671 = futhark_mc_task_235597->free_x_203671;
    int64_t min_res_203993 = futhark_mc_task_235597->free_min_res_203993;
    bool loop_cond_203998 = futhark_mc_task_235597->free_loop_cond_203998;
    double i64_res_203999 = futhark_mc_task_235597->free_i64_res_203999;
    int64_t bytes_217302 = futhark_mc_task_235597->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235597->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_235597->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_235597->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_235597->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_235597->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t iter_222456;
    struct futhark_mc_segmap_parloop_struct_235599
    futhark_mc_segmap_parloop_struct_235599;
    
    futhark_mc_segmap_parloop_struct_235599.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235599.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235599.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_235599.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_235599.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235599.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_235599.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235599.free_x_203671 = x_203671;
    futhark_mc_segmap_parloop_struct_235599.free_min_res_203993 =
        min_res_203993;
    futhark_mc_segmap_parloop_struct_235599.free_loop_cond_203998 =
        loop_cond_203998;
    futhark_mc_segmap_parloop_struct_235599.free_i64_res_203999 =
        i64_res_203999;
    futhark_mc_segmap_parloop_struct_235599.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235599.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235599.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_235599.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_235599.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_235599.free_mem_217839 = mem_217839.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235600_task;
    
    futhark_mc_segmap_parloop_235600_task.name =
        "futhark_mc_segmap_parloop_235600";
    futhark_mc_segmap_parloop_235600_task.fn = futhark_mc_segmap_parloop_235600;
    futhark_mc_segmap_parloop_235600_task.args =
        &futhark_mc_segmap_parloop_struct_235599;
    futhark_mc_segmap_parloop_235600_task.iterations = iterations;
    futhark_mc_segmap_parloop_235600_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235600_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235600_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235600_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235600_task);
    
    if (futhark_mc_segmap_parloop_235600_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235600_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235600_total_end -
                 futhark_mc_segmap_parloop_235600_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235600_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235600_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235600_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235598_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235598_end -
                 futhark_mc_segmap_task_235598_start;
        
        ctx->futhark_mc_segmap_task_235598_runs[tid]++;
        ctx->futhark_mc_segmap_task_235598_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235598_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235605 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203993;
    bool free_loop_cond_203998;
    double free_i64_res_203999;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
};
struct futhark_mc_task_235610 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_207580;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217780;
};
struct futhark_mc_segmap_parloop_struct_235612 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_207580;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217780;
};
static int futhark_mc_segmap_parloop_235613(void *args, int64_t start,
                                            int64_t end, int flat_tid_222566,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235612
    *futhark_mc_segmap_parloop_struct_235612 =
    (struct futhark_mc_segmap_parloop_struct_235612 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235612->ctx;
    uint64_t futhark_mc_segmap_parloop_235613_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235613_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235612->free_n_203490;
    int64_t gtid_207580 =
            futhark_mc_segmap_parloop_struct_235612->free_gtid_207580;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235612->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217780 = {.desc ="mem_217780", .mem =
                                  futhark_mc_segmap_parloop_struct_235612->free_mem_217780,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222661 = start;
    
    for (; iter_222661 < end; iter_222661++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222662 = n_203490;
        int64_t gtid_222567 = iter_222661;
        int64_t remnant_222663 = iter_222661 - gtid_222567;
        int64_t x_222568;
        
        x_222568 = ((int64_t *) mem_217340.mem)[gtid_207580 * n_203490 +
                                                gtid_222567];
        
        int64_t defunc_0_f_res_222569 = add64((int64_t) 1, x_222568);
        
        ((int64_t *) mem_217780.mem)[gtid_222567] = defunc_0_f_res_222569;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235613_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235613_end -
                 futhark_mc_segmap_parloop_235613_start;
        
        ctx->futhark_mc_segmap_parloop_235613_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235613_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235613_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235611(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222566 = tid;
    int num_tasks_222660 = info.nsubtasks;
    struct futhark_mc_task_235610 *futhark_mc_task_235610 =
                                  (struct futhark_mc_task_235610 *) args;
    struct futhark_context *ctx = futhark_mc_task_235610->ctx;
    uint64_t futhark_mc_segmap_task_235611_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235611_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235610->free_n_203490;
    int64_t gtid_207580 = futhark_mc_task_235610->free_gtid_207580;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235610->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217780 = {.desc ="mem_217780", .mem =
                                  futhark_mc_task_235610->free_mem_217780,
                                  .size =0, .references =NULL};
    int64_t iter_222661;
    struct futhark_mc_segmap_parloop_struct_235612
    futhark_mc_segmap_parloop_struct_235612;
    
    futhark_mc_segmap_parloop_struct_235612.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235612.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235612.free_gtid_207580 = gtid_207580;
    futhark_mc_segmap_parloop_struct_235612.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235612.free_mem_217780 = mem_217780.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235613_task;
    
    futhark_mc_segmap_parloop_235613_task.name =
        "futhark_mc_segmap_parloop_235613";
    futhark_mc_segmap_parloop_235613_task.fn = futhark_mc_segmap_parloop_235613;
    futhark_mc_segmap_parloop_235613_task.args =
        &futhark_mc_segmap_parloop_struct_235612;
    futhark_mc_segmap_parloop_235613_task.iterations = iterations;
    futhark_mc_segmap_parloop_235613_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235613_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235613_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235613_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235613_task);
    
    if (futhark_mc_segmap_parloop_235613_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235613_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235613_total_end -
                 futhark_mc_segmap_parloop_235613_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235613_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235613_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235613_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235611_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235611_end -
                 futhark_mc_segmap_task_235611_start;
        
        ctx->futhark_mc_segmap_task_235611_runs[tid]++;
        ctx->futhark_mc_segmap_task_235611_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235611_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235614 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203993;
    bool free_loop_cond_203998;
    int64_t free_gtid_207580;
    int64_t free_min_arg_207588;
    int64_t free_min_arg_207589;
    int64_t free_min_res_207590;
    double free_max_res_207594;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217780;
    unsigned char *free_mem_217783;
    unsigned char *free_mem_217786;
};
struct futhark_mc_segmap_parloop_struct_235616 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    bool free_x_203671;
    int64_t free_min_res_203993;
    bool free_loop_cond_203998;
    int64_t free_gtid_207580;
    int64_t free_min_arg_207588;
    int64_t free_min_arg_207589;
    int64_t free_min_res_207590;
    double free_max_res_207594;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217780;
    unsigned char *free_mem_217783;
    unsigned char *free_mem_217786;
};
static int futhark_mc_segmap_parloop_235617(void *args, int64_t start,
                                            int64_t end, int flat_tid_222570,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235616
    *futhark_mc_segmap_parloop_struct_235616 =
    (struct futhark_mc_segmap_parloop_struct_235616 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235616->ctx;
    uint64_t futhark_mc_segmap_parloop_235617_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235617_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235616->free_n_203490;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_235616->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_235616->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235616->free_i_203670;
    bool x_203671 = futhark_mc_segmap_parloop_struct_235616->free_x_203671;
    int64_t min_res_203993 =
            futhark_mc_segmap_parloop_struct_235616->free_min_res_203993;
    bool loop_cond_203998 =
         futhark_mc_segmap_parloop_struct_235616->free_loop_cond_203998;
    int64_t gtid_207580 =
            futhark_mc_segmap_parloop_struct_235616->free_gtid_207580;
    int64_t min_arg_207588 =
            futhark_mc_segmap_parloop_struct_235616->free_min_arg_207588;
    int64_t min_arg_207589 =
            futhark_mc_segmap_parloop_struct_235616->free_min_arg_207589;
    int64_t min_res_207590 =
            futhark_mc_segmap_parloop_struct_235616->free_min_res_207590;
    double max_res_207594 =
           futhark_mc_segmap_parloop_struct_235616->free_max_res_207594;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235616->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217780 = {.desc ="mem_217780", .mem =
                                  futhark_mc_segmap_parloop_struct_235616->free_mem_217780,
                                  .size =0, .references =NULL};
    struct memblock mem_217783 = {.desc ="mem_217783", .mem =
                                  futhark_mc_segmap_parloop_struct_235616->free_mem_217783,
                                  .size =0, .references =NULL};
    struct memblock mem_217786 = {.desc ="mem_217786", .mem =
                                  futhark_mc_segmap_parloop_struct_235616->free_mem_217786,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222665 = start;
    
    for (; iter_222665 < end; iter_222665++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222721 = t_n_m_203650;
        int64_t gtid_222571 = iter_222665;
        int64_t remnant_222722 = iter_222665 - gtid_222571;
        int64_t min_arg_222572 = mul64(jump_t_203500, gtid_222571);
        int64_t min_res_222573 = smin64(i_203670, min_arg_222572);
        int64_t defunc_0_g_res_222574 = add64((int64_t) 1, min_res_222573);
        bool init_idx_222575;
        int64_t init_idx_222576;
        int64_t init_idx_222577;
        bool loop_while_222666;
        int64_t low_222667;
        int64_t high_222668;
        
        loop_while_222666 = x_203671;
        low_222667 = (int64_t) 0;
        high_222668 = i_203670;
        while (loop_while_222666) {
            int64_t x_222669 = add64(low_222667, high_222668);
            int64_t mid_222670 = sdiv64(x_222669, (int64_t) 2);
            bool x_222671 = sle64((int64_t) 0, mid_222670);
            bool y_222672 = slt64(mid_222670, n_203490);
            bool bounds_check_222673 = x_222671 && y_222672;
            bool index_certs_222674;
            
            if (!bounds_check_222673) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_222670,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:157:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:155:5-158:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_222675;
            
            mid_id_222675 = ((int64_t *) mem_217780.mem)[mid_222670];
            
            bool cond_222676 = slt64(mid_id_222675, (int64_t) 0);
            int64_t mid_idx_222677;
            
            if (cond_222676) {
                mid_idx_222677 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_222677 = mid_id_222675;
            }
            
            bool cond_222678 = sle64(defunc_0_g_res_222574, mid_idx_222677);
            int64_t loopres_222679;
            int64_t loopres_222680;
            
            if (cond_222678) {
                int64_t loopres_t_res_222681 = sub64(mid_222670, (int64_t) 1);
                
                loopres_222679 = low_222667;
                loopres_222680 = loopres_t_res_222681;
            } else {
                int64_t loopres_f_res_222682 = add64((int64_t) 1, mid_222670);
                
                loopres_222679 = loopres_f_res_222682;
                loopres_222680 = high_222668;
            }
            
            bool loop_cond_222683 = sle64(loopres_222679, loopres_222680);
            bool loop_while_tmp_222723 = loop_cond_222683;
            int64_t low_tmp_222724 = loopres_222679;
            int64_t high_tmp_222725 = loopres_222680;
            
            loop_while_222666 = loop_while_tmp_222723;
            low_222667 = low_tmp_222724;
            high_222668 = high_tmp_222725;
        }
        init_idx_222575 = loop_while_222666;
        init_idx_222576 = low_222667;
        init_idx_222577 = high_222668;
        
        bool idx_222596;
        int64_t idx_222597;
        int64_t idx_222598;
        int64_t idx_222599;
        bool loop_while_222684;
        int64_t l_idx_222685;
        int64_t r_idx_222686;
        int64_t span_222687;
        
        loop_while_222684 = loop_cond_203998;
        l_idx_222685 = init_idx_222576;
        r_idx_222686 = init_idx_222576;
        span_222687 = (int64_t) 1;
        while (loop_while_222684) {
            int64_t max_arg_222688 = sub64(l_idx_222685, (int64_t) 1);
            int64_t max_res_222689 = smax64((int64_t) 0, max_arg_222688);
            int64_t min_arg_222690 = add64((int64_t) 1, r_idx_222686);
            int64_t min_res_222691 = smin64(min_arg_207588, min_arg_222690);
            bool x_222692 = sle64((int64_t) 0, max_res_222689);
            bool y_222693 = slt64(max_res_222689, n_203490);
            bool bounds_check_222694 = x_222692 && y_222693;
            bool index_certs_222695;
            
            if (!bounds_check_222694) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222689,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:157:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:155:5-158:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222696;
            
            x_222696 = ((int64_t *) mem_217780.mem)[max_res_222689];
            
            int64_t abs_arg_222697 = sub64(x_222696, defunc_0_g_res_222574);
            int64_t abs_res_222698 = abs64(abs_arg_222697);
            bool x_222699 = sle64((int64_t) 0, min_res_222691);
            bool y_222700 = slt64(min_res_222691, n_203490);
            bool bounds_check_222701 = x_222699 && y_222700;
            bool index_certs_222702;
            
            if (!bounds_check_222701) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_222691,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  stl.fut:157:13-60\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:155:5-158:26\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_222703;
            
            x_222703 = ((int64_t *) mem_217780.mem)[min_res_222691];
            
            int64_t abs_arg_222704 = sub64(x_222703, defunc_0_g_res_222574);
            int64_t abs_res_222705 = abs64(abs_arg_222704);
            bool cond_222706 = max_res_222689 == l_idx_222685;
            int64_t loopres_222707;
            int64_t loopres_222708;
            int64_t loopres_222709;
            
            if (cond_222706) {
                loopres_222707 = l_idx_222685;
                loopres_222708 = r_idx_222686;
                loopres_222709 = min_res_203993;
            } else {
                bool cond_222710 = slt64(abs_res_222698, abs_res_222705);
                bool cond_f_res_222711 = min_res_222691 == r_idx_222686;
                bool x_222712 = !cond_222710;
                bool y_222713 = cond_f_res_222711 && x_222712;
                bool cond_222714 = cond_222710 || y_222713;
                int64_t loopres_f_res_222715;
                
                if (cond_222714) {
                    loopres_f_res_222715 = max_res_222689;
                } else {
                    loopres_f_res_222715 = l_idx_222685;
                }
                
                int64_t loopres_f_res_222716;
                
                if (cond_222714) {
                    loopres_f_res_222716 = r_idx_222686;
                } else {
                    loopres_f_res_222716 = min_res_222691;
                }
                
                int64_t loopres_f_res_222717;
                
                if (cond_222714) {
                    int64_t loopres_f_res_t_res_222718 = add64((int64_t) 1,
                                                               span_222687);
                    
                    loopres_f_res_222717 = loopres_f_res_t_res_222718;
                } else {
                    int64_t loopres_f_res_f_res_222719 = add64((int64_t) 1,
                                                               span_222687);
                    
                    loopres_f_res_222717 = loopres_f_res_f_res_222719;
                }
                loopres_222707 = loopres_f_res_222715;
                loopres_222708 = loopres_f_res_222716;
                loopres_222709 = loopres_f_res_222717;
            }
            
            bool loop_cond_222720 = slt64(loopres_222709, min_res_203993);
            bool loop_while_tmp_222726 = loop_cond_222720;
            int64_t l_idx_tmp_222727 = loopres_222707;
            int64_t r_idx_tmp_222728 = loopres_222708;
            int64_t span_tmp_222729 = loopres_222709;
            
            loop_while_222684 = loop_while_tmp_222726;
            l_idx_222685 = l_idx_tmp_222727;
            r_idx_222686 = r_idx_tmp_222728;
            span_222687 = span_tmp_222729;
        }
        idx_222596 = loop_while_222684;
        idx_222597 = l_idx_222685;
        idx_222598 = r_idx_222686;
        idx_222599 = span_222687;
        
        int64_t min_res_222637 = smin64(min_arg_207589, idx_222597);
        int64_t max_res_222638 = smax64((int64_t) 0, min_res_222637);
        int64_t x_222639 = add64(min_res_207590, max_res_222638);
        int64_t r_222640 = sub64(x_222639, (int64_t) 1);
        bool x_222641 = sle64((int64_t) 0, r_222640);
        bool y_222642 = slt64(r_222640, n_203490);
        bool bounds_check_222643 = x_222641 && y_222642;
        bool index_certs_222644;
        
        if (!bounds_check_222643) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_222640,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203490, "].",
                                   "-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:157:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:155:5-158:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_222645;
        
        x_222645 = ((int64_t *) mem_217340.mem)[gtid_207580 * n_203490 +
                                                r_222640];
        
        int64_t abs_arg_222646 = sub64(x_222645, min_res_222573);
        int64_t abs_res_222647 = abs64(abs_arg_222646);
        bool x_222648 = sle64((int64_t) 0, max_res_222638);
        bool y_222649 = slt64(max_res_222638, n_203490);
        bool bounds_check_222650 = x_222648 && y_222649;
        bool index_certs_222651;
        
        if (!bounds_check_222650) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_222638,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203490, "].",
                                   "-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  stl.fut:157:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:155:5-158:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_222652;
        
        x_222652 = ((int64_t *) mem_217340.mem)[gtid_207580 * n_203490 +
                                                max_res_222638];
        
        int64_t abs_arg_222653 = sub64(x_222652, min_res_222573);
        int64_t abs_res_222654 = abs64(abs_arg_222653);
        int64_t max_res_222655 = smax64(abs_res_222647, abs_res_222654);
        double defunc_0_f_res_222656 = sitofp_i64_f64(max_res_222655);
        double defunc_1_f_res_222657 = max_res_207594 + defunc_0_f_res_222656;
        
        ((double *) mem_217783.mem)[gtid_222571] = defunc_1_f_res_222657;
        ((int64_t *) mem_217786.mem)[gtid_222571] = max_res_222638;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235617_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235617_end -
                 futhark_mc_segmap_parloop_235617_start;
        
        ctx->futhark_mc_segmap_parloop_235617_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235617_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235617_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235615(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222570 = tid;
    int num_tasks_222664 = info.nsubtasks;
    struct futhark_mc_task_235614 *futhark_mc_task_235614 =
                                  (struct futhark_mc_task_235614 *) args;
    struct futhark_context *ctx = futhark_mc_task_235614->ctx;
    uint64_t futhark_mc_segmap_task_235615_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235615_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235614->free_n_203490;
    int64_t jump_t_203500 = futhark_mc_task_235614->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_235614->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_235614->free_i_203670;
    bool x_203671 = futhark_mc_task_235614->free_x_203671;
    int64_t min_res_203993 = futhark_mc_task_235614->free_min_res_203993;
    bool loop_cond_203998 = futhark_mc_task_235614->free_loop_cond_203998;
    int64_t gtid_207580 = futhark_mc_task_235614->free_gtid_207580;
    int64_t min_arg_207588 = futhark_mc_task_235614->free_min_arg_207588;
    int64_t min_arg_207589 = futhark_mc_task_235614->free_min_arg_207589;
    int64_t min_res_207590 = futhark_mc_task_235614->free_min_res_207590;
    double max_res_207594 = futhark_mc_task_235614->free_max_res_207594;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235614->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217780 = {.desc ="mem_217780", .mem =
                                  futhark_mc_task_235614->free_mem_217780,
                                  .size =0, .references =NULL};
    struct memblock mem_217783 = {.desc ="mem_217783", .mem =
                                  futhark_mc_task_235614->free_mem_217783,
                                  .size =0, .references =NULL};
    struct memblock mem_217786 = {.desc ="mem_217786", .mem =
                                  futhark_mc_task_235614->free_mem_217786,
                                  .size =0, .references =NULL};
    int64_t iter_222665;
    struct futhark_mc_segmap_parloop_struct_235616
    futhark_mc_segmap_parloop_struct_235616;
    
    futhark_mc_segmap_parloop_struct_235616.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235616.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235616.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_235616.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_235616.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235616.free_x_203671 = x_203671;
    futhark_mc_segmap_parloop_struct_235616.free_min_res_203993 =
        min_res_203993;
    futhark_mc_segmap_parloop_struct_235616.free_loop_cond_203998 =
        loop_cond_203998;
    futhark_mc_segmap_parloop_struct_235616.free_gtid_207580 = gtid_207580;
    futhark_mc_segmap_parloop_struct_235616.free_min_arg_207588 =
        min_arg_207588;
    futhark_mc_segmap_parloop_struct_235616.free_min_arg_207589 =
        min_arg_207589;
    futhark_mc_segmap_parloop_struct_235616.free_min_res_207590 =
        min_res_207590;
    futhark_mc_segmap_parloop_struct_235616.free_max_res_207594 =
        max_res_207594;
    futhark_mc_segmap_parloop_struct_235616.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235616.free_mem_217780 = mem_217780.mem;
    futhark_mc_segmap_parloop_struct_235616.free_mem_217783 = mem_217783.mem;
    futhark_mc_segmap_parloop_struct_235616.free_mem_217786 = mem_217786.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235617_task;
    
    futhark_mc_segmap_parloop_235617_task.name =
        "futhark_mc_segmap_parloop_235617";
    futhark_mc_segmap_parloop_235617_task.fn = futhark_mc_segmap_parloop_235617;
    futhark_mc_segmap_parloop_235617_task.args =
        &futhark_mc_segmap_parloop_struct_235616;
    futhark_mc_segmap_parloop_235617_task.iterations = iterations;
    futhark_mc_segmap_parloop_235617_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235617_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235617_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235617_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235617_task);
    
    if (futhark_mc_segmap_parloop_235617_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235617_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235617_total_end -
                 futhark_mc_segmap_parloop_235617_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235617_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235617_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235617_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235615_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235615_end -
                 futhark_mc_segmap_task_235615_start;
        
        ctx->futhark_mc_segmap_task_235615_runs[tid]++;
        ctx->futhark_mc_segmap_task_235615_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235615_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235606(void *args, int64_t start,
                                            int64_t end, int flat_tid_207579,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235605
    *futhark_mc_segmap_parloop_struct_235605 =
    (struct futhark_mc_segmap_parloop_struct_235605 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235605->ctx;
    uint64_t futhark_mc_segmap_parloop_235606_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235606_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235605->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_235605->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_235605->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235605->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_235605->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235605->free_i_203670;
    bool x_203671 = futhark_mc_segmap_parloop_struct_235605->free_x_203671;
    int64_t min_res_203993 =
            futhark_mc_segmap_parloop_struct_235605->free_min_res_203993;
    bool loop_cond_203998 =
         futhark_mc_segmap_parloop_struct_235605->free_loop_cond_203998;
    double i64_res_203999 =
           futhark_mc_segmap_parloop_struct_235605->free_i64_res_203999;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235605->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_235605->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_235605->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_235605->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_235605->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_235605->free_mem_217839,
                                  .size =0, .references =NULL};
    size_t mem_217780_cached_sizze_235607 = 0;
    unsigned char *mem_217780 = NULL;
    size_t mem_217783_cached_sizze_235608 = 0;
    unsigned char *mem_217783 = NULL;
    size_t mem_217786_cached_sizze_235609 = 0;
    unsigned char *mem_217786 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222565 = start;
    
    if (mem_217780_cached_sizze_235607 < (size_t) bytes_217302) {
        mem_217780 = realloc(mem_217780, bytes_217302);
        mem_217780_cached_sizze_235607 = bytes_217302;
    }
    if (mem_217783_cached_sizze_235608 < (size_t) bytes_217782) {
        mem_217783 = realloc(mem_217783, bytes_217782);
        mem_217783_cached_sizze_235608 = bytes_217782;
    }
    if (mem_217786_cached_sizze_235609 < (size_t) bytes_217782) {
        mem_217786 = realloc(mem_217786, bytes_217782);
        mem_217786_cached_sizze_235609 = bytes_217782;
    }
    for (; iter_222565 < end; iter_222565++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222658 = partition_sizze_203577;
        int64_t gtid_207580 = iter_222565;
        int64_t remnant_222659 = iter_222565 - gtid_207580;
        int64_t x_207582;
        
        x_207582 = ((int64_t *) mem_217343.mem)[gtid_207580];
        
        int64_t flat_tid_222566 = (int64_t) 0;
        int32_t num_tasks_222660;
        struct futhark_mc_task_235610 futhark_mc_task_235610;
        
        futhark_mc_task_235610.ctx = ctx;
        futhark_mc_task_235610.free_n_203490 = n_203490;
        futhark_mc_task_235610.free_gtid_207580 = gtid_207580;
        futhark_mc_task_235610.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_235610.free_mem_217780 = mem_217780;
        
        struct scheduler_segop futhark_mc_task_235610_task;
        
        futhark_mc_task_235610_task.args = &futhark_mc_task_235610;
        futhark_mc_task_235610_task.top_level_fn =
            futhark_mc_segmap_task_235611;
        futhark_mc_task_235610_task.name = "futhark_mc_segmap_task_235611";
        futhark_mc_task_235610_task.iterations = n_203490;
        futhark_mc_task_235610_task.task_time =
            &ctx->futhark_mc_segmap_task_235611_total_time;
        futhark_mc_task_235610_task.task_iter =
            &ctx->futhark_mc_segmap_task_235611_total_iter;
        futhark_mc_task_235610_task.sched = STATIC;
        futhark_mc_task_235610_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235611_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235610_task);
        
        if (futhark_mc_segmap_task_235611_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_207588 = sub64(x_207582, (int64_t) 1);
        int64_t min_arg_207589 = sub64(x_207582, min_res_203993);
        int64_t min_res_207590 = smin64(q_t_203494, x_207582);
        double i64_res_207591 = sitofp_i64_f64(x_207582);
        double x_207592 = i64_res_203999 - i64_res_207591;
        double max_arg_207593 = x_207592 / 2.0;
        double max_res_207594 = fmax64(0.0, max_arg_207593);
        int64_t flat_tid_222570 = (int64_t) 0;
        int32_t num_tasks_222664;
        struct futhark_mc_task_235614 futhark_mc_task_235614;
        
        futhark_mc_task_235614.ctx = ctx;
        futhark_mc_task_235614.free_n_203490 = n_203490;
        futhark_mc_task_235614.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_235614.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_235614.free_i_203670 = i_203670;
        futhark_mc_task_235614.free_x_203671 = x_203671;
        futhark_mc_task_235614.free_min_res_203993 = min_res_203993;
        futhark_mc_task_235614.free_loop_cond_203998 = loop_cond_203998;
        futhark_mc_task_235614.free_gtid_207580 = gtid_207580;
        futhark_mc_task_235614.free_min_arg_207588 = min_arg_207588;
        futhark_mc_task_235614.free_min_arg_207589 = min_arg_207589;
        futhark_mc_task_235614.free_min_res_207590 = min_res_207590;
        futhark_mc_task_235614.free_max_res_207594 = max_res_207594;
        futhark_mc_task_235614.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_235614.free_mem_217780 = mem_217780;
        futhark_mc_task_235614.free_mem_217783 = mem_217783;
        futhark_mc_task_235614.free_mem_217786 = mem_217786;
        
        struct scheduler_segop futhark_mc_task_235614_task;
        
        futhark_mc_task_235614_task.args = &futhark_mc_task_235614;
        futhark_mc_task_235614_task.top_level_fn =
            futhark_mc_segmap_task_235615;
        futhark_mc_task_235614_task.name = "futhark_mc_segmap_task_235615";
        futhark_mc_task_235614_task.iterations = t_n_m_203650;
        futhark_mc_task_235614_task.task_time =
            &ctx->futhark_mc_segmap_task_235615_total_time;
        futhark_mc_task_235614_task.task_iter =
            &ctx->futhark_mc_segmap_task_235615_total_iter;
        futhark_mc_task_235614_task.sched = DYNAMIC;
        futhark_mc_task_235614_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235615_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235614_task);
        
        if (futhark_mc_segmap_task_235615_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_217835.mem + gtid_207580 * t_n_m_203650 * (int64_t) 8,
                    mem_217786 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_217839.mem + gtid_207580 * t_n_m_203650 * (int64_t) 8,
                    mem_217783 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217780);
    free(mem_217783);
    free(mem_217786);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235606_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235606_end -
                 futhark_mc_segmap_parloop_235606_start;
        
        ctx->futhark_mc_segmap_parloop_235606_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235606_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235606_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235604(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207579 = tid;
    int num_tasks_222455 = info.nsubtasks;
    struct futhark_mc_task_235597 *futhark_mc_task_235597 =
                                  (struct futhark_mc_task_235597 *) args;
    struct futhark_context *ctx = futhark_mc_task_235597->ctx;
    uint64_t futhark_mc_segmap_nested_task_235604_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235604_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235597->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_235597->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_235597->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235597->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_235597->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_235597->free_i_203670;
    bool x_203671 = futhark_mc_task_235597->free_x_203671;
    int64_t min_res_203993 = futhark_mc_task_235597->free_min_res_203993;
    bool loop_cond_203998 = futhark_mc_task_235597->free_loop_cond_203998;
    double i64_res_203999 = futhark_mc_task_235597->free_i64_res_203999;
    int64_t bytes_217302 = futhark_mc_task_235597->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_235597->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_235597->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_235597->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_235597->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_235597->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t iter_222565;
    struct futhark_mc_segmap_parloop_struct_235605
    futhark_mc_segmap_parloop_struct_235605;
    
    futhark_mc_segmap_parloop_struct_235605.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235605.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235605.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_235605.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_235605.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235605.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_235605.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235605.free_x_203671 = x_203671;
    futhark_mc_segmap_parloop_struct_235605.free_min_res_203993 =
        min_res_203993;
    futhark_mc_segmap_parloop_struct_235605.free_loop_cond_203998 =
        loop_cond_203998;
    futhark_mc_segmap_parloop_struct_235605.free_i64_res_203999 =
        i64_res_203999;
    futhark_mc_segmap_parloop_struct_235605.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235605.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_235605.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_235605.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_235605.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_235605.free_mem_217839 = mem_217839.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235606_task;
    
    futhark_mc_segmap_parloop_235606_task.name =
        "futhark_mc_segmap_parloop_235606";
    futhark_mc_segmap_parloop_235606_task.fn = futhark_mc_segmap_parloop_235606;
    futhark_mc_segmap_parloop_235606_task.args =
        &futhark_mc_segmap_parloop_struct_235605;
    futhark_mc_segmap_parloop_235606_task.iterations = iterations;
    futhark_mc_segmap_parloop_235606_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235606_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235606_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235606_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235606_task);
    
    if (futhark_mc_segmap_parloop_235606_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235606_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235606_total_end -
                 futhark_mc_segmap_parloop_235606_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235606_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235606_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235606_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235604_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235604_end -
                 futhark_mc_segmap_nested_task_235604_start;
        
        ctx->futhark_mc_segmap_nested_task_235604_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235604_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235604_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235618 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    int64_t free_ctx_param_ext_217889;
    unsigned char *free_mem_param_217893;
    unsigned char *free_mem_217915;
};
struct futhark_mc_segmap_parloop_struct_235620 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    int64_t free_ctx_param_ext_217889;
    unsigned char *free_mem_param_217893;
    unsigned char *free_mem_217915;
};
static int futhark_mc_segmap_parloop_235621(void *args, int64_t start,
                                            int64_t end, int flat_tid_207686,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235620
    *futhark_mc_segmap_parloop_struct_235620 =
    (struct futhark_mc_segmap_parloop_struct_235620 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235620->ctx;
    uint64_t futhark_mc_segmap_parloop_235621_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235621_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235620->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235620->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235620->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235620->free_bytes_217302;
    int64_t ctx_param_ext_217889 =
            futhark_mc_segmap_parloop_struct_235620->free_ctx_param_ext_217889;
    struct memblock mem_param_217893 = {.desc ="mem_param_217893", .mem =
                                        futhark_mc_segmap_parloop_struct_235620->free_mem_param_217893,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_segmap_parloop_struct_235620->free_mem_217915,
                                  .size =0, .references =NULL};
    size_t mem_217899_cached_sizze_235622 = 0;
    unsigned char *mem_217899 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222756 = start;
    
    if (mem_217899_cached_sizze_235622 < (size_t) bytes_217302) {
        mem_217899 = realloc(mem_217899, bytes_217302);
        mem_217899_cached_sizze_235622 = bytes_217302;
    }
    for (; iter_222756 < end; iter_222756++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222763 = partition_sizze_203577;
        int64_t gtid_207687 = iter_222756;
        int64_t remnant_222764 = iter_222756 - gtid_207687;
        
        for (int64_t i_222757 = 0; i_222757 < n_203490; i_222757++) {
            double x_222759;
            
            x_222759 = ((double *) mem_217297.mem)[gtid_207687 * n_203490 +
                                                   i_222757];
            
            double x_222760;
            
            x_222760 = ((double *) mem_param_217893.mem)[gtid_207687 *
                                                         ctx_param_ext_217889 +
                                                         i_222757];
            
            double defunc_1_f_res_222761 = x_222759 - x_222760;
            
            ((double *) mem_217899)[i_222757] = defunc_1_f_res_222761;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_217915.mem + gtid_207687 * n_203490 * (int64_t) 8,
                    mem_217899 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217899);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235621_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235621_end -
                 futhark_mc_segmap_parloop_235621_start;
        
        ctx->futhark_mc_segmap_parloop_235621_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235621_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235621_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235619(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207686 = tid;
    int num_tasks_222755 = info.nsubtasks;
    struct futhark_mc_task_235618 *futhark_mc_task_235618 =
                                  (struct futhark_mc_task_235618 *) args;
    struct futhark_context *ctx = futhark_mc_task_235618->ctx;
    uint64_t futhark_mc_segmap_task_235619_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235619_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235618->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235618->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235618->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_235618->free_bytes_217302;
    int64_t ctx_param_ext_217889 =
            futhark_mc_task_235618->free_ctx_param_ext_217889;
    struct memblock mem_param_217893 = {.desc ="mem_param_217893", .mem =
                                        futhark_mc_task_235618->free_mem_param_217893,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_task_235618->free_mem_217915,
                                  .size =0, .references =NULL};
    int64_t iter_222756;
    struct futhark_mc_segmap_parloop_struct_235620
    futhark_mc_segmap_parloop_struct_235620;
    
    futhark_mc_segmap_parloop_struct_235620.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235620.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235620.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235620.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235620.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235620.free_ctx_param_ext_217889 =
        ctx_param_ext_217889;
    futhark_mc_segmap_parloop_struct_235620.free_mem_param_217893 =
        mem_param_217893.mem;
    futhark_mc_segmap_parloop_struct_235620.free_mem_217915 = mem_217915.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235621_task;
    
    futhark_mc_segmap_parloop_235621_task.name =
        "futhark_mc_segmap_parloop_235621";
    futhark_mc_segmap_parloop_235621_task.fn = futhark_mc_segmap_parloop_235621;
    futhark_mc_segmap_parloop_235621_task.args =
        &futhark_mc_segmap_parloop_struct_235620;
    futhark_mc_segmap_parloop_235621_task.iterations = iterations;
    futhark_mc_segmap_parloop_235621_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235621_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235621_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235621_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235621_task);
    
    if (futhark_mc_segmap_parloop_235621_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235621_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235621_total_end -
                 futhark_mc_segmap_parloop_235621_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235621_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235621_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235621_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235619_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235619_end -
                 futhark_mc_segmap_task_235619_start;
        
        ctx->futhark_mc_segmap_task_235619_runs[tid]++;
        ctx->futhark_mc_segmap_task_235619_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235619_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235624 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    int64_t free_ctx_param_ext_217889;
    unsigned char *free_mem_param_217893;
    unsigned char *free_mem_217915;
};
struct futhark_mc_task_235627 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_207693;
    unsigned char *free_mem_217297;
    int64_t free_ctx_param_ext_217889;
    unsigned char *free_mem_param_217893;
    unsigned char *free_mem_217896;
};
struct futhark_mc_segmap_parloop_struct_235629 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_207693;
    unsigned char *free_mem_217297;
    int64_t free_ctx_param_ext_217889;
    unsigned char *free_mem_param_217893;
    unsigned char *free_mem_217896;
};
static int futhark_mc_segmap_parloop_235630(void *args, int64_t start,
                                            int64_t end, int flat_tid_222767,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235629
    *futhark_mc_segmap_parloop_struct_235629 =
    (struct futhark_mc_segmap_parloop_struct_235629 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235629->ctx;
    uint64_t futhark_mc_segmap_parloop_235630_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235630_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235629->free_n_203490;
    int64_t gtid_207693 =
            futhark_mc_segmap_parloop_struct_235629->free_gtid_207693;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235629->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217889 =
            futhark_mc_segmap_parloop_struct_235629->free_ctx_param_ext_217889;
    struct memblock mem_param_217893 = {.desc ="mem_param_217893", .mem =
                                        futhark_mc_segmap_parloop_struct_235629->free_mem_param_217893,
                                        .size =0, .references =NULL};
    struct memblock mem_217896 = {.desc ="mem_217896", .mem =
                                  futhark_mc_segmap_parloop_struct_235629->free_mem_217896,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222775 = start;
    
    for (; iter_222775 < end; iter_222775++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222776 = n_203490;
        int64_t gtid_222768 = iter_222775;
        int64_t remnant_222777 = iter_222775 - gtid_222768;
        double x_222769;
        
        x_222769 = ((double *) mem_217297.mem)[gtid_207693 * n_203490 +
                                               gtid_222768];
        
        double x_222770;
        
        x_222770 = ((double *) mem_param_217893.mem)[gtid_207693 *
                                                     ctx_param_ext_217889 +
                                                     gtid_222768];
        
        double defunc_1_f_res_222771 = x_222769 - x_222770;
        
        ((double *) mem_217896.mem)[gtid_222768] = defunc_1_f_res_222771;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235630_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235630_end -
                 futhark_mc_segmap_parloop_235630_start;
        
        ctx->futhark_mc_segmap_parloop_235630_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235630_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235630_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235628(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222767 = tid;
    int num_tasks_222774 = info.nsubtasks;
    struct futhark_mc_task_235627 *futhark_mc_task_235627 =
                                  (struct futhark_mc_task_235627 *) args;
    struct futhark_context *ctx = futhark_mc_task_235627->ctx;
    uint64_t futhark_mc_segmap_task_235628_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235628_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235627->free_n_203490;
    int64_t gtid_207693 = futhark_mc_task_235627->free_gtid_207693;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235627->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217889 =
            futhark_mc_task_235627->free_ctx_param_ext_217889;
    struct memblock mem_param_217893 = {.desc ="mem_param_217893", .mem =
                                        futhark_mc_task_235627->free_mem_param_217893,
                                        .size =0, .references =NULL};
    struct memblock mem_217896 = {.desc ="mem_217896", .mem =
                                  futhark_mc_task_235627->free_mem_217896,
                                  .size =0, .references =NULL};
    int64_t iter_222775;
    struct futhark_mc_segmap_parloop_struct_235629
    futhark_mc_segmap_parloop_struct_235629;
    
    futhark_mc_segmap_parloop_struct_235629.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235629.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235629.free_gtid_207693 = gtid_207693;
    futhark_mc_segmap_parloop_struct_235629.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235629.free_ctx_param_ext_217889 =
        ctx_param_ext_217889;
    futhark_mc_segmap_parloop_struct_235629.free_mem_param_217893 =
        mem_param_217893.mem;
    futhark_mc_segmap_parloop_struct_235629.free_mem_217896 = mem_217896.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235630_task;
    
    futhark_mc_segmap_parloop_235630_task.name =
        "futhark_mc_segmap_parloop_235630";
    futhark_mc_segmap_parloop_235630_task.fn = futhark_mc_segmap_parloop_235630;
    futhark_mc_segmap_parloop_235630_task.args =
        &futhark_mc_segmap_parloop_struct_235629;
    futhark_mc_segmap_parloop_235630_task.iterations = iterations;
    futhark_mc_segmap_parloop_235630_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235630_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235630_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235630_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235630_task);
    
    if (futhark_mc_segmap_parloop_235630_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235630_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235630_total_end -
                 futhark_mc_segmap_parloop_235630_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235630_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235630_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235630_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235628_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235628_end -
                 futhark_mc_segmap_task_235628_start;
        
        ctx->futhark_mc_segmap_task_235628_runs[tid]++;
        ctx->futhark_mc_segmap_task_235628_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235628_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235625(void *args, int64_t start,
                                            int64_t end, int flat_tid_207692,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235624
    *futhark_mc_segmap_parloop_struct_235624 =
    (struct futhark_mc_segmap_parloop_struct_235624 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235624->ctx;
    uint64_t futhark_mc_segmap_parloop_235625_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235625_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235624->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235624->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_235624->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_235624->free_bytes_217302;
    int64_t ctx_param_ext_217889 =
            futhark_mc_segmap_parloop_struct_235624->free_ctx_param_ext_217889;
    struct memblock mem_param_217893 = {.desc ="mem_param_217893", .mem =
                                        futhark_mc_segmap_parloop_struct_235624->free_mem_param_217893,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_segmap_parloop_struct_235624->free_mem_217915,
                                  .size =0, .references =NULL};
    size_t mem_217896_cached_sizze_235626 = 0;
    unsigned char *mem_217896 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222766 = start;
    
    if (mem_217896_cached_sizze_235626 < (size_t) bytes_217302) {
        mem_217896 = realloc(mem_217896, bytes_217302);
        mem_217896_cached_sizze_235626 = bytes_217302;
    }
    for (; iter_222766 < end; iter_222766++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222772 = partition_sizze_203577;
        int64_t gtid_207693 = iter_222766;
        int64_t remnant_222773 = iter_222766 - gtid_207693;
        int64_t flat_tid_222767 = (int64_t) 0;
        int32_t num_tasks_222774;
        struct futhark_mc_task_235627 futhark_mc_task_235627;
        
        futhark_mc_task_235627.ctx = ctx;
        futhark_mc_task_235627.free_n_203490 = n_203490;
        futhark_mc_task_235627.free_gtid_207693 = gtid_207693;
        futhark_mc_task_235627.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_235627.free_ctx_param_ext_217889 = ctx_param_ext_217889;
        futhark_mc_task_235627.free_mem_param_217893 = mem_param_217893.mem;
        futhark_mc_task_235627.free_mem_217896 = mem_217896;
        
        struct scheduler_segop futhark_mc_task_235627_task;
        
        futhark_mc_task_235627_task.args = &futhark_mc_task_235627;
        futhark_mc_task_235627_task.top_level_fn =
            futhark_mc_segmap_task_235628;
        futhark_mc_task_235627_task.name = "futhark_mc_segmap_task_235628";
        futhark_mc_task_235627_task.iterations = n_203490;
        futhark_mc_task_235627_task.task_time =
            &ctx->futhark_mc_segmap_task_235628_total_time;
        futhark_mc_task_235627_task.task_iter =
            &ctx->futhark_mc_segmap_task_235628_total_iter;
        futhark_mc_task_235627_task.sched = STATIC;
        futhark_mc_task_235627_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235628_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235627_task);
        
        if (futhark_mc_segmap_task_235628_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_217915.mem + gtid_207693 * n_203490 * (int64_t) 8,
                    mem_217896 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217896);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235625_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235625_end -
                 futhark_mc_segmap_parloop_235625_start;
        
        ctx->futhark_mc_segmap_parloop_235625_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235625_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235625_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235623(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207692 = tid;
    int num_tasks_222755 = info.nsubtasks;
    struct futhark_mc_task_235618 *futhark_mc_task_235618 =
                                  (struct futhark_mc_task_235618 *) args;
    struct futhark_context *ctx = futhark_mc_task_235618->ctx;
    uint64_t futhark_mc_segmap_nested_task_235623_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235623_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235618->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235618->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_235618->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_235618->free_bytes_217302;
    int64_t ctx_param_ext_217889 =
            futhark_mc_task_235618->free_ctx_param_ext_217889;
    struct memblock mem_param_217893 = {.desc ="mem_param_217893", .mem =
                                        futhark_mc_task_235618->free_mem_param_217893,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_task_235618->free_mem_217915,
                                  .size =0, .references =NULL};
    int64_t iter_222766;
    struct futhark_mc_segmap_parloop_struct_235624
    futhark_mc_segmap_parloop_struct_235624;
    
    futhark_mc_segmap_parloop_struct_235624.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235624.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235624.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235624.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_235624.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_235624.free_ctx_param_ext_217889 =
        ctx_param_ext_217889;
    futhark_mc_segmap_parloop_struct_235624.free_mem_param_217893 =
        mem_param_217893.mem;
    futhark_mc_segmap_parloop_struct_235624.free_mem_217915 = mem_217915.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235625_task;
    
    futhark_mc_segmap_parloop_235625_task.name =
        "futhark_mc_segmap_parloop_235625";
    futhark_mc_segmap_parloop_235625_task.fn = futhark_mc_segmap_parloop_235625;
    futhark_mc_segmap_parloop_235625_task.args =
        &futhark_mc_segmap_parloop_struct_235624;
    futhark_mc_segmap_parloop_235625_task.iterations = iterations;
    futhark_mc_segmap_parloop_235625_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235625_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235625_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235625_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235625_task);
    
    if (futhark_mc_segmap_parloop_235625_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235625_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235625_total_end -
                 futhark_mc_segmap_parloop_235625_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235625_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235625_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235625_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235623_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235623_end -
                 futhark_mc_segmap_nested_task_235623_start;
        
        ctx->futhark_mc_segmap_nested_task_235623_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235623_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235623_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235631 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_bytes_217345;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
};
struct futhark_mc_segmap_parloop_struct_235633 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
};
static int futhark_mc_segmap_parloop_235634(void *args, int64_t start,
                                            int64_t end, int flat_tid_207702,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235633
    *futhark_mc_segmap_parloop_struct_235633 =
    (struct futhark_mc_segmap_parloop_struct_235633 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235633->ctx;
    uint64_t futhark_mc_segmap_parloop_235634_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235634_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235633->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235633->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235633->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235633->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235633->free_i_203670;
    int64_t bytes_217364 =
            futhark_mc_segmap_parloop_struct_235633->free_bytes_217364;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235633->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_235633->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_235633->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_235633->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_235633->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_segmap_parloop_struct_235633->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235633->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235633->free_mem_218057,
                                  .size =0, .references =NULL};
    size_t mem_217963_cached_sizze_235635 = 0;
    unsigned char *mem_217963 = NULL;
    size_t mem_217967_cached_sizze_235636 = 0;
    unsigned char *mem_217967 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222779 = start;
    
    if (mem_217963_cached_sizze_235635 < (size_t) bytes_217364) {
        mem_217963 = realloc(mem_217963, bytes_217364);
        mem_217963_cached_sizze_235635 = bytes_217364;
    }
    if (mem_217967_cached_sizze_235636 < (size_t) bytes_217364) {
        mem_217967 = realloc(mem_217967, bytes_217364);
        mem_217967_cached_sizze_235636 = bytes_217364;
    }
    for (; iter_222779 < end; iter_222779++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222806 = partition_sizze_203577;
        int64_t gtid_207703 = iter_222779;
        int64_t remnant_222807 = iter_222779 - gtid_207703;
        
        for (int64_t i_222780 = 0; i_222780 < n_p_203492; i_222780++) {
            for (int64_t i_222785 = 0; i_222785 < defunc_0_f_res_203631;
                 i_222785++) {
                int64_t x_222788;
                
                x_222788 = ((int64_t *) mem_217536.mem)[gtid_207703 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_222780 *
                                                        defunc_0_f_res_203631 +
                                                        i_222785];
                
                int64_t x_222789 = mul64(n_p_203492, x_222788);
                int64_t idx_222790 = add64(x_222789, i_222780);
                bool cond_222791 = slt64(i_203670, idx_222790);
                bool cond_f_res_222792 = slt64(x_222788, (int64_t) 0);
                bool x_222793 = !cond_222791;
                bool y_222794 = cond_f_res_222792 && x_222793;
                bool cond_222795 = cond_222791 || y_222794;
                double defunc_0_f_res_222796;
                double defunc_0_f_res_222797;
                
                if (cond_222795) {
                    defunc_0_f_res_222796 = 0.0;
                    defunc_0_f_res_222797 = 0.0;
                } else {
                    bool x_222798 = sle64((int64_t) 0, idx_222790);
                    bool y_222799 = slt64(idx_222790, n_203490);
                    bool bounds_check_222800 = x_222798 && y_222799;
                    bool index_certs_222801;
                    
                    if (!bounds_check_222800) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) idx_222790,
                                      "] out of bounds for array of shape [",
                                      (long long) n_203490, "].",
                                      "-> #0  stl.fut:193:42-57\n   #1  stl.fut:188:28-194:44\n   #2  /prelude/soacs.fut:67:19-23\n   #3  /prelude/soacs.fut:67:3-37\n   #4  stl.fut:186:21-195:50\n   #5  /prelude/soacs.fut:75:22-28\n   #6  /prelude/soacs.fut:75:3-45\n   #7  stl.fut:184:13-196:57\n   #8  stl.fut:415:61-429:75\n   #9  stl.fut:455:3-469:34\n   #10 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    double defunc_0_f_res_f_res_222802;
                    
                    defunc_0_f_res_f_res_222802 =
                        ((double *) mem_217915.mem)[gtid_207703 * n_203490 +
                                                    idx_222790];
                    
                    double defunc_0_f_res_f_res_222803;
                    
                    defunc_0_f_res_f_res_222803 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_207703 *
                                                           ctx_param_ext_217867 +
                                                           idx_222790 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_222796 = defunc_0_f_res_f_res_222802;
                    defunc_0_f_res_222797 = defunc_0_f_res_f_res_222803;
                }
                ((double *) mem_217963)[i_222780 * defunc_0_f_res_203631 +
                                        i_222785] = defunc_0_f_res_222796;
                ((double *) mem_217967)[i_222780 * defunc_0_f_res_203631 +
                                        i_222785] = defunc_0_f_res_222797;
            }
        }
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_218052.mem + gtid_207703 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217963 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_218057.mem + gtid_207703 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217967 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217963);
    free(mem_217967);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235634_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235634_end -
                 futhark_mc_segmap_parloop_235634_start;
        
        ctx->futhark_mc_segmap_parloop_235634_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235634_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235634_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235632(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207702 = tid;
    int num_tasks_222778 = info.nsubtasks;
    struct futhark_mc_task_235631 *futhark_mc_task_235631 =
                                  (struct futhark_mc_task_235631 *) args;
    struct futhark_context *ctx = futhark_mc_task_235631->ctx;
    uint64_t futhark_mc_segmap_task_235632_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235632_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235631->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235631->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235631->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235631->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235631->free_i_203670;
    int64_t bytes_217345 = futhark_mc_task_235631->free_bytes_217345;
    int64_t bytes_217364 = futhark_mc_task_235631->free_bytes_217364;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235631->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_235631->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_235631->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_235631->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_235631->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_task_235631->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235631->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235631->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t iter_222779;
    struct futhark_mc_segmap_parloop_struct_235633
    futhark_mc_segmap_parloop_struct_235633;
    
    futhark_mc_segmap_parloop_struct_235633.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235633.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235633.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235633.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235633.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235633.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235633.free_bytes_217364 = bytes_217364;
    futhark_mc_segmap_parloop_struct_235633.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235633.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_235633.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_235633.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_235633.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_235633.free_mem_217915 = mem_217915.mem;
    futhark_mc_segmap_parloop_struct_235633.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235633.free_mem_218057 = mem_218057.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235634_task;
    
    futhark_mc_segmap_parloop_235634_task.name =
        "futhark_mc_segmap_parloop_235634";
    futhark_mc_segmap_parloop_235634_task.fn = futhark_mc_segmap_parloop_235634;
    futhark_mc_segmap_parloop_235634_task.args =
        &futhark_mc_segmap_parloop_struct_235633;
    futhark_mc_segmap_parloop_235634_task.iterations = iterations;
    futhark_mc_segmap_parloop_235634_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235634_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235634_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235634_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235634_task);
    
    if (futhark_mc_segmap_parloop_235634_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235634_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235634_total_end -
                 futhark_mc_segmap_parloop_235634_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235634_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235634_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235634_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235632_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235632_end -
                 futhark_mc_segmap_task_235632_start;
        
        ctx->futhark_mc_segmap_task_235632_runs[tid]++;
        ctx->futhark_mc_segmap_task_235632_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235632_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235638 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_bytes_217345;
    int64_t free_bytes_217364;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
};
struct futhark_mc_task_235642 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_207737;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    unsigned char *free_mem_217955;
    unsigned char *free_mem_217959;
};
struct futhark_mc_segmap_parloop_struct_235644 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_207737;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    unsigned char *free_mem_217955;
    unsigned char *free_mem_217959;
};
static int futhark_mc_segmap_parloop_235645(void *args, int64_t start,
                                            int64_t end, int flat_tid_222837,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235644
    *futhark_mc_segmap_parloop_struct_235644 =
    (struct futhark_mc_segmap_parloop_struct_235644 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235644->ctx;
    uint64_t futhark_mc_segmap_parloop_235645_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235645_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235644->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235644->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235644->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235644->free_i_203670;
    int64_t gtid_207737 =
            futhark_mc_segmap_parloop_struct_235644->free_gtid_207737;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235644->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235644->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_235644->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_235644->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_235644->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_235644->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_segmap_parloop_struct_235644->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_217955 = {.desc ="mem_217955", .mem =
                                  futhark_mc_segmap_parloop_struct_235644->free_mem_217955,
                                  .size =0, .references =NULL};
    struct memblock mem_217959 = {.desc ="mem_217959", .mem =
                                  futhark_mc_segmap_parloop_struct_235644->free_mem_217959,
                                  .size =0, .references =NULL};
    size_t mem_222839_cached_sizze_235646 = 0;
    unsigned char *mem_222839 = NULL;
    size_t mem_222841_cached_sizze_235647 = 0;
    unsigned char *mem_222841 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222869 = start;
    
    if (mem_222839_cached_sizze_235646 < (size_t) bytes_217345) {
        mem_222839 = realloc(mem_222839, bytes_217345);
        mem_222839_cached_sizze_235646 = bytes_217345;
    }
    if (mem_222841_cached_sizze_235647 < (size_t) bytes_217345) {
        mem_222841 = realloc(mem_222841, bytes_217345);
        mem_222841_cached_sizze_235647 = bytes_217345;
    }
    for (; iter_222869 < end; iter_222869++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222891 = n_p_203492;
        int64_t gtid_222838 = iter_222869;
        int64_t remnant_222892 = iter_222869 - gtid_222838;
        
        for (int64_t i_222870 = 0; i_222870 < defunc_0_f_res_203631;
             i_222870++) {
            int64_t x_222873;
            
            x_222873 = ((int64_t *) mem_217536.mem)[gtid_207737 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_222838 *
                                                    defunc_0_f_res_203631 +
                                                    i_222870];
            
            int64_t x_222874 = mul64(n_p_203492, x_222873);
            int64_t idx_222875 = add64(gtid_222838, x_222874);
            bool cond_222876 = slt64(i_203670, idx_222875);
            bool cond_f_res_222877 = slt64(x_222873, (int64_t) 0);
            bool x_222878 = !cond_222876;
            bool y_222879 = cond_f_res_222877 && x_222878;
            bool cond_222880 = cond_222876 || y_222879;
            double defunc_0_f_res_222881;
            double defunc_0_f_res_222882;
            
            if (cond_222880) {
                defunc_0_f_res_222881 = 0.0;
                defunc_0_f_res_222882 = 0.0;
            } else {
                bool x_222883 = sle64((int64_t) 0, idx_222875);
                bool y_222884 = slt64(idx_222875, n_203490);
                bool bounds_check_222885 = x_222883 && y_222884;
                bool index_certs_222886;
                
                if (!bounds_check_222885) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_222875,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  stl.fut:193:42-57\n   #1  stl.fut:188:28-194:44\n   #2  /prelude/soacs.fut:67:19-23\n   #3  /prelude/soacs.fut:67:3-37\n   #4  stl.fut:186:21-195:50\n   #5  /prelude/soacs.fut:75:22-28\n   #6  /prelude/soacs.fut:75:3-45\n   #7  stl.fut:184:13-196:57\n   #8  stl.fut:415:61-429:75\n   #9  stl.fut:455:3-469:34\n   #10 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_f_res_222887;
                
                defunc_0_f_res_f_res_222887 =
                    ((double *) mem_217915.mem)[gtid_207737 * n_203490 +
                                                idx_222875];
                
                double defunc_0_f_res_f_res_222888;
                
                defunc_0_f_res_f_res_222888 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_207737 *
                                                       ctx_param_ext_217867 +
                                                       idx_222875 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_222881 = defunc_0_f_res_f_res_222887;
                defunc_0_f_res_222882 = defunc_0_f_res_f_res_222888;
            }
            ((double *) mem_222839)[i_222870] = defunc_0_f_res_222881;
            ((double *) mem_222841)[i_222870] = defunc_0_f_res_222882;
        }
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217955.mem + gtid_222838 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_222839 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217959.mem + gtid_222838 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_222841 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_222839);
    free(mem_222841);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235645_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235645_end -
                 futhark_mc_segmap_parloop_235645_start;
        
        ctx->futhark_mc_segmap_parloop_235645_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235645_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235645_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235643(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222837 = tid;
    int num_tasks_222868 = info.nsubtasks;
    struct futhark_mc_task_235642 *futhark_mc_task_235642 =
                                  (struct futhark_mc_task_235642 *) args;
    struct futhark_context *ctx = futhark_mc_task_235642->ctx;
    uint64_t futhark_mc_segmap_task_235643_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235643_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235642->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235642->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235642->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235642->free_i_203670;
    int64_t gtid_207737 = futhark_mc_task_235642->free_gtid_207737;
    int64_t bytes_217345 = futhark_mc_task_235642->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235642->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_235642->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_235642->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_235642->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_235642->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_task_235642->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_217955 = {.desc ="mem_217955", .mem =
                                  futhark_mc_task_235642->free_mem_217955,
                                  .size =0, .references =NULL};
    struct memblock mem_217959 = {.desc ="mem_217959", .mem =
                                  futhark_mc_task_235642->free_mem_217959,
                                  .size =0, .references =NULL};
    int64_t iter_222869;
    struct futhark_mc_segmap_parloop_struct_235644
    futhark_mc_segmap_parloop_struct_235644;
    
    futhark_mc_segmap_parloop_struct_235644.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235644.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235644.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235644.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235644.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235644.free_gtid_207737 = gtid_207737;
    futhark_mc_segmap_parloop_struct_235644.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235644.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235644.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_235644.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_235644.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_235644.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_235644.free_mem_217915 = mem_217915.mem;
    futhark_mc_segmap_parloop_struct_235644.free_mem_217955 = mem_217955.mem;
    futhark_mc_segmap_parloop_struct_235644.free_mem_217959 = mem_217959.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235645_task;
    
    futhark_mc_segmap_parloop_235645_task.name =
        "futhark_mc_segmap_parloop_235645";
    futhark_mc_segmap_parloop_235645_task.fn = futhark_mc_segmap_parloop_235645;
    futhark_mc_segmap_parloop_235645_task.args =
        &futhark_mc_segmap_parloop_struct_235644;
    futhark_mc_segmap_parloop_235645_task.iterations = iterations;
    futhark_mc_segmap_parloop_235645_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235645_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235645_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235645_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235645_task);
    
    if (futhark_mc_segmap_parloop_235645_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235645_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235645_total_end -
                 futhark_mc_segmap_parloop_235645_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235645_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235645_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235645_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235643_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235643_end -
                 futhark_mc_segmap_task_235643_start;
        
        ctx->futhark_mc_segmap_task_235643_runs[tid]++;
        ctx->futhark_mc_segmap_task_235643_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235643_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235649 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_207737;
    int64_t free_bytes_217345;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    unsigned char *free_mem_217955;
    unsigned char *free_mem_217959;
};
struct futhark_mc_task_235653 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_207737;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    int64_t free_gtid_222814;
    unsigned char *free_mem_222815;
    unsigned char *free_mem_222816;
};
struct futhark_mc_segmap_parloop_struct_235655 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_i_203670;
    int64_t free_gtid_207737;
    unsigned char *free_mem_217536;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_217915;
    int64_t free_gtid_222814;
    unsigned char *free_mem_222815;
    unsigned char *free_mem_222816;
};
static int futhark_mc_segmap_parloop_235656(void *args, int64_t start,
                                            int64_t end, int flat_tid_222896,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235655
    *futhark_mc_segmap_parloop_struct_235655 =
    (struct futhark_mc_segmap_parloop_struct_235655 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235655->ctx;
    uint64_t futhark_mc_segmap_parloop_235656_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235656_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235655->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235655->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235655->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235655->free_i_203670;
    int64_t gtid_207737 =
            futhark_mc_segmap_parloop_struct_235655->free_gtid_207737;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235655->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_235655->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_235655->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_235655->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_235655->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_segmap_parloop_struct_235655->free_mem_217915,
                                  .size =0, .references =NULL};
    int64_t gtid_222814 =
            futhark_mc_segmap_parloop_struct_235655->free_gtid_222814;
    struct memblock mem_222815 = {.desc ="mem_222815", .mem =
                                  futhark_mc_segmap_parloop_struct_235655->free_mem_222815,
                                  .size =0, .references =NULL};
    struct memblock mem_222816 = {.desc ="mem_222816", .mem =
                                  futhark_mc_segmap_parloop_struct_235655->free_mem_222816,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222917 = start;
    
    for (; iter_222917 < end; iter_222917++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222924 = defunc_0_f_res_203631;
        int64_t gtid_222897 = iter_222917;
        int64_t remnant_222925 = iter_222917 - gtid_222897;
        int64_t x_222898;
        
        x_222898 = ((int64_t *) mem_217536.mem)[gtid_207737 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_222814 *
                                                defunc_0_f_res_203631 +
                                                gtid_222897];
        
        int64_t x_222899 = mul64(n_p_203492, x_222898);
        int64_t idx_222900 = add64(gtid_222814, x_222899);
        bool cond_222901 = slt64(i_203670, idx_222900);
        bool cond_f_res_222902 = slt64(x_222898, (int64_t) 0);
        bool x_222903 = !cond_222901;
        bool y_222904 = cond_f_res_222902 && x_222903;
        bool cond_222905 = cond_222901 || y_222904;
        double defunc_0_f_res_222906;
        double defunc_0_f_res_222907;
        
        if (cond_222905) {
            defunc_0_f_res_222906 = 0.0;
            defunc_0_f_res_222907 = 0.0;
        } else {
            bool x_222918 = sle64((int64_t) 0, idx_222900);
            bool y_222919 = slt64(idx_222900, n_203490);
            bool bounds_check_222920 = x_222918 && y_222919;
            bool index_certs_222921;
            
            if (!bounds_check_222920) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_222900,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  stl.fut:193:42-57\n   #1  stl.fut:188:28-194:44\n   #2  /prelude/soacs.fut:67:19-23\n   #3  /prelude/soacs.fut:67:3-37\n   #4  stl.fut:186:21-195:50\n   #5  /prelude/soacs.fut:75:22-28\n   #6  /prelude/soacs.fut:75:3-45\n   #7  stl.fut:184:13-196:57\n   #8  stl.fut:415:61-429:75\n   #9  stl.fut:455:3-469:34\n   #10 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_f_res_222922;
            
            defunc_0_f_res_f_res_222922 =
                ((double *) mem_217915.mem)[gtid_207737 * n_203490 +
                                            idx_222900];
            
            double defunc_0_f_res_f_res_222923;
            
            defunc_0_f_res_f_res_222923 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_207737 *
                                                   ctx_param_ext_217867 +
                                                   idx_222900 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_222906 = defunc_0_f_res_f_res_222922;
            defunc_0_f_res_222907 = defunc_0_f_res_f_res_222923;
        }
        ((double *) mem_222815.mem)[gtid_222897] = defunc_0_f_res_222906;
        ((double *) mem_222816.mem)[gtid_222897] = defunc_0_f_res_222907;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235656_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235656_end -
                 futhark_mc_segmap_parloop_235656_start;
        
        ctx->futhark_mc_segmap_parloop_235656_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235656_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235656_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235654(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222896 = tid;
    int num_tasks_222916 = info.nsubtasks;
    struct futhark_mc_task_235653 *futhark_mc_task_235653 =
                                  (struct futhark_mc_task_235653 *) args;
    struct futhark_context *ctx = futhark_mc_task_235653->ctx;
    uint64_t futhark_mc_segmap_task_235654_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235654_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235653->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235653->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235653->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235653->free_i_203670;
    int64_t gtid_207737 = futhark_mc_task_235653->free_gtid_207737;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235653->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_235653->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_235653->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_235653->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_235653->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_task_235653->free_mem_217915,
                                  .size =0, .references =NULL};
    int64_t gtid_222814 = futhark_mc_task_235653->free_gtid_222814;
    struct memblock mem_222815 = {.desc ="mem_222815", .mem =
                                  futhark_mc_task_235653->free_mem_222815,
                                  .size =0, .references =NULL};
    struct memblock mem_222816 = {.desc ="mem_222816", .mem =
                                  futhark_mc_task_235653->free_mem_222816,
                                  .size =0, .references =NULL};
    int64_t iter_222917;
    struct futhark_mc_segmap_parloop_struct_235655
    futhark_mc_segmap_parloop_struct_235655;
    
    futhark_mc_segmap_parloop_struct_235655.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235655.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235655.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235655.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235655.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235655.free_gtid_207737 = gtid_207737;
    futhark_mc_segmap_parloop_struct_235655.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235655.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_235655.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_235655.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_235655.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_235655.free_mem_217915 = mem_217915.mem;
    futhark_mc_segmap_parloop_struct_235655.free_gtid_222814 = gtid_222814;
    futhark_mc_segmap_parloop_struct_235655.free_mem_222815 = mem_222815.mem;
    futhark_mc_segmap_parloop_struct_235655.free_mem_222816 = mem_222816.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235656_task;
    
    futhark_mc_segmap_parloop_235656_task.name =
        "futhark_mc_segmap_parloop_235656";
    futhark_mc_segmap_parloop_235656_task.fn = futhark_mc_segmap_parloop_235656;
    futhark_mc_segmap_parloop_235656_task.args =
        &futhark_mc_segmap_parloop_struct_235655;
    futhark_mc_segmap_parloop_235656_task.iterations = iterations;
    futhark_mc_segmap_parloop_235656_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235656_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235656_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235656_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235656_task);
    
    if (futhark_mc_segmap_parloop_235656_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235656_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235656_total_end -
                 futhark_mc_segmap_parloop_235656_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235656_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235656_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235656_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235654_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235654_end -
                 futhark_mc_segmap_task_235654_start;
        
        ctx->futhark_mc_segmap_task_235654_runs[tid]++;
        ctx->futhark_mc_segmap_task_235654_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235654_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235650(void *args, int64_t start,
                                            int64_t end, int flat_tid_222813,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235649
    *futhark_mc_segmap_parloop_struct_235649 =
    (struct futhark_mc_segmap_parloop_struct_235649 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235649->ctx;
    uint64_t futhark_mc_segmap_parloop_235650_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235650_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235649->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235649->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235649->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235649->free_i_203670;
    int64_t gtid_207737 =
            futhark_mc_segmap_parloop_struct_235649->free_gtid_207737;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235649->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235649->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_235649->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_235649->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_235649->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_235649->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_segmap_parloop_struct_235649->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_217955 = {.desc ="mem_217955", .mem =
                                  futhark_mc_segmap_parloop_struct_235649->free_mem_217955,
                                  .size =0, .references =NULL};
    struct memblock mem_217959 = {.desc ="mem_217959", .mem =
                                  futhark_mc_segmap_parloop_struct_235649->free_mem_217959,
                                  .size =0, .references =NULL};
    size_t mem_222815_cached_sizze_235651 = 0;
    unsigned char *mem_222815 = NULL;
    size_t mem_222816_cached_sizze_235652 = 0;
    unsigned char *mem_222816 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222895 = start;
    
    if (mem_222815_cached_sizze_235651 < (size_t) bytes_217345) {
        mem_222815 = realloc(mem_222815, bytes_217345);
        mem_222815_cached_sizze_235651 = bytes_217345;
    }
    if (mem_222816_cached_sizze_235652 < (size_t) bytes_217345) {
        mem_222816 = realloc(mem_222816, bytes_217345);
        mem_222816_cached_sizze_235652 = bytes_217345;
    }
    for (; iter_222895 < end; iter_222895++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222914 = n_p_203492;
        int64_t gtid_222814 = iter_222895;
        int64_t remnant_222915 = iter_222895 - gtid_222814;
        int64_t flat_tid_222896 = (int64_t) 0;
        int32_t num_tasks_222916;
        struct futhark_mc_task_235653 futhark_mc_task_235653;
        
        futhark_mc_task_235653.ctx = ctx;
        futhark_mc_task_235653.free_n_203490 = n_203490;
        futhark_mc_task_235653.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235653.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235653.free_i_203670 = i_203670;
        futhark_mc_task_235653.free_gtid_207737 = gtid_207737;
        futhark_mc_task_235653.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235653.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_235653.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_235653.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_235653.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_235653.free_mem_217915 = mem_217915.mem;
        futhark_mc_task_235653.free_gtid_222814 = gtid_222814;
        futhark_mc_task_235653.free_mem_222815 = mem_222815;
        futhark_mc_task_235653.free_mem_222816 = mem_222816;
        
        struct scheduler_segop futhark_mc_task_235653_task;
        
        futhark_mc_task_235653_task.args = &futhark_mc_task_235653;
        futhark_mc_task_235653_task.top_level_fn =
            futhark_mc_segmap_task_235654;
        futhark_mc_task_235653_task.name = "futhark_mc_segmap_task_235654";
        futhark_mc_task_235653_task.iterations = defunc_0_f_res_203631;
        futhark_mc_task_235653_task.task_time =
            &ctx->futhark_mc_segmap_task_235654_total_time;
        futhark_mc_task_235653_task.task_iter =
            &ctx->futhark_mc_segmap_task_235654_total_iter;
        futhark_mc_task_235653_task.sched = STATIC;
        futhark_mc_task_235653_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235654_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235653_task);
        
        if (futhark_mc_segmap_task_235654_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217955.mem + gtid_222814 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_222815 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
        if (defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_217959.mem + gtid_222814 * defunc_0_f_res_203631 *
                    (int64_t) 8, mem_222816 + (int64_t) 0,
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_222815);
    free(mem_222816);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235650_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235650_end -
                 futhark_mc_segmap_parloop_235650_start;
        
        ctx->futhark_mc_segmap_parloop_235650_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235650_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235650_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235648(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222813 = tid;
    int num_tasks_222868 = info.nsubtasks;
    struct futhark_mc_task_235642 *futhark_mc_task_235642 =
                                  (struct futhark_mc_task_235642 *) args;
    struct futhark_context *ctx = futhark_mc_task_235642->ctx;
    uint64_t futhark_mc_segmap_nested_task_235648_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235648_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235642->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235642->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235642->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235642->free_i_203670;
    int64_t gtid_207737 = futhark_mc_task_235642->free_gtid_207737;
    int64_t bytes_217345 = futhark_mc_task_235642->free_bytes_217345;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235642->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_235642->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_235642->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_235642->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_235642->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_task_235642->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_217955 = {.desc ="mem_217955", .mem =
                                  futhark_mc_task_235642->free_mem_217955,
                                  .size =0, .references =NULL};
    struct memblock mem_217959 = {.desc ="mem_217959", .mem =
                                  futhark_mc_task_235642->free_mem_217959,
                                  .size =0, .references =NULL};
    int64_t iter_222895;
    struct futhark_mc_segmap_parloop_struct_235649
    futhark_mc_segmap_parloop_struct_235649;
    
    futhark_mc_segmap_parloop_struct_235649.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235649.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235649.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235649.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235649.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235649.free_gtid_207737 = gtid_207737;
    futhark_mc_segmap_parloop_struct_235649.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235649.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235649.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_235649.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_235649.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_235649.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_235649.free_mem_217915 = mem_217915.mem;
    futhark_mc_segmap_parloop_struct_235649.free_mem_217955 = mem_217955.mem;
    futhark_mc_segmap_parloop_struct_235649.free_mem_217959 = mem_217959.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235650_task;
    
    futhark_mc_segmap_parloop_235650_task.name =
        "futhark_mc_segmap_parloop_235650";
    futhark_mc_segmap_parloop_235650_task.fn = futhark_mc_segmap_parloop_235650;
    futhark_mc_segmap_parloop_235650_task.args =
        &futhark_mc_segmap_parloop_struct_235649;
    futhark_mc_segmap_parloop_235650_task.iterations = iterations;
    futhark_mc_segmap_parloop_235650_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235650_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235650_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235650_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235650_task);
    
    if (futhark_mc_segmap_parloop_235650_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235650_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235650_total_end -
                 futhark_mc_segmap_parloop_235650_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235650_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235650_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235650_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235648_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235648_end -
                 futhark_mc_segmap_nested_task_235648_start;
        
        ctx->futhark_mc_segmap_nested_task_235648_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235648_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235648_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235639(void *args, int64_t start,
                                            int64_t end, int flat_tid_207736,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235638
    *futhark_mc_segmap_parloop_struct_235638 =
    (struct futhark_mc_segmap_parloop_struct_235638 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235638->ctx;
    uint64_t futhark_mc_segmap_parloop_235639_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235639_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_235638->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235638->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235638->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235638->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_235638->free_i_203670;
    int64_t bytes_217345 =
            futhark_mc_segmap_parloop_struct_235638->free_bytes_217345;
    int64_t bytes_217364 =
            futhark_mc_segmap_parloop_struct_235638->free_bytes_217364;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235638->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_235638->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_235638->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_235638->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_235638->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_segmap_parloop_struct_235638->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235638->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235638->free_mem_218057,
                                  .size =0, .references =NULL};
    size_t mem_217955_cached_sizze_235640 = 0;
    unsigned char *mem_217955 = NULL;
    size_t mem_217959_cached_sizze_235641 = 0;
    unsigned char *mem_217959 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222812 = start;
    
    if (mem_217955_cached_sizze_235640 < (size_t) bytes_217364) {
        mem_217955 = realloc(mem_217955, bytes_217364);
        mem_217955_cached_sizze_235640 = bytes_217364;
    }
    if (mem_217959_cached_sizze_235641 < (size_t) bytes_217364) {
        mem_217959 = realloc(mem_217959, bytes_217364);
        mem_217959_cached_sizze_235641 = bytes_217364;
    }
    for (; iter_222812 < end; iter_222812++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222866 = partition_sizze_203577;
        int64_t gtid_207737 = iter_222812;
        int64_t remnant_222867 = iter_222812 - gtid_207737;
        int64_t flat_tid_222837 = (int64_t) 0;
        int32_t num_tasks_222868;
        int64_t flat_tid_222813 = (int64_t) 0;
        struct futhark_mc_task_235642 futhark_mc_task_235642;
        
        futhark_mc_task_235642.ctx = ctx;
        futhark_mc_task_235642.free_n_203490 = n_203490;
        futhark_mc_task_235642.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235642.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235642.free_i_203670 = i_203670;
        futhark_mc_task_235642.free_gtid_207737 = gtid_207737;
        futhark_mc_task_235642.free_bytes_217345 = bytes_217345;
        futhark_mc_task_235642.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235642.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_235642.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_235642.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_235642.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_235642.free_mem_217915 = mem_217915.mem;
        futhark_mc_task_235642.free_mem_217955 = mem_217955;
        futhark_mc_task_235642.free_mem_217959 = mem_217959;
        
        struct scheduler_segop futhark_mc_task_235642_task;
        
        futhark_mc_task_235642_task.args = &futhark_mc_task_235642;
        futhark_mc_task_235642_task.top_level_fn =
            futhark_mc_segmap_task_235643;
        futhark_mc_task_235642_task.name = "futhark_mc_segmap_task_235643";
        futhark_mc_task_235642_task.iterations = n_p_203492;
        futhark_mc_task_235642_task.task_time =
            &ctx->futhark_mc_segmap_task_235643_total_time;
        futhark_mc_task_235642_task.task_iter =
            &ctx->futhark_mc_segmap_task_235643_total_iter;
        futhark_mc_task_235642_task.sched = STATIC;
        futhark_mc_task_235642_task.nested_fn =
            futhark_mc_segmap_nested_task_235648;
        
        int futhark_mc_segmap_task_235643_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235642_task);
        
        if (futhark_mc_segmap_task_235643_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_218052.mem + gtid_207737 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217955 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
        if (n_p_203492 * defunc_0_f_res_203631 * (int64_t) 8 > 0)
            memmove(mem_218057.mem + gtid_207737 * (defunc_0_f_res_203631 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_217959 + (int64_t) 0, n_p_203492 *
                    defunc_0_f_res_203631 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217955);
    free(mem_217959);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235639_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235639_end -
                 futhark_mc_segmap_parloop_235639_start;
        
        ctx->futhark_mc_segmap_parloop_235639_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235639_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235639_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235637(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207736 = tid;
    int num_tasks_222778 = info.nsubtasks;
    struct futhark_mc_task_235631 *futhark_mc_task_235631 =
                                  (struct futhark_mc_task_235631 *) args;
    struct futhark_context *ctx = futhark_mc_task_235631->ctx;
    uint64_t futhark_mc_segmap_nested_task_235637_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235637_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_235631->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_235631->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235631->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235631->free_defunc_0_f_res_203631;
    int64_t i_203670 = futhark_mc_task_235631->free_i_203670;
    int64_t bytes_217345 = futhark_mc_task_235631->free_bytes_217345;
    int64_t bytes_217364 = futhark_mc_task_235631->free_bytes_217364;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235631->free_mem_217536,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_235631->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_235631->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_235631->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_235631->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_217915 = {.desc ="mem_217915", .mem =
                                  futhark_mc_task_235631->free_mem_217915,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235631->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235631->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t iter_222812;
    struct futhark_mc_segmap_parloop_struct_235638
    futhark_mc_segmap_parloop_struct_235638;
    
    futhark_mc_segmap_parloop_struct_235638.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235638.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_235638.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235638.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235638.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235638.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_235638.free_bytes_217345 = bytes_217345;
    futhark_mc_segmap_parloop_struct_235638.free_bytes_217364 = bytes_217364;
    futhark_mc_segmap_parloop_struct_235638.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235638.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_235638.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_235638.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_235638.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_235638.free_mem_217915 = mem_217915.mem;
    futhark_mc_segmap_parloop_struct_235638.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235638.free_mem_218057 = mem_218057.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235639_task;
    
    futhark_mc_segmap_parloop_235639_task.name =
        "futhark_mc_segmap_parloop_235639";
    futhark_mc_segmap_parloop_235639_task.fn = futhark_mc_segmap_parloop_235639;
    futhark_mc_segmap_parloop_235639_task.args =
        &futhark_mc_segmap_parloop_struct_235638;
    futhark_mc_segmap_parloop_235639_task.iterations = iterations;
    futhark_mc_segmap_parloop_235639_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235639_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235639_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235639_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235639_task);
    
    if (futhark_mc_segmap_parloop_235639_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235639_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235639_total_end -
                 futhark_mc_segmap_parloop_235639_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235639_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235639_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235639_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235637_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235637_end -
                 futhark_mc_segmap_nested_task_235637_start;
        
        ctx->futhark_mc_segmap_nested_task_235637_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235637_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235637_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235657 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218133;
};
struct futhark_mc_segmap_parloop_struct_235659 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218133;
};
static int futhark_mc_segmap_parloop_235660(void *args, int64_t start,
                                            int64_t end, int flat_tid_207789,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235659
    *futhark_mc_segmap_parloop_struct_235659 =
    (struct futhark_mc_segmap_parloop_struct_235659 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235659->ctx;
    uint64_t futhark_mc_segmap_parloop_235660_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235660_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235659->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235659->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235659->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235659->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235659->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235659->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235659->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235659->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235659->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235659->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235659->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235659->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235659->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235659->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218133 = {.desc ="mem_218133", .mem =
                                  futhark_mc_segmap_parloop_struct_235659->free_mem_218133,
                                  .size =0, .references =NULL};
    size_t mem_218088_cached_sizze_235661 = 0;
    unsigned char *mem_218088 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222930 = start;
    
    if (mem_218088_cached_sizze_235661 < (size_t) bytes_217597) {
        mem_218088 = realloc(mem_218088, bytes_217597);
        mem_218088_cached_sizze_235661 = bytes_217597;
    }
    for (; iter_222930 < end; iter_222930++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223009 = partition_sizze_203577;
        int64_t gtid_207790 = iter_222930;
        int64_t remnant_223010 = iter_222930 - gtid_207790;
        
        for (int64_t i_222931 = 0; i_222931 < n_p_203492; i_222931++) {
            int64_t x_222933;
            
            x_222933 = ((int64_t *) mem_217540.mem)[gtid_207790 * n_p_203492 +
                                                    i_222931];
            for (int64_t i_222935 = 0; i_222935 < s_n_m_203636; i_222935++) {
                int64_t x_222937;
                
                x_222937 = ((int64_t *) mem_217710.mem)[gtid_207790 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        i_222931 *
                                                        s_n_m_203636 +
                                                        i_222935];
                
                double x_222938;
                
                x_222938 = ((double *) mem_217715.mem)[gtid_207790 *
                                                       (s_n_m_203636 *
                                                        n_p_203492) + i_222931 *
                                                       s_n_m_203636 + i_222935];
                
                bool cond_222939 = i_222935 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_222940;
                
                if (cond_222939) {
                    defunc_0_m_fun_res_222940 = (int64_t) 0;
                } else {
                    int64_t y_222941 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_222942 = i_222935 == y_222941;
                    int64_t defunc_0_m_fun_res_f_res_222943;
                    
                    if (cond_222942) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_222944 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_222943 =
                            defunc_0_m_fun_res_f_res_t_res_222944;
                    } else {
                        int64_t x_222945 = sub64(i_222935, (int64_t) 1);
                        int64_t x_222946 = mul64(jump_s_203499, x_222945);
                        int64_t min_arg_222947 = add64((int64_t) 1, x_222946);
                        int64_t min_res_222948 = smin64(defunc_0_f_res_203631,
                                                        min_arg_222947);
                        
                        defunc_0_m_fun_res_f_res_222943 = min_res_222948;
                    }
                    defunc_0_m_fun_res_222940 = defunc_0_m_fun_res_f_res_222943;
                }
                
                double defunc_2_reduce_res_222949;
                double redout_222951 = 0.0;
                
                for (int64_t i_222950 = 0; i_222950 < q_s_203493; i_222950++) {
                    bool cond_222952 = sle64(x_222933, i_222950);
                    int64_t defunc_0_f_res_222953;
                    
                    if (cond_222952) {
                        defunc_0_f_res_222953 = (int64_t) 0;
                    } else {
                        int64_t i_222954 = add64(x_222937, i_222950);
                        int64_t defunc_0_add_arg_222955;
                        
                        defunc_0_add_arg_222955 =
                            ((int64_t *) mem_217536.mem)[gtid_207790 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_222931 *
                                                         defunc_0_f_res_203631 +
                                                         i_222954];
                        
                        int64_t defunc_1_add_res_222956 = add64((int64_t) 1,
                                                                defunc_0_add_arg_222955);
                        
                        defunc_0_f_res_222953 = defunc_1_add_res_222956;
                    }
                    
                    double defunc_0_f_res_222957;
                    
                    if (cond_222952) {
                        defunc_0_f_res_222957 = 0.0;
                    } else {
                        int64_t i_222958 = add64(x_222937, i_222950);
                        double defunc_0_add_arg_222959;
                        
                        defunc_0_add_arg_222959 =
                            ((double *) mem_218057.mem)[gtid_207790 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_222931 *
                                                        defunc_0_f_res_203631 +
                                                        i_222958];
                        defunc_0_f_res_222957 = defunc_0_add_arg_222959;
                    }
                    
                    int64_t binop_p_222960 = sub64(defunc_0_f_res_222953,
                                                   defunc_0_m_fun_res_222940);
                    double defunc_0_f_res_222961 =
                           sitofp_i64_f64(binop_p_222960);
                    double abs_res_222962 = fabs(defunc_0_f_res_222961);
                    double tmp1_222963 = abs_res_222962 / x_222938;
                    double x_222964 = tmp1_222963 * tmp1_222963;
                    double y_222965 = tmp1_222963 * x_222964;
                    double tmp2_222966 = 1.0 - y_222965;
                    double x_222967 = tmp2_222966 * tmp2_222966;
                    double tmp3_222968 = tmp2_222966 * x_222967;
                    double w_j_222969 = defunc_0_f_res_222957 * tmp3_222968;
                    double defunc_1_op_res_222970 = w_j_222969 + redout_222951;
                    double redout_tmp_223013 = defunc_1_op_res_222970;
                    
                    redout_222951 = redout_tmp_223013;
                }
                defunc_2_reduce_res_222949 = redout_222951;
                
                double a0_222971 = 1.0 / defunc_2_reduce_res_222949;
                int64_t defunc_0_m_fun_res_222972;
                
                if (cond_222939) {
                    defunc_0_m_fun_res_222972 = (int64_t) 0;
                } else {
                    int64_t y_222973 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_222974 = i_222935 == y_222973;
                    int64_t defunc_0_m_fun_res_f_res_222975;
                    
                    if (cond_222974) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_222976 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_222975 =
                            defunc_0_m_fun_res_f_res_t_res_222976;
                    } else {
                        int64_t x_222977 = sub64(i_222935, (int64_t) 1);
                        int64_t x_222978 = mul64(jump_s_203499, x_222977);
                        int64_t min_arg_222979 = add64((int64_t) 1, x_222978);
                        int64_t min_res_222980 = smin64(defunc_0_f_res_203631,
                                                        min_arg_222979);
                        
                        defunc_0_m_fun_res_f_res_222975 = min_res_222980;
                    }
                    defunc_0_m_fun_res_222972 = defunc_0_m_fun_res_f_res_222975;
                }
                
                double defunc_2_reduce_res_222981;
                double redout_222983 = 0.0;
                
                for (int64_t i_222982 = 0; i_222982 < q_s_203493; i_222982++) {
                    bool cond_222984 = sle64(x_222933, i_222982);
                    int64_t defunc_0_f_res_222985;
                    
                    if (cond_222984) {
                        defunc_0_f_res_222985 = (int64_t) 0;
                    } else {
                        int64_t i_222986 = add64(x_222937, i_222982);
                        int64_t defunc_0_add_arg_222987;
                        
                        defunc_0_add_arg_222987 =
                            ((int64_t *) mem_217536.mem)[gtid_207790 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_222931 *
                                                         defunc_0_f_res_203631 +
                                                         i_222986];
                        
                        int64_t defunc_1_add_res_222988 = add64((int64_t) 1,
                                                                defunc_0_add_arg_222987);
                        
                        defunc_0_f_res_222985 = defunc_1_add_res_222988;
                    }
                    
                    double defunc_0_f_res_222989;
                    
                    if (cond_222984) {
                        defunc_0_f_res_222989 = 0.0;
                    } else {
                        int64_t i_222990 = add64(x_222937, i_222982);
                        double defunc_0_add_arg_222991;
                        
                        defunc_0_add_arg_222991 =
                            ((double *) mem_218057.mem)[gtid_207790 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_222931 *
                                                        defunc_0_f_res_203631 +
                                                        i_222990];
                        defunc_0_f_res_222989 = defunc_0_add_arg_222991;
                    }
                    
                    int64_t binop_p_222992 = sub64(defunc_0_f_res_222985,
                                                   defunc_0_m_fun_res_222972);
                    double defunc_0_f_res_222993 =
                           sitofp_i64_f64(binop_p_222992);
                    double abs_res_222994 = fabs(defunc_0_f_res_222993);
                    double tmp1_222995 = abs_res_222994 / x_222938;
                    double x_222996 = tmp1_222995 * tmp1_222995;
                    double y_222997 = tmp1_222995 * x_222996;
                    double tmp2_222998 = 1.0 - y_222997;
                    double x_222999 = tmp2_222998 * tmp2_222998;
                    double tmp3_223000 = tmp2_222998 * x_222999;
                    double tmp4_223001 = defunc_0_f_res_222989 * tmp3_223000;
                    double defunc_0_f_res_223002;
                    
                    if (cond_222984) {
                        defunc_0_f_res_223002 = 0.0;
                    } else {
                        int64_t i_223003 = add64(x_222937, i_222982);
                        double defunc_0_add_arg_223004;
                        
                        defunc_0_add_arg_223004 =
                            ((double *) mem_218052.mem)[gtid_207790 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_222931 *
                                                        defunc_0_f_res_203631 +
                                                        i_223003];
                        defunc_0_f_res_223002 = defunc_0_add_arg_223004;
                    }
                    
                    double x_223005 = a0_222971 * tmp4_223001;
                    double defunc_9_fit_fun_res_223006 = defunc_0_f_res_223002 *
                           x_223005;
                    double defunc_1_op_res_223007 =
                           defunc_9_fit_fun_res_223006 + redout_222983;
                    double redout_tmp_223014 = defunc_1_op_res_223007;
                    
                    redout_222983 = redout_tmp_223014;
                }
                defunc_2_reduce_res_222981 = redout_222983;
                ((double *) mem_218088)[i_222931 * s_n_m_203636 + i_222935] =
                    defunc_2_reduce_res_222981;
            }
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218133.mem + gtid_207790 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218088 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218088);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235660_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235660_end -
                 futhark_mc_segmap_parloop_235660_start;
        
        ctx->futhark_mc_segmap_parloop_235660_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235660_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235660_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235658(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207789 = tid;
    int num_tasks_222929 = info.nsubtasks;
    struct futhark_mc_task_235657 *futhark_mc_task_235657 =
                                  (struct futhark_mc_task_235657 *) args;
    struct futhark_context *ctx = futhark_mc_task_235657->ctx;
    uint64_t futhark_mc_segmap_task_235658_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235658_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235657->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235657->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235657->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235657->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235657->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235657->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235657->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235657->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235657->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235657->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235657->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235657->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235657->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235657->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235657->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218133 = {.desc ="mem_218133", .mem =
                                  futhark_mc_task_235657->free_mem_218133,
                                  .size =0, .references =NULL};
    int64_t iter_222930;
    struct futhark_mc_segmap_parloop_struct_235659
    futhark_mc_segmap_parloop_struct_235659;
    
    futhark_mc_segmap_parloop_struct_235659.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235659.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235659.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235659.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235659.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235659.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235659.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235659.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235659.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235659.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235659.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235659.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235659.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235659.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235659.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235659.free_mem_218133 = mem_218133.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235660_task;
    
    futhark_mc_segmap_parloop_235660_task.name =
        "futhark_mc_segmap_parloop_235660";
    futhark_mc_segmap_parloop_235660_task.fn = futhark_mc_segmap_parloop_235660;
    futhark_mc_segmap_parloop_235660_task.args =
        &futhark_mc_segmap_parloop_struct_235659;
    futhark_mc_segmap_parloop_235660_task.iterations = iterations;
    futhark_mc_segmap_parloop_235660_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235660_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235660_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235660_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235660_task);
    
    if (futhark_mc_segmap_parloop_235660_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235660_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235660_total_end -
                 futhark_mc_segmap_parloop_235660_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235660_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235660_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235660_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235658_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235658_end -
                 futhark_mc_segmap_task_235658_start;
        
        ctx->futhark_mc_segmap_task_235658_runs[tid]++;
        ctx->futhark_mc_segmap_task_235658_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235658_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235663 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218133;
};
struct futhark_mc_task_235666 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218084;
};
struct futhark_mc_segmap_parloop_struct_235668 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218084;
};
static int futhark_mc_segmap_parloop_235669(void *args, int64_t start,
                                            int64_t end, int flat_tid_223171,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235668
    *futhark_mc_segmap_parloop_struct_235668 =
    (struct futhark_mc_segmap_parloop_struct_235668 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235668->ctx;
    uint64_t futhark_mc_segmap_parloop_235669_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235669_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235668->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235668->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235668->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235668->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235668->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235668->free_s_n_m_203636;
    int64_t gtid_208051 =
            futhark_mc_segmap_parloop_struct_235668->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235668->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235668->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235668->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235668->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235668->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235668->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235668->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218084 = {.desc ="mem_218084", .mem =
                                  futhark_mc_segmap_parloop_struct_235668->free_mem_218084,
                                  .size =0, .references =NULL};
    size_t mem_223174_cached_sizze_235670 = 0;
    unsigned char *mem_223174 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223254 = start;
    
    if (mem_223174_cached_sizze_235670 < (size_t) bytes_217545) {
        mem_223174 = realloc(mem_223174, bytes_217545);
        mem_223174_cached_sizze_235670 = bytes_217545;
    }
    for (; iter_223254 < end; iter_223254++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223329 = n_p_203492;
        int64_t gtid_223172 = iter_223254;
        int64_t remnant_223330 = iter_223254 - gtid_223172;
        int64_t x_223173;
        
        x_223173 = ((int64_t *) mem_217540.mem)[gtid_208051 * n_p_203492 +
                                                gtid_223172];
        for (int64_t i_223255 = 0; i_223255 < s_n_m_203636; i_223255++) {
            int64_t x_223257;
            
            x_223257 = ((int64_t *) mem_217710.mem)[gtid_208051 *
                                                    (s_n_m_203636 *
                                                     n_p_203492) + gtid_223172 *
                                                    s_n_m_203636 + i_223255];
            
            double x_223258;
            
            x_223258 = ((double *) mem_217715.mem)[gtid_208051 * (s_n_m_203636 *
                                                                  n_p_203492) +
                                                   gtid_223172 * s_n_m_203636 +
                                                   i_223255];
            
            bool cond_223259 = i_223255 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_223260;
            
            if (cond_223259) {
                defunc_0_m_fun_res_223260 = (int64_t) 0;
            } else {
                int64_t y_223261 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_223262 = i_223255 == y_223261;
                int64_t defunc_0_m_fun_res_f_res_223263;
                
                if (cond_223262) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_223264 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_223263 =
                        defunc_0_m_fun_res_f_res_t_res_223264;
                } else {
                    int64_t x_223265 = sub64(i_223255, (int64_t) 1);
                    int64_t x_223266 = mul64(jump_s_203499, x_223265);
                    int64_t min_arg_223267 = add64((int64_t) 1, x_223266);
                    int64_t min_res_223268 = smin64(defunc_0_f_res_203631,
                                                    min_arg_223267);
                    
                    defunc_0_m_fun_res_f_res_223263 = min_res_223268;
                }
                defunc_0_m_fun_res_223260 = defunc_0_m_fun_res_f_res_223263;
            }
            
            double defunc_2_reduce_res_223269;
            double redout_223271 = 0.0;
            
            for (int64_t i_223270 = 0; i_223270 < q_s_203493; i_223270++) {
                bool cond_223272 = sle64(x_223173, i_223270);
                int64_t defunc_0_f_res_223273;
                
                if (cond_223272) {
                    defunc_0_f_res_223273 = (int64_t) 0;
                } else {
                    int64_t i_223274 = add64(x_223257, i_223270);
                    int64_t defunc_0_add_arg_223275;
                    
                    defunc_0_add_arg_223275 =
                        ((int64_t *) mem_217536.mem)[gtid_208051 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_223172 *
                                                     defunc_0_f_res_203631 +
                                                     i_223274];
                    
                    int64_t defunc_1_add_res_223276 = add64((int64_t) 1,
                                                            defunc_0_add_arg_223275);
                    
                    defunc_0_f_res_223273 = defunc_1_add_res_223276;
                }
                
                double defunc_0_f_res_223277;
                
                if (cond_223272) {
                    defunc_0_f_res_223277 = 0.0;
                } else {
                    int64_t i_223278 = add64(x_223257, i_223270);
                    double defunc_0_add_arg_223279;
                    
                    defunc_0_add_arg_223279 =
                        ((double *) mem_218057.mem)[gtid_208051 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_223172 *
                                                    defunc_0_f_res_203631 +
                                                    i_223278];
                    defunc_0_f_res_223277 = defunc_0_add_arg_223279;
                }
                
                int64_t binop_p_223280 = sub64(defunc_0_f_res_223273,
                                               defunc_0_m_fun_res_223260);
                double defunc_0_f_res_223281 = sitofp_i64_f64(binop_p_223280);
                double abs_res_223282 = fabs(defunc_0_f_res_223281);
                double tmp1_223283 = abs_res_223282 / x_223258;
                double x_223284 = tmp1_223283 * tmp1_223283;
                double y_223285 = tmp1_223283 * x_223284;
                double tmp2_223286 = 1.0 - y_223285;
                double x_223287 = tmp2_223286 * tmp2_223286;
                double tmp3_223288 = tmp2_223286 * x_223287;
                double w_j_223289 = defunc_0_f_res_223277 * tmp3_223288;
                double defunc_1_op_res_223290 = w_j_223289 + redout_223271;
                double redout_tmp_223332 = defunc_1_op_res_223290;
                
                redout_223271 = redout_tmp_223332;
            }
            defunc_2_reduce_res_223269 = redout_223271;
            
            double a0_223291 = 1.0 / defunc_2_reduce_res_223269;
            int64_t defunc_0_m_fun_res_223292;
            
            if (cond_223259) {
                defunc_0_m_fun_res_223292 = (int64_t) 0;
            } else {
                int64_t y_223293 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_223294 = i_223255 == y_223293;
                int64_t defunc_0_m_fun_res_f_res_223295;
                
                if (cond_223294) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_223296 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_223295 =
                        defunc_0_m_fun_res_f_res_t_res_223296;
                } else {
                    int64_t x_223297 = sub64(i_223255, (int64_t) 1);
                    int64_t x_223298 = mul64(jump_s_203499, x_223297);
                    int64_t min_arg_223299 = add64((int64_t) 1, x_223298);
                    int64_t min_res_223300 = smin64(defunc_0_f_res_203631,
                                                    min_arg_223299);
                    
                    defunc_0_m_fun_res_f_res_223295 = min_res_223300;
                }
                defunc_0_m_fun_res_223292 = defunc_0_m_fun_res_f_res_223295;
            }
            
            double defunc_2_reduce_res_223301;
            double redout_223303 = 0.0;
            
            for (int64_t i_223302 = 0; i_223302 < q_s_203493; i_223302++) {
                bool cond_223304 = sle64(x_223173, i_223302);
                int64_t defunc_0_f_res_223305;
                
                if (cond_223304) {
                    defunc_0_f_res_223305 = (int64_t) 0;
                } else {
                    int64_t i_223306 = add64(x_223257, i_223302);
                    int64_t defunc_0_add_arg_223307;
                    
                    defunc_0_add_arg_223307 =
                        ((int64_t *) mem_217536.mem)[gtid_208051 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_223172 *
                                                     defunc_0_f_res_203631 +
                                                     i_223306];
                    
                    int64_t defunc_1_add_res_223308 = add64((int64_t) 1,
                                                            defunc_0_add_arg_223307);
                    
                    defunc_0_f_res_223305 = defunc_1_add_res_223308;
                }
                
                double defunc_0_f_res_223309;
                
                if (cond_223304) {
                    defunc_0_f_res_223309 = 0.0;
                } else {
                    int64_t i_223310 = add64(x_223257, i_223302);
                    double defunc_0_add_arg_223311;
                    
                    defunc_0_add_arg_223311 =
                        ((double *) mem_218057.mem)[gtid_208051 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_223172 *
                                                    defunc_0_f_res_203631 +
                                                    i_223310];
                    defunc_0_f_res_223309 = defunc_0_add_arg_223311;
                }
                
                int64_t binop_p_223312 = sub64(defunc_0_f_res_223305,
                                               defunc_0_m_fun_res_223292);
                double defunc_0_f_res_223313 = sitofp_i64_f64(binop_p_223312);
                double abs_res_223314 = fabs(defunc_0_f_res_223313);
                double tmp1_223315 = abs_res_223314 / x_223258;
                double x_223316 = tmp1_223315 * tmp1_223315;
                double y_223317 = tmp1_223315 * x_223316;
                double tmp2_223318 = 1.0 - y_223317;
                double x_223319 = tmp2_223318 * tmp2_223318;
                double tmp3_223320 = tmp2_223318 * x_223319;
                double tmp4_223321 = defunc_0_f_res_223309 * tmp3_223320;
                double defunc_0_f_res_223322;
                
                if (cond_223304) {
                    defunc_0_f_res_223322 = 0.0;
                } else {
                    int64_t i_223323 = add64(x_223257, i_223302);
                    double defunc_0_add_arg_223324;
                    
                    defunc_0_add_arg_223324 =
                        ((double *) mem_218052.mem)[gtid_208051 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_223172 *
                                                    defunc_0_f_res_203631 +
                                                    i_223323];
                    defunc_0_f_res_223322 = defunc_0_add_arg_223324;
                }
                
                double x_223325 = a0_223291 * tmp4_223321;
                double defunc_9_fit_fun_res_223326 = defunc_0_f_res_223322 *
                       x_223325;
                double defunc_1_op_res_223327 = defunc_9_fit_fun_res_223326 +
                       redout_223303;
                double redout_tmp_223333 = defunc_1_op_res_223327;
                
                redout_223303 = redout_tmp_223333;
            }
            defunc_2_reduce_res_223301 = redout_223303;
            ((double *) mem_223174)[i_223255] = defunc_2_reduce_res_223301;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218084.mem + gtid_223172 * s_n_m_203636 * (int64_t) 8,
                    mem_223174 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223174);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235669_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235669_end -
                 futhark_mc_segmap_parloop_235669_start;
        
        ctx->futhark_mc_segmap_parloop_235669_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235669_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235669_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235667(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223171 = tid;
    int num_tasks_223253 = info.nsubtasks;
    struct futhark_mc_task_235666 *futhark_mc_task_235666 =
                                  (struct futhark_mc_task_235666 *) args;
    struct futhark_context *ctx = futhark_mc_task_235666->ctx;
    uint64_t futhark_mc_segmap_task_235667_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235667_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235666->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235666->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235666->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235666->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235666->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235666->free_s_n_m_203636;
    int64_t gtid_208051 = futhark_mc_task_235666->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235666->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235666->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235666->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235666->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235666->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235666->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235666->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218084 = {.desc ="mem_218084", .mem =
                                  futhark_mc_task_235666->free_mem_218084,
                                  .size =0, .references =NULL};
    int64_t iter_223254;
    struct futhark_mc_segmap_parloop_struct_235668
    futhark_mc_segmap_parloop_struct_235668;
    
    futhark_mc_segmap_parloop_struct_235668.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235668.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235668.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235668.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235668.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235668.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235668.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235668.free_gtid_208051 = gtid_208051;
    futhark_mc_segmap_parloop_struct_235668.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235668.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235668.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235668.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235668.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235668.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235668.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235668.free_mem_218084 = mem_218084.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235669_task;
    
    futhark_mc_segmap_parloop_235669_task.name =
        "futhark_mc_segmap_parloop_235669";
    futhark_mc_segmap_parloop_235669_task.fn = futhark_mc_segmap_parloop_235669;
    futhark_mc_segmap_parloop_235669_task.args =
        &futhark_mc_segmap_parloop_struct_235668;
    futhark_mc_segmap_parloop_235669_task.iterations = iterations;
    futhark_mc_segmap_parloop_235669_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235669_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235669_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235669_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235669_task);
    
    if (futhark_mc_segmap_parloop_235669_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235669_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235669_total_end -
                 futhark_mc_segmap_parloop_235669_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235669_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235669_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235669_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235667_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235667_end -
                 futhark_mc_segmap_task_235667_start;
        
        ctx->futhark_mc_segmap_task_235667_runs[tid]++;
        ctx->futhark_mc_segmap_task_235667_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235667_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235672 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218084;
};
struct futhark_mc_task_235675 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223017;
    int64_t free_x_223018;
    unsigned char *free_mem_223019;
};
struct futhark_mc_segmap_parloop_struct_235677 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223017;
    int64_t free_x_223018;
    unsigned char *free_mem_223019;
};
static int futhark_mc_segmap_parloop_235678(void *args, int64_t start,
                                            int64_t end, int flat_tid_223412,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235677
    *futhark_mc_segmap_parloop_struct_235677 =
    (struct futhark_mc_segmap_parloop_struct_235677 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235677->ctx;
    uint64_t futhark_mc_segmap_parloop_235678_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235678_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235677->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235677->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235677->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235677->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235677->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235677->free_s_n_m_203636;
    int64_t gtid_208051 =
            futhark_mc_segmap_parloop_struct_235677->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235677->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235677->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235677->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235677->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235677->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 =
            futhark_mc_segmap_parloop_struct_235677->free_gtid_223017;
    int64_t x_223018 = futhark_mc_segmap_parloop_struct_235677->free_x_223018;
    struct memblock mem_223019 = {.desc ="mem_223019", .mem =
                                  futhark_mc_segmap_parloop_struct_235677->free_mem_223019,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223488 = start;
    
    for (; iter_223488 < end; iter_223488++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223552 = s_n_m_203636;
        int64_t gtid_223413 = iter_223488;
        int64_t remnant_223553 = iter_223488 - gtid_223413;
        int64_t x_223414;
        
        x_223414 = ((int64_t *) mem_217710.mem)[gtid_208051 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_223017 * s_n_m_203636 +
                                                gtid_223413];
        
        double x_223415;
        
        x_223415 = ((double *) mem_217715.mem)[gtid_208051 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_223017 * s_n_m_203636 +
                                               gtid_223413];
        
        bool cond_223416 = gtid_223413 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_223417;
        
        if (cond_223416) {
            defunc_0_m_fun_res_223417 = (int64_t) 0;
        } else {
            int64_t y_223489 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_223490 = gtid_223413 == y_223489;
            int64_t defunc_0_m_fun_res_f_res_223491;
            
            if (cond_223490) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223492 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223491 =
                    defunc_0_m_fun_res_f_res_t_res_223492;
            } else {
                int64_t x_223493 = sub64(gtid_223413, (int64_t) 1);
                int64_t x_223494 = mul64(jump_s_203499, x_223493);
                int64_t min_arg_223495 = add64((int64_t) 1, x_223494);
                int64_t min_res_223496 = smin64(defunc_0_f_res_203631,
                                                min_arg_223495);
                
                defunc_0_m_fun_res_f_res_223491 = min_res_223496;
            }
            defunc_0_m_fun_res_223417 = defunc_0_m_fun_res_f_res_223491;
        }
        
        double defunc_2_reduce_res_223426;
        double redout_223498 = 0.0;
        
        for (int64_t i_223497 = 0; i_223497 < q_s_203493; i_223497++) {
            bool cond_223499 = sle64(x_223018, i_223497);
            int64_t defunc_0_f_res_223500;
            
            if (cond_223499) {
                defunc_0_f_res_223500 = (int64_t) 0;
            } else {
                int64_t i_223501 = add64(x_223414, i_223497);
                int64_t defunc_0_add_arg_223502;
                
                defunc_0_add_arg_223502 =
                    ((int64_t *) mem_217536.mem)[gtid_208051 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_223017 *
                                                 defunc_0_f_res_203631 +
                                                 i_223501];
                
                int64_t defunc_1_add_res_223503 = add64((int64_t) 1,
                                                        defunc_0_add_arg_223502);
                
                defunc_0_f_res_223500 = defunc_1_add_res_223503;
            }
            
            double defunc_0_f_res_223504;
            
            if (cond_223499) {
                defunc_0_f_res_223504 = 0.0;
            } else {
                int64_t i_223505 = add64(x_223414, i_223497);
                double defunc_0_add_arg_223506;
                
                defunc_0_add_arg_223506 =
                    ((double *) mem_218057.mem)[gtid_208051 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_223017 *
                                                defunc_0_f_res_203631 +
                                                i_223505];
                defunc_0_f_res_223504 = defunc_0_add_arg_223506;
            }
            
            int64_t binop_p_223507 = sub64(defunc_0_f_res_223500,
                                           defunc_0_m_fun_res_223417);
            double defunc_0_f_res_223508 = sitofp_i64_f64(binop_p_223507);
            double abs_res_223509 = fabs(defunc_0_f_res_223508);
            double tmp1_223510 = abs_res_223509 / x_223415;
            double x_223511 = tmp1_223510 * tmp1_223510;
            double y_223512 = tmp1_223510 * x_223511;
            double tmp2_223513 = 1.0 - y_223512;
            double x_223514 = tmp2_223513 * tmp2_223513;
            double tmp3_223515 = tmp2_223513 * x_223514;
            double w_j_223516 = defunc_0_f_res_223504 * tmp3_223515;
            double defunc_1_op_res_223517 = w_j_223516 + redout_223498;
            double redout_tmp_223554 = defunc_1_op_res_223517;
            
            redout_223498 = redout_tmp_223554;
        }
        defunc_2_reduce_res_223426 = redout_223498;
        
        double a0_223448 = 1.0 / defunc_2_reduce_res_223426;
        int64_t defunc_0_m_fun_res_223449;
        
        if (cond_223416) {
            defunc_0_m_fun_res_223449 = (int64_t) 0;
        } else {
            int64_t y_223518 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_223519 = gtid_223413 == y_223518;
            int64_t defunc_0_m_fun_res_f_res_223520;
            
            if (cond_223519) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223521 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223520 =
                    defunc_0_m_fun_res_f_res_t_res_223521;
            } else {
                int64_t x_223522 = sub64(gtid_223413, (int64_t) 1);
                int64_t x_223523 = mul64(jump_s_203499, x_223522);
                int64_t min_arg_223524 = add64((int64_t) 1, x_223523);
                int64_t min_res_223525 = smin64(defunc_0_f_res_203631,
                                                min_arg_223524);
                
                defunc_0_m_fun_res_f_res_223520 = min_res_223525;
            }
            defunc_0_m_fun_res_223449 = defunc_0_m_fun_res_f_res_223520;
        }
        
        double defunc_2_reduce_res_223458;
        double redout_223527 = 0.0;
        
        for (int64_t i_223526 = 0; i_223526 < q_s_203493; i_223526++) {
            bool cond_223528 = sle64(x_223018, i_223526);
            int64_t defunc_0_f_res_223529;
            
            if (cond_223528) {
                defunc_0_f_res_223529 = (int64_t) 0;
            } else {
                int64_t i_223530 = add64(x_223414, i_223526);
                int64_t defunc_0_add_arg_223531;
                
                defunc_0_add_arg_223531 =
                    ((int64_t *) mem_217536.mem)[gtid_208051 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_223017 *
                                                 defunc_0_f_res_203631 +
                                                 i_223530];
                
                int64_t defunc_1_add_res_223532 = add64((int64_t) 1,
                                                        defunc_0_add_arg_223531);
                
                defunc_0_f_res_223529 = defunc_1_add_res_223532;
            }
            
            double defunc_0_f_res_223533;
            
            if (cond_223528) {
                defunc_0_f_res_223533 = 0.0;
            } else {
                int64_t i_223534 = add64(x_223414, i_223526);
                double defunc_0_add_arg_223535;
                
                defunc_0_add_arg_223535 =
                    ((double *) mem_218057.mem)[gtid_208051 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_223017 *
                                                defunc_0_f_res_203631 +
                                                i_223534];
                defunc_0_f_res_223533 = defunc_0_add_arg_223535;
            }
            
            int64_t binop_p_223536 = sub64(defunc_0_f_res_223529,
                                           defunc_0_m_fun_res_223449);
            double defunc_0_f_res_223537 = sitofp_i64_f64(binop_p_223536);
            double abs_res_223538 = fabs(defunc_0_f_res_223537);
            double tmp1_223539 = abs_res_223538 / x_223415;
            double x_223540 = tmp1_223539 * tmp1_223539;
            double y_223541 = tmp1_223539 * x_223540;
            double tmp2_223542 = 1.0 - y_223541;
            double x_223543 = tmp2_223542 * tmp2_223542;
            double tmp3_223544 = tmp2_223542 * x_223543;
            double tmp4_223545 = defunc_0_f_res_223533 * tmp3_223544;
            double defunc_0_f_res_223546;
            
            if (cond_223528) {
                defunc_0_f_res_223546 = 0.0;
            } else {
                int64_t i_223547 = add64(x_223414, i_223526);
                double defunc_0_add_arg_223548;
                
                defunc_0_add_arg_223548 =
                    ((double *) mem_218052.mem)[gtid_208051 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_223017 *
                                                defunc_0_f_res_203631 +
                                                i_223547];
                defunc_0_f_res_223546 = defunc_0_add_arg_223548;
            }
            
            double x_223549 = a0_223448 * tmp4_223545;
            double defunc_9_fit_fun_res_223550 = defunc_0_f_res_223546 *
                   x_223549;
            double defunc_1_op_res_223551 = defunc_9_fit_fun_res_223550 +
                   redout_223527;
            double redout_tmp_223555 = defunc_1_op_res_223551;
            
            redout_223527 = redout_tmp_223555;
        }
        defunc_2_reduce_res_223458 = redout_223527;
        ((double *) mem_223019.mem)[gtid_223413] = defunc_2_reduce_res_223458;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235678_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235678_end -
                 futhark_mc_segmap_parloop_235678_start;
        
        ctx->futhark_mc_segmap_parloop_235678_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235678_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235678_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235676(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223412 = tid;
    int num_tasks_223487 = info.nsubtasks;
    struct futhark_mc_task_235675 *futhark_mc_task_235675 =
                                  (struct futhark_mc_task_235675 *) args;
    struct futhark_context *ctx = futhark_mc_task_235675->ctx;
    uint64_t futhark_mc_segmap_task_235676_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235676_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235675->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235675->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235675->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235675->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235675->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235675->free_s_n_m_203636;
    int64_t gtid_208051 = futhark_mc_task_235675->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235675->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235675->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235675->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235675->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235675->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 = futhark_mc_task_235675->free_gtid_223017;
    int64_t x_223018 = futhark_mc_task_235675->free_x_223018;
    struct memblock mem_223019 = {.desc ="mem_223019", .mem =
                                  futhark_mc_task_235675->free_mem_223019,
                                  .size =0, .references =NULL};
    int64_t iter_223488;
    struct futhark_mc_segmap_parloop_struct_235677
    futhark_mc_segmap_parloop_struct_235677;
    
    futhark_mc_segmap_parloop_struct_235677.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235677.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235677.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235677.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235677.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235677.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235677.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235677.free_gtid_208051 = gtid_208051;
    futhark_mc_segmap_parloop_struct_235677.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235677.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235677.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235677.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235677.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235677.free_gtid_223017 = gtid_223017;
    futhark_mc_segmap_parloop_struct_235677.free_x_223018 = x_223018;
    futhark_mc_segmap_parloop_struct_235677.free_mem_223019 = mem_223019.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235678_task;
    
    futhark_mc_segmap_parloop_235678_task.name =
        "futhark_mc_segmap_parloop_235678";
    futhark_mc_segmap_parloop_235678_task.fn = futhark_mc_segmap_parloop_235678;
    futhark_mc_segmap_parloop_235678_task.args =
        &futhark_mc_segmap_parloop_struct_235677;
    futhark_mc_segmap_parloop_235678_task.iterations = iterations;
    futhark_mc_segmap_parloop_235678_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235678_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235678_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235678_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235678_task);
    
    if (futhark_mc_segmap_parloop_235678_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235678_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235678_total_end -
                 futhark_mc_segmap_parloop_235678_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235678_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235678_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235678_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235676_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235676_end -
                 futhark_mc_segmap_task_235676_start;
        
        ctx->futhark_mc_segmap_task_235676_runs[tid]++;
        ctx->futhark_mc_segmap_task_235676_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235676_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235680 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223017;
    int64_t free_x_223018;
    unsigned char *free_mem_223019;
};
struct futhark_mc_task_235682 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223017;
    int64_t free_x_223018;
    int64_t free_x_223337;
    double free_x_223338;
    int64_t free_defunc_0_m_fun_res_223340;
    double *retval_defunc_2_reduce_res_223349;
};
struct futhark_mc_segred_stage_1_parloop_struct_235685 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223017;
    int64_t free_x_223018;
    int64_t free_x_223337;
    double free_x_223338;
    int64_t free_defunc_0_m_fun_res_223340;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_223627;
};
static int futhark_mc_segred_stage_1_parloop_235686(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_223565,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235685
    *futhark_mc_segred_stage_1_parloop_struct_235685 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235685 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235685->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235686_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235686_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235685->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235685->free_defunc_0_f_res_203631;
    int64_t gtid_208051 =
            futhark_mc_segred_stage_1_parloop_struct_235685->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235685->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235685->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 =
            futhark_mc_segred_stage_1_parloop_struct_235685->free_gtid_223017;
    int64_t x_223018 =
            futhark_mc_segred_stage_1_parloop_struct_235685->free_x_223018;
    int64_t x_223337 =
            futhark_mc_segred_stage_1_parloop_struct_235685->free_x_223337;
    double x_223338 =
           futhark_mc_segred_stage_1_parloop_struct_235685->free_x_223338;
    int64_t defunc_0_m_fun_res_223340 =
            futhark_mc_segred_stage_1_parloop_struct_235685->free_defunc_0_m_fun_res_223340;
    struct memblock reduce_stage_1_tid_res_arr_mem_223627 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_223627",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235685->free_reduce_stage_1_tid_res_arr_mem_223627,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223629 = start;
    double x_223567;
    double x_223568;
    double local_acc_223630 = 0.0;
    
    for (; iter_223629 < end; iter_223629++) {
        int64_t gtid_223566 = iter_223629;
        bool cond_223570 = sle64(x_223018, gtid_223566);
        int64_t defunc_0_f_res_223571;
        
        if (cond_223570) {
            defunc_0_f_res_223571 = (int64_t) 0;
        } else {
            int64_t i_223572 = add64(x_223337, gtid_223566);
            int64_t defunc_0_add_arg_223573;
            
            defunc_0_add_arg_223573 = ((int64_t *) mem_217536.mem)[gtid_208051 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_223017 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_223572];
            
            int64_t defunc_1_add_res_223574 = add64((int64_t) 1,
                                                    defunc_0_add_arg_223573);
            
            defunc_0_f_res_223571 = defunc_1_add_res_223574;
        }
        
        double defunc_0_f_res_223575;
        
        if (cond_223570) {
            defunc_0_f_res_223575 = 0.0;
        } else {
            int64_t i_223576 = add64(x_223337, gtid_223566);
            double defunc_0_add_arg_223577;
            
            defunc_0_add_arg_223577 = ((double *) mem_218057.mem)[gtid_208051 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_223017 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_223576];
            defunc_0_f_res_223575 = defunc_0_add_arg_223577;
        }
        
        int64_t binop_p_223578 = sub64(defunc_0_f_res_223571,
                                       defunc_0_m_fun_res_223340);
        double defunc_0_f_res_223579 = sitofp_i64_f64(binop_p_223578);
        double abs_res_223580 = fabs(defunc_0_f_res_223579);
        double tmp1_223581 = abs_res_223580 / x_223338;
        double x_223582 = tmp1_223581 * tmp1_223581;
        double y_223583 = tmp1_223581 * x_223582;
        double tmp2_223584 = 1.0 - y_223583;
        double x_223585 = tmp2_223584 * tmp2_223584;
        double tmp3_223586 = tmp2_223584 * x_223585;
        double w_j_223587 = defunc_0_f_res_223575 * tmp3_223586;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_223567 = local_acc_223630;
        }
        // Load next params
        {
            x_223568 = w_j_223587;
        }
        // Red body
        {
            double defunc_1_op_res_223569 = x_223567 + x_223568;
            
            local_acc_223630 = defunc_1_op_res_223569;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_223627.mem)[flat_tid_223565] =
        local_acc_223630;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235686_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235686_end -
                 futhark_mc_segred_stage_1_parloop_235686_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235686_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235686_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235686_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235683(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223565 = tid;
    int num_tasks_223626 = info.nsubtasks;
    struct futhark_mc_task_235682 *futhark_mc_task_235682 =
                                  (struct futhark_mc_task_235682 *) args;
    struct futhark_context *ctx = futhark_mc_task_235682->ctx;
    uint64_t futhark_mc_segred_task_235683_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235683_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235682->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235682->free_defunc_0_f_res_203631;
    int64_t gtid_208051 = futhark_mc_task_235682->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235682->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235682->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 = futhark_mc_task_235682->free_gtid_223017;
    int64_t x_223018 = futhark_mc_task_235682->free_x_223018;
    int64_t x_223337 = futhark_mc_task_235682->free_x_223337;
    double x_223338 = futhark_mc_task_235682->free_x_223338;
    int64_t defunc_0_m_fun_res_223340 =
            futhark_mc_task_235682->free_defunc_0_m_fun_res_223340;
    double defunc_2_reduce_res_223349 =
           *futhark_mc_task_235682->retval_defunc_2_reduce_res_223349;
    size_t reduce_stage_1_tid_res_arr_mem_223627_cached_sizze_235684 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_223627 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_223627_cached_sizze_235684 <
        (size_t) ((int64_t) 8 * num_tasks_223626)) {
        reduce_stage_1_tid_res_arr_mem_223627 =
            realloc(reduce_stage_1_tid_res_arr_mem_223627, (int64_t) 8 *
                    num_tasks_223626);
        reduce_stage_1_tid_res_arr_mem_223627_cached_sizze_235684 =
            (int64_t) 8 * num_tasks_223626;
    }
    
    int64_t iter_223629;
    struct futhark_mc_segred_stage_1_parloop_struct_235685
    futhark_mc_segred_stage_1_parloop_struct_235685;
    
    futhark_mc_segred_stage_1_parloop_struct_235685.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_gtid_208051 =
        gtid_208051;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_gtid_223017 =
        gtid_223017;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_x_223018 = x_223018;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_x_223337 = x_223337;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_x_223338 = x_223338;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_defunc_0_m_fun_res_223340 =
        defunc_0_m_fun_res_223340;
    futhark_mc_segred_stage_1_parloop_struct_235685.free_reduce_stage_1_tid_res_arr_mem_223627 =
        reduce_stage_1_tid_res_arr_mem_223627;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235686_task;
    
    futhark_mc_segred_stage_1_parloop_235686_task.name =
        "futhark_mc_segred_stage_1_parloop_235686";
    futhark_mc_segred_stage_1_parloop_235686_task.fn =
        futhark_mc_segred_stage_1_parloop_235686;
    futhark_mc_segred_stage_1_parloop_235686_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235685;
    futhark_mc_segred_stage_1_parloop_235686_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235686_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235686_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235686_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235686_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235686_task);
    
    if (futhark_mc_segred_stage_1_parloop_235686_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235686_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235686_total_end -
                 futhark_mc_segred_stage_1_parloop_235686_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235686_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235686_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235686_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_223349 = 0.0;
    }
    
    double x_223631;
    double x_223632;
    
    for (int32_t i_223634 = 0; i_223634 < num_tasks_223626; i_223634++) {
        flat_tid_223565 = i_223634;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_223631 = defunc_2_reduce_res_223349;
            }
            // load next params
            {
                x_223632 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_223627)[flat_tid_223565];
            }
            // red body
            {
                double defunc_1_op_res_223633 = x_223631 + x_223632;
                
                defunc_2_reduce_res_223349 = defunc_1_op_res_223633;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_223627);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235683_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235683_end -
                 futhark_mc_segred_task_235683_start;
        
        ctx->futhark_mc_segred_task_235683_runs[tid]++;
        ctx->futhark_mc_segred_task_235683_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235683_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235682->retval_defunc_2_reduce_res_223349 =
            defunc_2_reduce_res_223349;
    }
    return err;
}
struct futhark_mc_task_235687 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223017;
    int64_t free_x_223018;
    int64_t free_x_223337;
    double free_x_223338;
    double free_a0_223373;
    int64_t free_defunc_0_m_fun_res_223374;
    double *retval_defunc_2_reduce_res_223383;
};
struct futhark_mc_segred_stage_1_parloop_struct_235690 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208051;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223017;
    int64_t free_x_223018;
    int64_t free_x_223337;
    double free_x_223338;
    double free_a0_223373;
    int64_t free_defunc_0_m_fun_res_223374;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_223636;
};
static int futhark_mc_segred_stage_1_parloop_235691(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_223596,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235690
    *futhark_mc_segred_stage_1_parloop_struct_235690 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235690 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235690->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235691_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235691_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235690->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235690->free_defunc_0_f_res_203631;
    int64_t gtid_208051 =
            futhark_mc_segred_stage_1_parloop_struct_235690->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235690->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235690->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235690->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 =
            futhark_mc_segred_stage_1_parloop_struct_235690->free_gtid_223017;
    int64_t x_223018 =
            futhark_mc_segred_stage_1_parloop_struct_235690->free_x_223018;
    int64_t x_223337 =
            futhark_mc_segred_stage_1_parloop_struct_235690->free_x_223337;
    double x_223338 =
           futhark_mc_segred_stage_1_parloop_struct_235690->free_x_223338;
    double a0_223373 =
           futhark_mc_segred_stage_1_parloop_struct_235690->free_a0_223373;
    int64_t defunc_0_m_fun_res_223374 =
            futhark_mc_segred_stage_1_parloop_struct_235690->free_defunc_0_m_fun_res_223374;
    struct memblock reduce_stage_1_tid_res_arr_mem_223636 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_223636",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235690->free_reduce_stage_1_tid_res_arr_mem_223636,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223638 = start;
    double x_223598;
    double x_223599;
    double local_acc_223639 = 0.0;
    
    for (; iter_223638 < end; iter_223638++) {
        int64_t gtid_223597 = iter_223638;
        bool cond_223601 = sle64(x_223018, gtid_223597);
        int64_t defunc_0_f_res_223602;
        
        if (cond_223601) {
            defunc_0_f_res_223602 = (int64_t) 0;
        } else {
            int64_t i_223603 = add64(x_223337, gtid_223597);
            int64_t defunc_0_add_arg_223604;
            
            defunc_0_add_arg_223604 = ((int64_t *) mem_217536.mem)[gtid_208051 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_223017 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_223603];
            
            int64_t defunc_1_add_res_223605 = add64((int64_t) 1,
                                                    defunc_0_add_arg_223604);
            
            defunc_0_f_res_223602 = defunc_1_add_res_223605;
        }
        
        double defunc_0_f_res_223606;
        
        if (cond_223601) {
            defunc_0_f_res_223606 = 0.0;
        } else {
            int64_t i_223607 = add64(x_223337, gtid_223597);
            double defunc_0_add_arg_223608;
            
            defunc_0_add_arg_223608 = ((double *) mem_218057.mem)[gtid_208051 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_223017 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_223607];
            defunc_0_f_res_223606 = defunc_0_add_arg_223608;
        }
        
        int64_t binop_p_223609 = sub64(defunc_0_f_res_223602,
                                       defunc_0_m_fun_res_223374);
        double defunc_0_f_res_223610 = sitofp_i64_f64(binop_p_223609);
        double abs_res_223611 = fabs(defunc_0_f_res_223610);
        double tmp1_223612 = abs_res_223611 / x_223338;
        double x_223613 = tmp1_223612 * tmp1_223612;
        double y_223614 = tmp1_223612 * x_223613;
        double tmp2_223615 = 1.0 - y_223614;
        double x_223616 = tmp2_223615 * tmp2_223615;
        double tmp3_223617 = tmp2_223615 * x_223616;
        double tmp4_223618 = defunc_0_f_res_223606 * tmp3_223617;
        double defunc_0_f_res_223619;
        
        if (cond_223601) {
            defunc_0_f_res_223619 = 0.0;
        } else {
            int64_t i_223620 = add64(x_223337, gtid_223597);
            double defunc_0_add_arg_223621;
            
            defunc_0_add_arg_223621 = ((double *) mem_218052.mem)[gtid_208051 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_223017 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_223620];
            defunc_0_f_res_223619 = defunc_0_add_arg_223621;
        }
        
        double x_223622 = a0_223373 * tmp4_223618;
        double defunc_9_fit_fun_res_223623 = defunc_0_f_res_223619 * x_223622;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_223598 = local_acc_223639;
        }
        // Load next params
        {
            x_223599 = defunc_9_fit_fun_res_223623;
        }
        // Red body
        {
            double defunc_1_op_res_223600 = x_223598 + x_223599;
            
            local_acc_223639 = defunc_1_op_res_223600;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_223636.mem)[flat_tid_223596] =
        local_acc_223639;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235691_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235691_end -
                 futhark_mc_segred_stage_1_parloop_235691_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235691_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235691_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235691_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235688(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223596 = tid;
    int num_tasks_223635 = info.nsubtasks;
    struct futhark_mc_task_235687 *futhark_mc_task_235687 =
                                  (struct futhark_mc_task_235687 *) args;
    struct futhark_context *ctx = futhark_mc_task_235687->ctx;
    uint64_t futhark_mc_segred_task_235688_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235688_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235687->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235687->free_defunc_0_f_res_203631;
    int64_t gtid_208051 = futhark_mc_task_235687->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235687->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235687->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235687->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 = futhark_mc_task_235687->free_gtid_223017;
    int64_t x_223018 = futhark_mc_task_235687->free_x_223018;
    int64_t x_223337 = futhark_mc_task_235687->free_x_223337;
    double x_223338 = futhark_mc_task_235687->free_x_223338;
    double a0_223373 = futhark_mc_task_235687->free_a0_223373;
    int64_t defunc_0_m_fun_res_223374 =
            futhark_mc_task_235687->free_defunc_0_m_fun_res_223374;
    double defunc_2_reduce_res_223383 =
           *futhark_mc_task_235687->retval_defunc_2_reduce_res_223383;
    size_t reduce_stage_1_tid_res_arr_mem_223636_cached_sizze_235689 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_223636 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_223636_cached_sizze_235689 <
        (size_t) ((int64_t) 8 * num_tasks_223635)) {
        reduce_stage_1_tid_res_arr_mem_223636 =
            realloc(reduce_stage_1_tid_res_arr_mem_223636, (int64_t) 8 *
                    num_tasks_223635);
        reduce_stage_1_tid_res_arr_mem_223636_cached_sizze_235689 =
            (int64_t) 8 * num_tasks_223635;
    }
    
    int64_t iter_223638;
    struct futhark_mc_segred_stage_1_parloop_struct_235690
    futhark_mc_segred_stage_1_parloop_struct_235690;
    
    futhark_mc_segred_stage_1_parloop_struct_235690.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_gtid_208051 =
        gtid_208051;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_mem_218052 =
        mem_218052.mem;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_gtid_223017 =
        gtid_223017;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_x_223018 = x_223018;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_x_223337 = x_223337;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_x_223338 = x_223338;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_a0_223373 = a0_223373;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_defunc_0_m_fun_res_223374 =
        defunc_0_m_fun_res_223374;
    futhark_mc_segred_stage_1_parloop_struct_235690.free_reduce_stage_1_tid_res_arr_mem_223636 =
        reduce_stage_1_tid_res_arr_mem_223636;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235691_task;
    
    futhark_mc_segred_stage_1_parloop_235691_task.name =
        "futhark_mc_segred_stage_1_parloop_235691";
    futhark_mc_segred_stage_1_parloop_235691_task.fn =
        futhark_mc_segred_stage_1_parloop_235691;
    futhark_mc_segred_stage_1_parloop_235691_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235690;
    futhark_mc_segred_stage_1_parloop_235691_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235691_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235691_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235691_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235691_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235691_task);
    
    if (futhark_mc_segred_stage_1_parloop_235691_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235691_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235691_total_end -
                 futhark_mc_segred_stage_1_parloop_235691_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235691_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235691_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235691_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_223383 = 0.0;
    }
    
    double x_223640;
    double x_223641;
    
    for (int32_t i_223643 = 0; i_223643 < num_tasks_223635; i_223643++) {
        flat_tid_223596 = i_223643;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_223640 = defunc_2_reduce_res_223383;
            }
            // load next params
            {
                x_223641 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_223636)[flat_tid_223596];
            }
            // red body
            {
                double defunc_1_op_res_223642 = x_223640 + x_223641;
                
                defunc_2_reduce_res_223383 = defunc_1_op_res_223642;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_223636);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235688_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235688_end -
                 futhark_mc_segred_task_235688_start;
        
        ctx->futhark_mc_segred_task_235688_runs[tid]++;
        ctx->futhark_mc_segred_task_235688_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235688_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235687->retval_defunc_2_reduce_res_223383 =
            defunc_2_reduce_res_223383;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235681(void *args, int64_t start,
                                            int64_t end, int flat_tid_223335,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235680
    *futhark_mc_segmap_parloop_struct_235680 =
    (struct futhark_mc_segmap_parloop_struct_235680 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235680->ctx;
    uint64_t futhark_mc_segmap_parloop_235681_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235681_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235680->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235680->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235680->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235680->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235680->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235680->free_s_n_m_203636;
    int64_t gtid_208051 =
            futhark_mc_segmap_parloop_struct_235680->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235680->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235680->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235680->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235680->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235680->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 =
            futhark_mc_segmap_parloop_struct_235680->free_gtid_223017;
    int64_t x_223018 = futhark_mc_segmap_parloop_struct_235680->free_x_223018;
    struct memblock mem_223019 = {.desc ="mem_223019", .mem =
                                  futhark_mc_segmap_parloop_struct_235680->free_mem_223019,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223556 = start;
    
    for (; iter_223556 < end; iter_223556++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223624 = s_n_m_203636;
        int64_t gtid_223336 = iter_223556;
        int64_t remnant_223625 = iter_223556 - gtid_223336;
        int64_t x_223337;
        
        x_223337 = ((int64_t *) mem_217710.mem)[gtid_208051 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_223017 * s_n_m_203636 +
                                                gtid_223336];
        
        double x_223338;
        
        x_223338 = ((double *) mem_217715.mem)[gtid_208051 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_223017 * s_n_m_203636 +
                                               gtid_223336];
        
        bool cond_223339 = gtid_223336 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_223340;
        
        if (cond_223339) {
            defunc_0_m_fun_res_223340 = (int64_t) 0;
        } else {
            int64_t y_223557 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_223558 = gtid_223336 == y_223557;
            int64_t defunc_0_m_fun_res_f_res_223559;
            
            if (cond_223558) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223560 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223559 =
                    defunc_0_m_fun_res_f_res_t_res_223560;
            } else {
                int64_t x_223561 = sub64(gtid_223336, (int64_t) 1);
                int64_t x_223562 = mul64(jump_s_203499, x_223561);
                int64_t min_arg_223563 = add64((int64_t) 1, x_223562);
                int64_t min_res_223564 = smin64(defunc_0_f_res_203631,
                                                min_arg_223563);
                
                defunc_0_m_fun_res_f_res_223559 = min_res_223564;
            }
            defunc_0_m_fun_res_223340 = defunc_0_m_fun_res_f_res_223559;
        }
        
        double defunc_2_reduce_res_223349;
        int64_t flat_tid_223565 = (int64_t) 0;
        int32_t num_tasks_223626;
        
        defunc_2_reduce_res_223349 = 0.0;
        
        struct futhark_mc_task_235682 futhark_mc_task_235682;
        
        futhark_mc_task_235682.ctx = ctx;
        futhark_mc_task_235682.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235682.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235682.free_gtid_208051 = gtid_208051;
        futhark_mc_task_235682.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235682.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235682.free_gtid_223017 = gtid_223017;
        futhark_mc_task_235682.free_x_223018 = x_223018;
        futhark_mc_task_235682.free_x_223337 = x_223337;
        futhark_mc_task_235682.free_x_223338 = x_223338;
        futhark_mc_task_235682.free_defunc_0_m_fun_res_223340 =
            defunc_0_m_fun_res_223340;
        futhark_mc_task_235682.retval_defunc_2_reduce_res_223349 =
            &defunc_2_reduce_res_223349;
        
        struct scheduler_segop futhark_mc_task_235682_task;
        
        futhark_mc_task_235682_task.args = &futhark_mc_task_235682;
        futhark_mc_task_235682_task.top_level_fn =
            futhark_mc_segred_task_235683;
        futhark_mc_task_235682_task.name = "futhark_mc_segred_task_235683";
        futhark_mc_task_235682_task.iterations = q_s_203493;
        futhark_mc_task_235682_task.task_time =
            &ctx->futhark_mc_segred_task_235683_total_time;
        futhark_mc_task_235682_task.task_iter =
            &ctx->futhark_mc_segred_task_235683_total_iter;
        futhark_mc_task_235682_task.sched = STATIC;
        futhark_mc_task_235682_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235683_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235682_task);
        
        if (futhark_mc_segred_task_235683_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_223373 = 1.0 / defunc_2_reduce_res_223349;
        int64_t defunc_0_m_fun_res_223374;
        
        if (cond_223339) {
            defunc_0_m_fun_res_223374 = (int64_t) 0;
        } else {
            int64_t y_223588 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_223589 = gtid_223336 == y_223588;
            int64_t defunc_0_m_fun_res_f_res_223590;
            
            if (cond_223589) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223591 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223590 =
                    defunc_0_m_fun_res_f_res_t_res_223591;
            } else {
                int64_t x_223592 = sub64(gtid_223336, (int64_t) 1);
                int64_t x_223593 = mul64(jump_s_203499, x_223592);
                int64_t min_arg_223594 = add64((int64_t) 1, x_223593);
                int64_t min_res_223595 = smin64(defunc_0_f_res_203631,
                                                min_arg_223594);
                
                defunc_0_m_fun_res_f_res_223590 = min_res_223595;
            }
            defunc_0_m_fun_res_223374 = defunc_0_m_fun_res_f_res_223590;
        }
        
        double defunc_2_reduce_res_223383;
        int64_t flat_tid_223596 = (int64_t) 0;
        int32_t num_tasks_223635;
        
        defunc_2_reduce_res_223383 = 0.0;
        
        struct futhark_mc_task_235687 futhark_mc_task_235687;
        
        futhark_mc_task_235687.ctx = ctx;
        futhark_mc_task_235687.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235687.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235687.free_gtid_208051 = gtid_208051;
        futhark_mc_task_235687.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235687.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235687.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235687.free_gtid_223017 = gtid_223017;
        futhark_mc_task_235687.free_x_223018 = x_223018;
        futhark_mc_task_235687.free_x_223337 = x_223337;
        futhark_mc_task_235687.free_x_223338 = x_223338;
        futhark_mc_task_235687.free_a0_223373 = a0_223373;
        futhark_mc_task_235687.free_defunc_0_m_fun_res_223374 =
            defunc_0_m_fun_res_223374;
        futhark_mc_task_235687.retval_defunc_2_reduce_res_223383 =
            &defunc_2_reduce_res_223383;
        
        struct scheduler_segop futhark_mc_task_235687_task;
        
        futhark_mc_task_235687_task.args = &futhark_mc_task_235687;
        futhark_mc_task_235687_task.top_level_fn =
            futhark_mc_segred_task_235688;
        futhark_mc_task_235687_task.name = "futhark_mc_segred_task_235688";
        futhark_mc_task_235687_task.iterations = q_s_203493;
        futhark_mc_task_235687_task.task_time =
            &ctx->futhark_mc_segred_task_235688_total_time;
        futhark_mc_task_235687_task.task_iter =
            &ctx->futhark_mc_segred_task_235688_total_iter;
        futhark_mc_task_235687_task.sched = STATIC;
        futhark_mc_task_235687_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235688_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235687_task);
        
        if (futhark_mc_segred_task_235688_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_223019.mem)[gtid_223336] = defunc_2_reduce_res_223383;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235681_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235681_end -
                 futhark_mc_segmap_parloop_235681_start;
        
        ctx->futhark_mc_segmap_parloop_235681_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235681_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235681_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235679(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223335 = tid;
    int num_tasks_223487 = info.nsubtasks;
    struct futhark_mc_task_235675 *futhark_mc_task_235675 =
                                  (struct futhark_mc_task_235675 *) args;
    struct futhark_context *ctx = futhark_mc_task_235675->ctx;
    uint64_t futhark_mc_segmap_nested_task_235679_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235679_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235675->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235675->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235675->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235675->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235675->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235675->free_s_n_m_203636;
    int64_t gtid_208051 = futhark_mc_task_235675->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235675->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235675->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235675->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235675->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235675->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223017 = futhark_mc_task_235675->free_gtid_223017;
    int64_t x_223018 = futhark_mc_task_235675->free_x_223018;
    struct memblock mem_223019 = {.desc ="mem_223019", .mem =
                                  futhark_mc_task_235675->free_mem_223019,
                                  .size =0, .references =NULL};
    int64_t iter_223556;
    struct futhark_mc_segmap_parloop_struct_235680
    futhark_mc_segmap_parloop_struct_235680;
    
    futhark_mc_segmap_parloop_struct_235680.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235680.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235680.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235680.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235680.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235680.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235680.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235680.free_gtid_208051 = gtid_208051;
    futhark_mc_segmap_parloop_struct_235680.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235680.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235680.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235680.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235680.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235680.free_gtid_223017 = gtid_223017;
    futhark_mc_segmap_parloop_struct_235680.free_x_223018 = x_223018;
    futhark_mc_segmap_parloop_struct_235680.free_mem_223019 = mem_223019.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235681_task;
    
    futhark_mc_segmap_parloop_235681_task.name =
        "futhark_mc_segmap_parloop_235681";
    futhark_mc_segmap_parloop_235681_task.fn = futhark_mc_segmap_parloop_235681;
    futhark_mc_segmap_parloop_235681_task.args =
        &futhark_mc_segmap_parloop_struct_235680;
    futhark_mc_segmap_parloop_235681_task.iterations = iterations;
    futhark_mc_segmap_parloop_235681_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235681_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235681_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235681_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235681_task);
    
    if (futhark_mc_segmap_parloop_235681_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235681_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235681_total_end -
                 futhark_mc_segmap_parloop_235681_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235681_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235681_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235681_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235679_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235679_end -
                 futhark_mc_segmap_nested_task_235679_start;
        
        ctx->futhark_mc_segmap_nested_task_235679_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235679_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235679_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235673(void *args, int64_t start,
                                            int64_t end, int flat_tid_223016,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235672
    *futhark_mc_segmap_parloop_struct_235672 =
    (struct futhark_mc_segmap_parloop_struct_235672 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235672->ctx;
    uint64_t futhark_mc_segmap_parloop_235673_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235673_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235672->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235672->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235672->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235672->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235672->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235672->free_s_n_m_203636;
    int64_t gtid_208051 =
            futhark_mc_segmap_parloop_struct_235672->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235672->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235672->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235672->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235672->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235672->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235672->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235672->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218084 = {.desc ="mem_218084", .mem =
                                  futhark_mc_segmap_parloop_struct_235672->free_mem_218084,
                                  .size =0, .references =NULL};
    size_t mem_223019_cached_sizze_235674 = 0;
    unsigned char *mem_223019 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223334 = start;
    
    if (mem_223019_cached_sizze_235674 < (size_t) bytes_217545) {
        mem_223019 = realloc(mem_223019, bytes_217545);
        mem_223019_cached_sizze_235674 = bytes_217545;
    }
    for (; iter_223334 < end; iter_223334++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223485 = n_p_203492;
        int64_t gtid_223017 = iter_223334;
        int64_t remnant_223486 = iter_223334 - gtid_223017;
        int64_t x_223018;
        
        x_223018 = ((int64_t *) mem_217540.mem)[gtid_208051 * n_p_203492 +
                                                gtid_223017];
        
        int64_t flat_tid_223412 = (int64_t) 0;
        int32_t num_tasks_223487;
        int64_t flat_tid_223335 = (int64_t) 0;
        struct futhark_mc_task_235675 futhark_mc_task_235675;
        
        futhark_mc_task_235675.ctx = ctx;
        futhark_mc_task_235675.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235675.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235675.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235675.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235675.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235675.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235675.free_gtid_208051 = gtid_208051;
        futhark_mc_task_235675.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235675.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235675.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235675.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235675.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235675.free_gtid_223017 = gtid_223017;
        futhark_mc_task_235675.free_x_223018 = x_223018;
        futhark_mc_task_235675.free_mem_223019 = mem_223019;
        
        struct scheduler_segop futhark_mc_task_235675_task;
        
        futhark_mc_task_235675_task.args = &futhark_mc_task_235675;
        futhark_mc_task_235675_task.top_level_fn =
            futhark_mc_segmap_task_235676;
        futhark_mc_task_235675_task.name = "futhark_mc_segmap_task_235676";
        futhark_mc_task_235675_task.iterations = s_n_m_203636;
        futhark_mc_task_235675_task.task_time =
            &ctx->futhark_mc_segmap_task_235676_total_time;
        futhark_mc_task_235675_task.task_iter =
            &ctx->futhark_mc_segmap_task_235676_total_iter;
        futhark_mc_task_235675_task.sched = STATIC;
        futhark_mc_task_235675_task.nested_fn =
            futhark_mc_segmap_nested_task_235679;
        
        int futhark_mc_segmap_task_235676_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235675_task);
        
        if (futhark_mc_segmap_task_235676_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218084.mem + gtid_223017 * s_n_m_203636 * (int64_t) 8,
                    mem_223019 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223019);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235673_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235673_end -
                 futhark_mc_segmap_parloop_235673_start;
        
        ctx->futhark_mc_segmap_parloop_235673_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235673_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235673_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235671(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223016 = tid;
    int num_tasks_223253 = info.nsubtasks;
    struct futhark_mc_task_235666 *futhark_mc_task_235666 =
                                  (struct futhark_mc_task_235666 *) args;
    struct futhark_context *ctx = futhark_mc_task_235666->ctx;
    uint64_t futhark_mc_segmap_nested_task_235671_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235671_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235666->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235666->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235666->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235666->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235666->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235666->free_s_n_m_203636;
    int64_t gtid_208051 = futhark_mc_task_235666->free_gtid_208051;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235666->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235666->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235666->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235666->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235666->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235666->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235666->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218084 = {.desc ="mem_218084", .mem =
                                  futhark_mc_task_235666->free_mem_218084,
                                  .size =0, .references =NULL};
    int64_t iter_223334;
    struct futhark_mc_segmap_parloop_struct_235672
    futhark_mc_segmap_parloop_struct_235672;
    
    futhark_mc_segmap_parloop_struct_235672.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235672.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235672.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235672.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235672.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235672.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235672.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235672.free_gtid_208051 = gtid_208051;
    futhark_mc_segmap_parloop_struct_235672.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235672.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235672.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235672.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235672.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235672.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235672.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235672.free_mem_218084 = mem_218084.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235673_task;
    
    futhark_mc_segmap_parloop_235673_task.name =
        "futhark_mc_segmap_parloop_235673";
    futhark_mc_segmap_parloop_235673_task.fn = futhark_mc_segmap_parloop_235673;
    futhark_mc_segmap_parloop_235673_task.args =
        &futhark_mc_segmap_parloop_struct_235672;
    futhark_mc_segmap_parloop_235673_task.iterations = iterations;
    futhark_mc_segmap_parloop_235673_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235673_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235673_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235673_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235673_task);
    
    if (futhark_mc_segmap_parloop_235673_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235673_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235673_total_end -
                 futhark_mc_segmap_parloop_235673_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235673_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235673_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235673_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235671_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235671_end -
                 futhark_mc_segmap_nested_task_235671_start;
        
        ctx->futhark_mc_segmap_nested_task_235671_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235671_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235671_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235664(void *args, int64_t start,
                                            int64_t end, int flat_tid_208050,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235663
    *futhark_mc_segmap_parloop_struct_235663 =
    (struct futhark_mc_segmap_parloop_struct_235663 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235663->ctx;
    uint64_t futhark_mc_segmap_parloop_235664_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235664_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235663->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235663->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235663->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235663->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235663->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235663->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235663->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235663->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235663->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235663->free_bytes_217545;
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235663->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235663->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235663->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235663->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235663->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218133 = {.desc ="mem_218133", .mem =
                                  futhark_mc_segmap_parloop_struct_235663->free_mem_218133,
                                  .size =0, .references =NULL};
    size_t mem_218084_cached_sizze_235665 = 0;
    unsigned char *mem_218084 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223015 = start;
    
    if (mem_218084_cached_sizze_235665 < (size_t) bytes_217597) {
        mem_218084 = realloc(mem_218084, bytes_217597);
        mem_218084_cached_sizze_235665 = bytes_217597;
    }
    for (; iter_223015 < end; iter_223015++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223251 = partition_sizze_203577;
        int64_t gtid_208051 = iter_223015;
        int64_t remnant_223252 = iter_223015 - gtid_208051;
        int64_t flat_tid_223171 = (int64_t) 0;
        int32_t num_tasks_223253;
        int64_t flat_tid_223016 = (int64_t) 0;
        struct futhark_mc_task_235666 futhark_mc_task_235666;
        
        futhark_mc_task_235666.ctx = ctx;
        futhark_mc_task_235666.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235666.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235666.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235666.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235666.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235666.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235666.free_gtid_208051 = gtid_208051;
        futhark_mc_task_235666.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235666.free_mem_217540 = mem_217540.mem;
        futhark_mc_task_235666.free_bytes_217545 = bytes_217545;
        futhark_mc_task_235666.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235666.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235666.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235666.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235666.free_mem_218084 = mem_218084;
        
        struct scheduler_segop futhark_mc_task_235666_task;
        
        futhark_mc_task_235666_task.args = &futhark_mc_task_235666;
        futhark_mc_task_235666_task.top_level_fn =
            futhark_mc_segmap_task_235667;
        futhark_mc_task_235666_task.name = "futhark_mc_segmap_task_235667";
        futhark_mc_task_235666_task.iterations = n_p_203492;
        futhark_mc_task_235666_task.task_time =
            &ctx->futhark_mc_segmap_task_235667_total_time;
        futhark_mc_task_235666_task.task_iter =
            &ctx->futhark_mc_segmap_task_235667_total_iter;
        futhark_mc_task_235666_task.sched = STATIC;
        futhark_mc_task_235666_task.nested_fn =
            futhark_mc_segmap_nested_task_235671;
        
        int futhark_mc_segmap_task_235667_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235666_task);
        
        if (futhark_mc_segmap_task_235667_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218133.mem + gtid_208051 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218084 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218084);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235664_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235664_end -
                 futhark_mc_segmap_parloop_235664_start;
        
        ctx->futhark_mc_segmap_parloop_235664_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235664_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235664_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235662(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_208050 = tid;
    int num_tasks_222929 = info.nsubtasks;
    struct futhark_mc_task_235657 *futhark_mc_task_235657 =
                                  (struct futhark_mc_task_235657 *) args;
    struct futhark_context *ctx = futhark_mc_task_235657->ctx;
    uint64_t futhark_mc_segmap_nested_task_235662_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235662_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235657->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235657->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235657->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235657->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235657->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235657->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235657->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235657->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235657->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235657->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235657->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235657->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235657->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235657->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235657->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218133 = {.desc ="mem_218133", .mem =
                                  futhark_mc_task_235657->free_mem_218133,
                                  .size =0, .references =NULL};
    int64_t iter_223015;
    struct futhark_mc_segmap_parloop_struct_235663
    futhark_mc_segmap_parloop_struct_235663;
    
    futhark_mc_segmap_parloop_struct_235663.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235663.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235663.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235663.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235663.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235663.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235663.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235663.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235663.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235663.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235663.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235663.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235663.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235663.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235663.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235663.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235663.free_mem_218133 = mem_218133.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235664_task;
    
    futhark_mc_segmap_parloop_235664_task.name =
        "futhark_mc_segmap_parloop_235664";
    futhark_mc_segmap_parloop_235664_task.fn = futhark_mc_segmap_parloop_235664;
    futhark_mc_segmap_parloop_235664_task.args =
        &futhark_mc_segmap_parloop_struct_235663;
    futhark_mc_segmap_parloop_235664_task.iterations = iterations;
    futhark_mc_segmap_parloop_235664_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235664_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235664_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235664_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235664_task);
    
    if (futhark_mc_segmap_parloop_235664_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235664_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235664_total_end -
                 futhark_mc_segmap_parloop_235664_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235664_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235664_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235664_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235662_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235662_end -
                 futhark_mc_segmap_nested_task_235662_start;
        
        ctx->futhark_mc_segmap_nested_task_235662_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235662_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235662_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235692 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218270;
    unsigned char *free_mem_218275;
};
struct futhark_mc_segmap_parloop_struct_235694 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218270;
    unsigned char *free_mem_218275;
};
static int futhark_mc_segmap_parloop_235695(void *args, int64_t start,
                                            int64_t end, int flat_tid_208307,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235694
    *futhark_mc_segmap_parloop_struct_235694 =
    (struct futhark_mc_segmap_parloop_struct_235694 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235694->ctx;
    uint64_t futhark_mc_segmap_parloop_235695_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235695_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235694->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235694->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235694->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235694->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235694->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235694->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235694->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235694->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218270 = {.desc ="mem_218270", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_218270,
                                  .size =0, .references =NULL};
    struct memblock mem_218275 = {.desc ="mem_218275", .mem =
                                  futhark_mc_segmap_parloop_struct_235694->free_mem_218275,
                                  .size =0, .references =NULL};
    size_t mem_218181_cached_sizze_235696 = 0;
    unsigned char *mem_218181 = NULL;
    size_t mem_218185_cached_sizze_235697 = 0;
    unsigned char *mem_218185 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223645 = start;
    
    if (mem_218181_cached_sizze_235696 < (size_t) bytes_217597) {
        mem_218181 = realloc(mem_218181, bytes_217597);
        mem_218181_cached_sizze_235696 = bytes_217597;
    }
    if (mem_218185_cached_sizze_235697 < (size_t) bytes_217597) {
        mem_218185 = realloc(mem_218185, bytes_217597);
        mem_218185_cached_sizze_235697 = bytes_217597;
    }
    for (; iter_223645 < end; iter_223645++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223753 = partition_sizze_203577;
        int64_t gtid_208308 = iter_223645;
        int64_t remnant_223754 = iter_223645 - gtid_208308;
        
        for (int64_t i_223646 = 0; i_223646 < n_p_203492; i_223646++) {
            int64_t x_223649;
            
            x_223649 = ((int64_t *) mem_217540.mem)[gtid_208308 * n_p_203492 +
                                                    i_223646];
            for (int64_t i_223652 = 0; i_223652 < s_n_m_203636; i_223652++) {
                int64_t x_223655;
                
                x_223655 = ((int64_t *) mem_217710.mem)[gtid_208308 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        i_223646 *
                                                        s_n_m_203636 +
                                                        i_223652];
                
                double x_223656;
                
                x_223656 = ((double *) mem_217715.mem)[gtid_208308 *
                                                       (s_n_m_203636 *
                                                        n_p_203492) + i_223646 *
                                                       s_n_m_203636 + i_223652];
                
                bool cond_223657 = i_223652 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_223658;
                
                if (cond_223657) {
                    defunc_0_m_fun_res_223658 = (int64_t) 0;
                } else {
                    int64_t y_223659 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_223660 = i_223652 == y_223659;
                    int64_t defunc_0_m_fun_res_f_res_223661;
                    
                    if (cond_223660) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_223662 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_223661 =
                            defunc_0_m_fun_res_f_res_t_res_223662;
                    } else {
                        int64_t x_223663 = sub64(i_223652, (int64_t) 1);
                        int64_t x_223664 = mul64(jump_s_203499, x_223663);
                        int64_t min_arg_223665 = add64((int64_t) 1, x_223664);
                        int64_t min_res_223666 = smin64(defunc_0_f_res_203631,
                                                        min_arg_223665);
                        
                        defunc_0_m_fun_res_f_res_223661 = min_res_223666;
                    }
                    defunc_0_m_fun_res_223658 = defunc_0_m_fun_res_f_res_223661;
                }
                
                double defunc_2_reduce_res_223667;
                double defunc_2_reduce_res_223668;
                double defunc_2_reduce_res_223669;
                double redout_223671;
                double redout_223672;
                double redout_223673;
                
                redout_223671 = 0.0;
                redout_223672 = 0.0;
                redout_223673 = 0.0;
                for (int64_t i_223670 = 0; i_223670 < q_s_203493; i_223670++) {
                    bool cond_223674 = sle64(x_223649, i_223670);
                    int64_t defunc_0_f_res_223675;
                    
                    if (cond_223674) {
                        defunc_0_f_res_223675 = (int64_t) 0;
                    } else {
                        int64_t i_223676 = add64(x_223655, i_223670);
                        int64_t defunc_0_add_arg_223677;
                        
                        defunc_0_add_arg_223677 =
                            ((int64_t *) mem_217536.mem)[gtid_208308 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_223646 *
                                                         defunc_0_f_res_203631 +
                                                         i_223676];
                        
                        int64_t defunc_1_add_res_223678 = add64((int64_t) 1,
                                                                defunc_0_add_arg_223677);
                        
                        defunc_0_f_res_223675 = defunc_1_add_res_223678;
                    }
                    
                    double defunc_0_f_res_223679;
                    
                    if (cond_223674) {
                        defunc_0_f_res_223679 = 0.0;
                    } else {
                        int64_t i_223680 = add64(x_223655, i_223670);
                        double defunc_0_add_arg_223681;
                        
                        defunc_0_add_arg_223681 =
                            ((double *) mem_218057.mem)[gtid_208308 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_223646 *
                                                        defunc_0_f_res_203631 +
                                                        i_223680];
                        defunc_0_f_res_223679 = defunc_0_add_arg_223681;
                    }
                    
                    int64_t binop_p_223682 = sub64(defunc_0_f_res_223675,
                                                   defunc_0_m_fun_res_223658);
                    double defunc_0_f_res_223683 =
                           sitofp_i64_f64(binop_p_223682);
                    double abs_res_223684 = fabs(defunc_0_f_res_223683);
                    double tmp1_223685 = abs_res_223684 / x_223656;
                    double x_223686 = tmp1_223685 * tmp1_223685;
                    double y_223687 = tmp1_223685 * x_223686;
                    double tmp2_223688 = 1.0 - y_223687;
                    double x_223689 = tmp2_223688 * tmp2_223688;
                    double tmp3_223690 = tmp2_223688 * x_223689;
                    double w_j_223691 = defunc_0_f_res_223679 * tmp3_223690;
                    double xw_j_223692 = defunc_0_f_res_223683 * w_j_223691;
                    double x2w_j_223693 = defunc_0_f_res_223683 * xw_j_223692;
                    double defunc_1_op_res_223694 = w_j_223691 + redout_223671;
                    double defunc_1_op_res_223695 = xw_j_223692 + redout_223672;
                    double defunc_1_op_res_223696 = x2w_j_223693 +
                           redout_223673;
                    double redout_tmp_223759 = defunc_1_op_res_223694;
                    double redout_tmp_223760 = defunc_1_op_res_223695;
                    double redout_tmp_223761 = defunc_1_op_res_223696;
                    
                    redout_223671 = redout_tmp_223759;
                    redout_223672 = redout_tmp_223760;
                    redout_223673 = redout_tmp_223761;
                }
                defunc_2_reduce_res_223667 = redout_223671;
                defunc_2_reduce_res_223668 = redout_223672;
                defunc_2_reduce_res_223669 = redout_223673;
                
                double x_223697 = defunc_2_reduce_res_223667 *
                       defunc_2_reduce_res_223669;
                double y_223698 = defunc_2_reduce_res_223668 *
                       defunc_2_reduce_res_223668;
                double y_223699 = x_223697 - y_223698;
                double det1_223700 = 1.0 / y_223699;
                double a11_223701 = defunc_2_reduce_res_223669 * det1_223700;
                double x_223702 = 0.0 - defunc_2_reduce_res_223668;
                double b11_223703 = det1_223700 * x_223702;
                double c11_223704 = defunc_2_reduce_res_223667 * det1_223700;
                int64_t defunc_0_m_fun_res_223705;
                
                if (cond_223657) {
                    defunc_0_m_fun_res_223705 = (int64_t) 0;
                } else {
                    int64_t y_223706 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_223707 = i_223652 == y_223706;
                    int64_t defunc_0_m_fun_res_f_res_223708;
                    
                    if (cond_223707) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_223709 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_223708 =
                            defunc_0_m_fun_res_f_res_t_res_223709;
                    } else {
                        int64_t x_223710 = sub64(i_223652, (int64_t) 1);
                        int64_t x_223711 = mul64(jump_s_203499, x_223710);
                        int64_t min_arg_223712 = add64((int64_t) 1, x_223711);
                        int64_t min_res_223713 = smin64(defunc_0_f_res_203631,
                                                        min_arg_223712);
                        
                        defunc_0_m_fun_res_f_res_223708 = min_res_223713;
                    }
                    defunc_0_m_fun_res_223705 = defunc_0_m_fun_res_f_res_223708;
                }
                
                double defunc_2_reduce_res_223714;
                double defunc_2_reduce_res_223715;
                double redout_223717;
                double redout_223718;
                
                redout_223717 = 0.0;
                redout_223718 = 0.0;
                for (int64_t i_223716 = 0; i_223716 < q_s_203493; i_223716++) {
                    bool cond_223719 = sle64(x_223649, i_223716);
                    int64_t defunc_0_f_res_223720;
                    
                    if (cond_223719) {
                        defunc_0_f_res_223720 = (int64_t) 0;
                    } else {
                        int64_t i_223721 = add64(x_223655, i_223716);
                        int64_t defunc_0_add_arg_223722;
                        
                        defunc_0_add_arg_223722 =
                            ((int64_t *) mem_217536.mem)[gtid_208308 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_223646 *
                                                         defunc_0_f_res_203631 +
                                                         i_223721];
                        
                        int64_t defunc_1_add_res_223723 = add64((int64_t) 1,
                                                                defunc_0_add_arg_223722);
                        
                        defunc_0_f_res_223720 = defunc_1_add_res_223723;
                    }
                    
                    double defunc_0_f_res_223724;
                    
                    if (cond_223719) {
                        defunc_0_f_res_223724 = 0.0;
                    } else {
                        int64_t i_223725 = add64(x_223655, i_223716);
                        double defunc_0_add_arg_223726;
                        
                        defunc_0_add_arg_223726 =
                            ((double *) mem_218057.mem)[gtid_208308 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_223646 *
                                                        defunc_0_f_res_203631 +
                                                        i_223725];
                        defunc_0_f_res_223724 = defunc_0_add_arg_223726;
                    }
                    
                    int64_t binop_p_223727 = sub64(defunc_0_f_res_223720,
                                                   defunc_0_m_fun_res_223705);
                    double defunc_0_f_res_223728 =
                           sitofp_i64_f64(binop_p_223727);
                    double abs_res_223729 = fabs(defunc_0_f_res_223728);
                    double tmp1_223730 = abs_res_223729 / x_223656;
                    double x_223731 = tmp1_223730 * tmp1_223730;
                    double y_223732 = tmp1_223730 * x_223731;
                    double tmp2_223733 = 1.0 - y_223732;
                    double x_223734 = tmp2_223733 * tmp2_223733;
                    double tmp3_223735 = tmp2_223733 * x_223734;
                    double tmp4_223736 = defunc_0_f_res_223724 * tmp3_223735;
                    double defunc_1_f_res_223737 = defunc_0_f_res_223728 *
                           tmp4_223736;
                    double defunc_0_f_res_223738;
                    
                    if (cond_223719) {
                        defunc_0_f_res_223738 = 0.0;
                    } else {
                        int64_t i_223739 = add64(x_223655, i_223716);
                        double defunc_0_add_arg_223740;
                        
                        defunc_0_add_arg_223740 =
                            ((double *) mem_218052.mem)[gtid_208308 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_223646 *
                                                        defunc_0_f_res_203631 +
                                                        i_223739];
                        defunc_0_f_res_223738 = defunc_0_add_arg_223740;
                    }
                    
                    double x_223741 = a11_223701 * tmp4_223736;
                    double y_223742 = b11_223703 * defunc_1_f_res_223737;
                    double x_223743 = x_223741 + y_223742;
                    double defunc_9_fit_fun_res_223744 = defunc_0_f_res_223738 *
                           x_223743;
                    double x_223745 = b11_223703 * tmp4_223736;
                    double y_223746 = c11_223704 * defunc_1_f_res_223737;
                    double x_223747 = x_223745 + y_223746;
                    double defunc_9_slope_fun_res_223748 =
                           defunc_0_f_res_223738 * x_223747;
                    double defunc_1_op_res_223749 =
                           defunc_9_fit_fun_res_223744 + redout_223717;
                    double defunc_1_op_res_223750 =
                           defunc_9_slope_fun_res_223748 + redout_223718;
                    double redout_tmp_223762 = defunc_1_op_res_223749;
                    double redout_tmp_223763 = defunc_1_op_res_223750;
                    
                    redout_223717 = redout_tmp_223762;
                    redout_223718 = redout_tmp_223763;
                }
                defunc_2_reduce_res_223714 = redout_223717;
                defunc_2_reduce_res_223715 = redout_223718;
                ((double *) mem_218181)[i_223646 * s_n_m_203636 + i_223652] =
                    defunc_2_reduce_res_223714;
                ((double *) mem_218185)[i_223646 * s_n_m_203636 + i_223652] =
                    defunc_2_reduce_res_223715;
            }
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218270.mem + gtid_208308 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218181 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218275.mem + gtid_208308 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218185 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218181);
    free(mem_218185);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235695_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235695_end -
                 futhark_mc_segmap_parloop_235695_start;
        
        ctx->futhark_mc_segmap_parloop_235695_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235695_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235695_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235693(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_208307 = tid;
    int num_tasks_223644 = info.nsubtasks;
    struct futhark_mc_task_235692 *futhark_mc_task_235692 =
                                  (struct futhark_mc_task_235692 *) args;
    struct futhark_context *ctx = futhark_mc_task_235692->ctx;
    uint64_t futhark_mc_segmap_task_235693_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235693_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235692->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235692->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235692->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235692->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235692->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235692->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235692->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235692->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235692->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235692->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235692->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235692->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235692->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235692->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235692->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218270 = {.desc ="mem_218270", .mem =
                                  futhark_mc_task_235692->free_mem_218270,
                                  .size =0, .references =NULL};
    struct memblock mem_218275 = {.desc ="mem_218275", .mem =
                                  futhark_mc_task_235692->free_mem_218275,
                                  .size =0, .references =NULL};
    int64_t iter_223645;
    struct futhark_mc_segmap_parloop_struct_235694
    futhark_mc_segmap_parloop_struct_235694;
    
    futhark_mc_segmap_parloop_struct_235694.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235694.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235694.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235694.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235694.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235694.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235694.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235694.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235694.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235694.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235694.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235694.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235694.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235694.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235694.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235694.free_mem_218270 = mem_218270.mem;
    futhark_mc_segmap_parloop_struct_235694.free_mem_218275 = mem_218275.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235695_task;
    
    futhark_mc_segmap_parloop_235695_task.name =
        "futhark_mc_segmap_parloop_235695";
    futhark_mc_segmap_parloop_235695_task.fn = futhark_mc_segmap_parloop_235695;
    futhark_mc_segmap_parloop_235695_task.args =
        &futhark_mc_segmap_parloop_struct_235694;
    futhark_mc_segmap_parloop_235695_task.iterations = iterations;
    futhark_mc_segmap_parloop_235695_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235695_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235695_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235695_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235695_task);
    
    if (futhark_mc_segmap_parloop_235695_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235695_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235695_total_end -
                 futhark_mc_segmap_parloop_235695_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235695_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235695_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235695_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235693_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235693_end -
                 futhark_mc_segmap_task_235693_start;
        
        ctx->futhark_mc_segmap_task_235693_runs[tid]++;
        ctx->futhark_mc_segmap_task_235693_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235693_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235699 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218270;
    unsigned char *free_mem_218275;
};
struct futhark_mc_task_235703 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218173;
    unsigned char *free_mem_218177;
};
struct futhark_mc_segmap_parloop_struct_235705 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218173;
    unsigned char *free_mem_218177;
};
static int futhark_mc_segmap_parloop_235706(void *args, int64_t start,
                                            int64_t end, int flat_tid_223975,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235705
    *futhark_mc_segmap_parloop_struct_235705 =
    (struct futhark_mc_segmap_parloop_struct_235705 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235705->ctx;
    uint64_t futhark_mc_segmap_parloop_235706_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235706_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235705->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235705->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235705->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235705->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235705->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235705->free_s_n_m_203636;
    int64_t gtid_208654 =
            futhark_mc_segmap_parloop_struct_235705->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235705->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218173 = {.desc ="mem_218173", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_218173,
                                  .size =0, .references =NULL};
    struct memblock mem_218177 = {.desc ="mem_218177", .mem =
                                  futhark_mc_segmap_parloop_struct_235705->free_mem_218177,
                                  .size =0, .references =NULL};
    size_t mem_223978_cached_sizze_235707 = 0;
    unsigned char *mem_223978 = NULL;
    size_t mem_223980_cached_sizze_235708 = 0;
    unsigned char *mem_223980 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224088 = start;
    
    if (mem_223978_cached_sizze_235707 < (size_t) bytes_217545) {
        mem_223978 = realloc(mem_223978, bytes_217545);
        mem_223978_cached_sizze_235707 = bytes_217545;
    }
    if (mem_223980_cached_sizze_235708 < (size_t) bytes_217545) {
        mem_223980 = realloc(mem_223980, bytes_217545);
        mem_223980_cached_sizze_235708 = bytes_217545;
    }
    for (; iter_224088 < end; iter_224088++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224190 = n_p_203492;
        int64_t gtid_223976 = iter_224088;
        int64_t remnant_224191 = iter_224088 - gtid_223976;
        int64_t x_223977;
        
        x_223977 = ((int64_t *) mem_217540.mem)[gtid_208654 * n_p_203492 +
                                                gtid_223976];
        for (int64_t i_224089 = 0; i_224089 < s_n_m_203636; i_224089++) {
            int64_t x_224092;
            
            x_224092 = ((int64_t *) mem_217710.mem)[gtid_208654 *
                                                    (s_n_m_203636 *
                                                     n_p_203492) + gtid_223976 *
                                                    s_n_m_203636 + i_224089];
            
            double x_224093;
            
            x_224093 = ((double *) mem_217715.mem)[gtid_208654 * (s_n_m_203636 *
                                                                  n_p_203492) +
                                                   gtid_223976 * s_n_m_203636 +
                                                   i_224089];
            
            bool cond_224094 = i_224089 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_224095;
            
            if (cond_224094) {
                defunc_0_m_fun_res_224095 = (int64_t) 0;
            } else {
                int64_t y_224096 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_224097 = i_224089 == y_224096;
                int64_t defunc_0_m_fun_res_f_res_224098;
                
                if (cond_224097) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_224099 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_224098 =
                        defunc_0_m_fun_res_f_res_t_res_224099;
                } else {
                    int64_t x_224100 = sub64(i_224089, (int64_t) 1);
                    int64_t x_224101 = mul64(jump_s_203499, x_224100);
                    int64_t min_arg_224102 = add64((int64_t) 1, x_224101);
                    int64_t min_res_224103 = smin64(defunc_0_f_res_203631,
                                                    min_arg_224102);
                    
                    defunc_0_m_fun_res_f_res_224098 = min_res_224103;
                }
                defunc_0_m_fun_res_224095 = defunc_0_m_fun_res_f_res_224098;
            }
            
            double defunc_2_reduce_res_224104;
            double defunc_2_reduce_res_224105;
            double defunc_2_reduce_res_224106;
            double redout_224108;
            double redout_224109;
            double redout_224110;
            
            redout_224108 = 0.0;
            redout_224109 = 0.0;
            redout_224110 = 0.0;
            for (int64_t i_224107 = 0; i_224107 < q_s_203493; i_224107++) {
                bool cond_224111 = sle64(x_223977, i_224107);
                int64_t defunc_0_f_res_224112;
                
                if (cond_224111) {
                    defunc_0_f_res_224112 = (int64_t) 0;
                } else {
                    int64_t i_224113 = add64(x_224092, i_224107);
                    int64_t defunc_0_add_arg_224114;
                    
                    defunc_0_add_arg_224114 =
                        ((int64_t *) mem_217536.mem)[gtid_208654 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_223976 *
                                                     defunc_0_f_res_203631 +
                                                     i_224113];
                    
                    int64_t defunc_1_add_res_224115 = add64((int64_t) 1,
                                                            defunc_0_add_arg_224114);
                    
                    defunc_0_f_res_224112 = defunc_1_add_res_224115;
                }
                
                double defunc_0_f_res_224116;
                
                if (cond_224111) {
                    defunc_0_f_res_224116 = 0.0;
                } else {
                    int64_t i_224117 = add64(x_224092, i_224107);
                    double defunc_0_add_arg_224118;
                    
                    defunc_0_add_arg_224118 =
                        ((double *) mem_218057.mem)[gtid_208654 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_223976 *
                                                    defunc_0_f_res_203631 +
                                                    i_224117];
                    defunc_0_f_res_224116 = defunc_0_add_arg_224118;
                }
                
                int64_t binop_p_224119 = sub64(defunc_0_f_res_224112,
                                               defunc_0_m_fun_res_224095);
                double defunc_0_f_res_224120 = sitofp_i64_f64(binop_p_224119);
                double abs_res_224121 = fabs(defunc_0_f_res_224120);
                double tmp1_224122 = abs_res_224121 / x_224093;
                double x_224123 = tmp1_224122 * tmp1_224122;
                double y_224124 = tmp1_224122 * x_224123;
                double tmp2_224125 = 1.0 - y_224124;
                double x_224126 = tmp2_224125 * tmp2_224125;
                double tmp3_224127 = tmp2_224125 * x_224126;
                double w_j_224128 = defunc_0_f_res_224116 * tmp3_224127;
                double xw_j_224129 = defunc_0_f_res_224120 * w_j_224128;
                double x2w_j_224130 = defunc_0_f_res_224120 * xw_j_224129;
                double defunc_1_op_res_224131 = w_j_224128 + redout_224108;
                double defunc_1_op_res_224132 = xw_j_224129 + redout_224109;
                double defunc_1_op_res_224133 = x2w_j_224130 + redout_224110;
                double redout_tmp_224194 = defunc_1_op_res_224131;
                double redout_tmp_224195 = defunc_1_op_res_224132;
                double redout_tmp_224196 = defunc_1_op_res_224133;
                
                redout_224108 = redout_tmp_224194;
                redout_224109 = redout_tmp_224195;
                redout_224110 = redout_tmp_224196;
            }
            defunc_2_reduce_res_224104 = redout_224108;
            defunc_2_reduce_res_224105 = redout_224109;
            defunc_2_reduce_res_224106 = redout_224110;
            
            double x_224134 = defunc_2_reduce_res_224104 *
                   defunc_2_reduce_res_224106;
            double y_224135 = defunc_2_reduce_res_224105 *
                   defunc_2_reduce_res_224105;
            double y_224136 = x_224134 - y_224135;
            double det1_224137 = 1.0 / y_224136;
            double a11_224138 = defunc_2_reduce_res_224106 * det1_224137;
            double x_224139 = 0.0 - defunc_2_reduce_res_224105;
            double b11_224140 = det1_224137 * x_224139;
            double c11_224141 = defunc_2_reduce_res_224104 * det1_224137;
            int64_t defunc_0_m_fun_res_224142;
            
            if (cond_224094) {
                defunc_0_m_fun_res_224142 = (int64_t) 0;
            } else {
                int64_t y_224143 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_224144 = i_224089 == y_224143;
                int64_t defunc_0_m_fun_res_f_res_224145;
                
                if (cond_224144) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_224146 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_224145 =
                        defunc_0_m_fun_res_f_res_t_res_224146;
                } else {
                    int64_t x_224147 = sub64(i_224089, (int64_t) 1);
                    int64_t x_224148 = mul64(jump_s_203499, x_224147);
                    int64_t min_arg_224149 = add64((int64_t) 1, x_224148);
                    int64_t min_res_224150 = smin64(defunc_0_f_res_203631,
                                                    min_arg_224149);
                    
                    defunc_0_m_fun_res_f_res_224145 = min_res_224150;
                }
                defunc_0_m_fun_res_224142 = defunc_0_m_fun_res_f_res_224145;
            }
            
            double defunc_2_reduce_res_224151;
            double defunc_2_reduce_res_224152;
            double redout_224154;
            double redout_224155;
            
            redout_224154 = 0.0;
            redout_224155 = 0.0;
            for (int64_t i_224153 = 0; i_224153 < q_s_203493; i_224153++) {
                bool cond_224156 = sle64(x_223977, i_224153);
                int64_t defunc_0_f_res_224157;
                
                if (cond_224156) {
                    defunc_0_f_res_224157 = (int64_t) 0;
                } else {
                    int64_t i_224158 = add64(x_224092, i_224153);
                    int64_t defunc_0_add_arg_224159;
                    
                    defunc_0_add_arg_224159 =
                        ((int64_t *) mem_217536.mem)[gtid_208654 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_223976 *
                                                     defunc_0_f_res_203631 +
                                                     i_224158];
                    
                    int64_t defunc_1_add_res_224160 = add64((int64_t) 1,
                                                            defunc_0_add_arg_224159);
                    
                    defunc_0_f_res_224157 = defunc_1_add_res_224160;
                }
                
                double defunc_0_f_res_224161;
                
                if (cond_224156) {
                    defunc_0_f_res_224161 = 0.0;
                } else {
                    int64_t i_224162 = add64(x_224092, i_224153);
                    double defunc_0_add_arg_224163;
                    
                    defunc_0_add_arg_224163 =
                        ((double *) mem_218057.mem)[gtid_208654 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_223976 *
                                                    defunc_0_f_res_203631 +
                                                    i_224162];
                    defunc_0_f_res_224161 = defunc_0_add_arg_224163;
                }
                
                int64_t binop_p_224164 = sub64(defunc_0_f_res_224157,
                                               defunc_0_m_fun_res_224142);
                double defunc_0_f_res_224165 = sitofp_i64_f64(binop_p_224164);
                double abs_res_224166 = fabs(defunc_0_f_res_224165);
                double tmp1_224167 = abs_res_224166 / x_224093;
                double x_224168 = tmp1_224167 * tmp1_224167;
                double y_224169 = tmp1_224167 * x_224168;
                double tmp2_224170 = 1.0 - y_224169;
                double x_224171 = tmp2_224170 * tmp2_224170;
                double tmp3_224172 = tmp2_224170 * x_224171;
                double tmp4_224173 = defunc_0_f_res_224161 * tmp3_224172;
                double defunc_1_f_res_224174 = defunc_0_f_res_224165 *
                       tmp4_224173;
                double defunc_0_f_res_224175;
                
                if (cond_224156) {
                    defunc_0_f_res_224175 = 0.0;
                } else {
                    int64_t i_224176 = add64(x_224092, i_224153);
                    double defunc_0_add_arg_224177;
                    
                    defunc_0_add_arg_224177 =
                        ((double *) mem_218052.mem)[gtid_208654 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_223976 *
                                                    defunc_0_f_res_203631 +
                                                    i_224176];
                    defunc_0_f_res_224175 = defunc_0_add_arg_224177;
                }
                
                double x_224178 = a11_224138 * tmp4_224173;
                double y_224179 = b11_224140 * defunc_1_f_res_224174;
                double x_224180 = x_224178 + y_224179;
                double defunc_9_fit_fun_res_224181 = defunc_0_f_res_224175 *
                       x_224180;
                double x_224182 = b11_224140 * tmp4_224173;
                double y_224183 = c11_224141 * defunc_1_f_res_224174;
                double x_224184 = x_224182 + y_224183;
                double defunc_9_slope_fun_res_224185 = defunc_0_f_res_224175 *
                       x_224184;
                double defunc_1_op_res_224186 = defunc_9_fit_fun_res_224181 +
                       redout_224154;
                double defunc_1_op_res_224187 = defunc_9_slope_fun_res_224185 +
                       redout_224155;
                double redout_tmp_224197 = defunc_1_op_res_224186;
                double redout_tmp_224198 = defunc_1_op_res_224187;
                
                redout_224154 = redout_tmp_224197;
                redout_224155 = redout_tmp_224198;
            }
            defunc_2_reduce_res_224151 = redout_224154;
            defunc_2_reduce_res_224152 = redout_224155;
            ((double *) mem_223978)[i_224089] = defunc_2_reduce_res_224151;
            ((double *) mem_223980)[i_224089] = defunc_2_reduce_res_224152;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218173.mem + gtid_223976 * s_n_m_203636 * (int64_t) 8,
                    mem_223978 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218177.mem + gtid_223976 * s_n_m_203636 * (int64_t) 8,
                    mem_223980 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223978);
    free(mem_223980);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235706_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235706_end -
                 futhark_mc_segmap_parloop_235706_start;
        
        ctx->futhark_mc_segmap_parloop_235706_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235706_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235706_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235704(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223975 = tid;
    int num_tasks_224087 = info.nsubtasks;
    struct futhark_mc_task_235703 *futhark_mc_task_235703 =
                                  (struct futhark_mc_task_235703 *) args;
    struct futhark_context *ctx = futhark_mc_task_235703->ctx;
    uint64_t futhark_mc_segmap_task_235704_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235704_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235703->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235703->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235703->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235703->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235703->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235703->free_s_n_m_203636;
    int64_t gtid_208654 = futhark_mc_task_235703->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235703->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235703->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235703->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235703->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235703->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235703->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235703->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218173 = {.desc ="mem_218173", .mem =
                                  futhark_mc_task_235703->free_mem_218173,
                                  .size =0, .references =NULL};
    struct memblock mem_218177 = {.desc ="mem_218177", .mem =
                                  futhark_mc_task_235703->free_mem_218177,
                                  .size =0, .references =NULL};
    int64_t iter_224088;
    struct futhark_mc_segmap_parloop_struct_235705
    futhark_mc_segmap_parloop_struct_235705;
    
    futhark_mc_segmap_parloop_struct_235705.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235705.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235705.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235705.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235705.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235705.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235705.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235705.free_gtid_208654 = gtid_208654;
    futhark_mc_segmap_parloop_struct_235705.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235705.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235705.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235705.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235705.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235705.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235705.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235705.free_mem_218173 = mem_218173.mem;
    futhark_mc_segmap_parloop_struct_235705.free_mem_218177 = mem_218177.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235706_task;
    
    futhark_mc_segmap_parloop_235706_task.name =
        "futhark_mc_segmap_parloop_235706";
    futhark_mc_segmap_parloop_235706_task.fn = futhark_mc_segmap_parloop_235706;
    futhark_mc_segmap_parloop_235706_task.args =
        &futhark_mc_segmap_parloop_struct_235705;
    futhark_mc_segmap_parloop_235706_task.iterations = iterations;
    futhark_mc_segmap_parloop_235706_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235706_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235706_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235706_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235706_task);
    
    if (futhark_mc_segmap_parloop_235706_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235706_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235706_total_end -
                 futhark_mc_segmap_parloop_235706_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235706_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235706_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235706_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235704_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235704_end -
                 futhark_mc_segmap_task_235704_start;
        
        ctx->futhark_mc_segmap_task_235704_runs[tid]++;
        ctx->futhark_mc_segmap_task_235704_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235704_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235710 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218173;
    unsigned char *free_mem_218177;
};
struct futhark_mc_task_235714 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223766;
    int64_t free_x_223767;
    unsigned char *free_mem_223768;
    unsigned char *free_mem_223769;
};
struct futhark_mc_segmap_parloop_struct_235716 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223766;
    int64_t free_x_223767;
    unsigned char *free_mem_223768;
    unsigned char *free_mem_223769;
};
static int futhark_mc_segmap_parloop_235717(void *args, int64_t start,
                                            int64_t end, int flat_tid_224305,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235716
    *futhark_mc_segmap_parloop_struct_235716 =
    (struct futhark_mc_segmap_parloop_struct_235716 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235716->ctx;
    uint64_t futhark_mc_segmap_parloop_235717_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235717_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235716->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235716->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235716->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235716->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235716->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235716->free_s_n_m_203636;
    int64_t gtid_208654 =
            futhark_mc_segmap_parloop_struct_235716->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235716->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235716->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235716->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235716->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235716->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 =
            futhark_mc_segmap_parloop_struct_235716->free_gtid_223766;
    int64_t x_223767 = futhark_mc_segmap_parloop_struct_235716->free_x_223767;
    struct memblock mem_223768 = {.desc ="mem_223768", .mem =
                                  futhark_mc_segmap_parloop_struct_235716->free_mem_223768,
                                  .size =0, .references =NULL};
    struct memblock mem_223769 = {.desc ="mem_223769", .mem =
                                  futhark_mc_segmap_parloop_struct_235716->free_mem_223769,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224406 = start;
    
    for (; iter_224406 < end; iter_224406++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224485 = s_n_m_203636;
        int64_t gtid_224306 = iter_224406;
        int64_t remnant_224486 = iter_224406 - gtid_224306;
        int64_t x_224307;
        
        x_224307 = ((int64_t *) mem_217710.mem)[gtid_208654 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_223766 * s_n_m_203636 +
                                                gtid_224306];
        
        double x_224308;
        
        x_224308 = ((double *) mem_217715.mem)[gtid_208654 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_223766 * s_n_m_203636 +
                                               gtid_224306];
        
        bool cond_224309 = gtid_224306 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_224310;
        
        if (cond_224309) {
            defunc_0_m_fun_res_224310 = (int64_t) 0;
        } else {
            int64_t y_224407 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_224408 = gtid_224306 == y_224407;
            int64_t defunc_0_m_fun_res_f_res_224409;
            
            if (cond_224408) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224410 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224409 =
                    defunc_0_m_fun_res_f_res_t_res_224410;
            } else {
                int64_t x_224411 = sub64(gtid_224306, (int64_t) 1);
                int64_t x_224412 = mul64(jump_s_203499, x_224411);
                int64_t min_arg_224413 = add64((int64_t) 1, x_224412);
                int64_t min_res_224414 = smin64(defunc_0_f_res_203631,
                                                min_arg_224413);
                
                defunc_0_m_fun_res_f_res_224409 = min_res_224414;
            }
            defunc_0_m_fun_res_224310 = defunc_0_m_fun_res_f_res_224409;
        }
        
        double defunc_2_reduce_res_224319;
        double defunc_2_reduce_res_224320;
        double defunc_2_reduce_res_224321;
        double redout_224416;
        double redout_224417;
        double redout_224418;
        
        redout_224416 = 0.0;
        redout_224417 = 0.0;
        redout_224418 = 0.0;
        for (int64_t i_224415 = 0; i_224415 < q_s_203493; i_224415++) {
            bool cond_224419 = sle64(x_223767, i_224415);
            int64_t defunc_0_f_res_224420;
            
            if (cond_224419) {
                defunc_0_f_res_224420 = (int64_t) 0;
            } else {
                int64_t i_224421 = add64(x_224307, i_224415);
                int64_t defunc_0_add_arg_224422;
                
                defunc_0_add_arg_224422 =
                    ((int64_t *) mem_217536.mem)[gtid_208654 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_223766 *
                                                 defunc_0_f_res_203631 +
                                                 i_224421];
                
                int64_t defunc_1_add_res_224423 = add64((int64_t) 1,
                                                        defunc_0_add_arg_224422);
                
                defunc_0_f_res_224420 = defunc_1_add_res_224423;
            }
            
            double defunc_0_f_res_224424;
            
            if (cond_224419) {
                defunc_0_f_res_224424 = 0.0;
            } else {
                int64_t i_224425 = add64(x_224307, i_224415);
                double defunc_0_add_arg_224426;
                
                defunc_0_add_arg_224426 =
                    ((double *) mem_218057.mem)[gtid_208654 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_223766 *
                                                defunc_0_f_res_203631 +
                                                i_224425];
                defunc_0_f_res_224424 = defunc_0_add_arg_224426;
            }
            
            int64_t binop_p_224427 = sub64(defunc_0_f_res_224420,
                                           defunc_0_m_fun_res_224310);
            double defunc_0_f_res_224428 = sitofp_i64_f64(binop_p_224427);
            double abs_res_224429 = fabs(defunc_0_f_res_224428);
            double tmp1_224430 = abs_res_224429 / x_224308;
            double x_224431 = tmp1_224430 * tmp1_224430;
            double y_224432 = tmp1_224430 * x_224431;
            double tmp2_224433 = 1.0 - y_224432;
            double x_224434 = tmp2_224433 * tmp2_224433;
            double tmp3_224435 = tmp2_224433 * x_224434;
            double w_j_224436 = defunc_0_f_res_224424 * tmp3_224435;
            double xw_j_224437 = defunc_0_f_res_224428 * w_j_224436;
            double x2w_j_224438 = defunc_0_f_res_224428 * xw_j_224437;
            double defunc_1_op_res_224439 = w_j_224436 + redout_224416;
            double defunc_1_op_res_224440 = xw_j_224437 + redout_224417;
            double defunc_1_op_res_224441 = x2w_j_224438 + redout_224418;
            double redout_tmp_224487 = defunc_1_op_res_224439;
            double redout_tmp_224488 = defunc_1_op_res_224440;
            double redout_tmp_224489 = defunc_1_op_res_224441;
            
            redout_224416 = redout_tmp_224487;
            redout_224417 = redout_tmp_224488;
            redout_224418 = redout_tmp_224489;
        }
        defunc_2_reduce_res_224319 = redout_224416;
        defunc_2_reduce_res_224320 = redout_224417;
        defunc_2_reduce_res_224321 = redout_224418;
        
        double x_224349 = defunc_2_reduce_res_224319 *
               defunc_2_reduce_res_224321;
        double y_224350 = defunc_2_reduce_res_224320 *
               defunc_2_reduce_res_224320;
        double y_224351 = x_224349 - y_224350;
        double det1_224352 = 1.0 / y_224351;
        double a11_224353 = defunc_2_reduce_res_224321 * det1_224352;
        double x_224354 = 0.0 - defunc_2_reduce_res_224320;
        double b11_224355 = det1_224352 * x_224354;
        double c11_224356 = defunc_2_reduce_res_224319 * det1_224352;
        int64_t defunc_0_m_fun_res_224357;
        
        if (cond_224309) {
            defunc_0_m_fun_res_224357 = (int64_t) 0;
        } else {
            int64_t y_224442 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_224443 = gtid_224306 == y_224442;
            int64_t defunc_0_m_fun_res_f_res_224444;
            
            if (cond_224443) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224445 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224444 =
                    defunc_0_m_fun_res_f_res_t_res_224445;
            } else {
                int64_t x_224446 = sub64(gtid_224306, (int64_t) 1);
                int64_t x_224447 = mul64(jump_s_203499, x_224446);
                int64_t min_arg_224448 = add64((int64_t) 1, x_224447);
                int64_t min_res_224449 = smin64(defunc_0_f_res_203631,
                                                min_arg_224448);
                
                defunc_0_m_fun_res_f_res_224444 = min_res_224449;
            }
            defunc_0_m_fun_res_224357 = defunc_0_m_fun_res_f_res_224444;
        }
        
        double defunc_2_reduce_res_224366;
        double defunc_2_reduce_res_224367;
        double redout_224451;
        double redout_224452;
        
        redout_224451 = 0.0;
        redout_224452 = 0.0;
        for (int64_t i_224450 = 0; i_224450 < q_s_203493; i_224450++) {
            bool cond_224453 = sle64(x_223767, i_224450);
            int64_t defunc_0_f_res_224454;
            
            if (cond_224453) {
                defunc_0_f_res_224454 = (int64_t) 0;
            } else {
                int64_t i_224455 = add64(x_224307, i_224450);
                int64_t defunc_0_add_arg_224456;
                
                defunc_0_add_arg_224456 =
                    ((int64_t *) mem_217536.mem)[gtid_208654 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_223766 *
                                                 defunc_0_f_res_203631 +
                                                 i_224455];
                
                int64_t defunc_1_add_res_224457 = add64((int64_t) 1,
                                                        defunc_0_add_arg_224456);
                
                defunc_0_f_res_224454 = defunc_1_add_res_224457;
            }
            
            double defunc_0_f_res_224458;
            
            if (cond_224453) {
                defunc_0_f_res_224458 = 0.0;
            } else {
                int64_t i_224459 = add64(x_224307, i_224450);
                double defunc_0_add_arg_224460;
                
                defunc_0_add_arg_224460 =
                    ((double *) mem_218057.mem)[gtid_208654 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_223766 *
                                                defunc_0_f_res_203631 +
                                                i_224459];
                defunc_0_f_res_224458 = defunc_0_add_arg_224460;
            }
            
            int64_t binop_p_224461 = sub64(defunc_0_f_res_224454,
                                           defunc_0_m_fun_res_224357);
            double defunc_0_f_res_224462 = sitofp_i64_f64(binop_p_224461);
            double abs_res_224463 = fabs(defunc_0_f_res_224462);
            double tmp1_224464 = abs_res_224463 / x_224308;
            double x_224465 = tmp1_224464 * tmp1_224464;
            double y_224466 = tmp1_224464 * x_224465;
            double tmp2_224467 = 1.0 - y_224466;
            double x_224468 = tmp2_224467 * tmp2_224467;
            double tmp3_224469 = tmp2_224467 * x_224468;
            double tmp4_224470 = defunc_0_f_res_224458 * tmp3_224469;
            double defunc_1_f_res_224471 = defunc_0_f_res_224462 * tmp4_224470;
            double defunc_0_f_res_224472;
            
            if (cond_224453) {
                defunc_0_f_res_224472 = 0.0;
            } else {
                int64_t i_224473 = add64(x_224307, i_224450);
                double defunc_0_add_arg_224474;
                
                defunc_0_add_arg_224474 =
                    ((double *) mem_218052.mem)[gtid_208654 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_223766 *
                                                defunc_0_f_res_203631 +
                                                i_224473];
                defunc_0_f_res_224472 = defunc_0_add_arg_224474;
            }
            
            double x_224475 = a11_224353 * tmp4_224470;
            double y_224476 = b11_224355 * defunc_1_f_res_224471;
            double x_224477 = x_224475 + y_224476;
            double defunc_9_fit_fun_res_224478 = defunc_0_f_res_224472 *
                   x_224477;
            double x_224479 = b11_224355 * tmp4_224470;
            double y_224480 = c11_224356 * defunc_1_f_res_224471;
            double x_224481 = x_224479 + y_224480;
            double defunc_9_slope_fun_res_224482 = defunc_0_f_res_224472 *
                   x_224481;
            double defunc_1_op_res_224483 = defunc_9_fit_fun_res_224478 +
                   redout_224451;
            double defunc_1_op_res_224484 = defunc_9_slope_fun_res_224482 +
                   redout_224452;
            double redout_tmp_224490 = defunc_1_op_res_224483;
            double redout_tmp_224491 = defunc_1_op_res_224484;
            
            redout_224451 = redout_tmp_224490;
            redout_224452 = redout_tmp_224491;
        }
        defunc_2_reduce_res_224366 = redout_224451;
        defunc_2_reduce_res_224367 = redout_224452;
        ((double *) mem_223768.mem)[gtid_224306] = defunc_2_reduce_res_224366;
        ((double *) mem_223769.mem)[gtid_224306] = defunc_2_reduce_res_224367;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235717_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235717_end -
                 futhark_mc_segmap_parloop_235717_start;
        
        ctx->futhark_mc_segmap_parloop_235717_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235717_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235717_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235715(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224305 = tid;
    int num_tasks_224405 = info.nsubtasks;
    struct futhark_mc_task_235714 *futhark_mc_task_235714 =
                                  (struct futhark_mc_task_235714 *) args;
    struct futhark_context *ctx = futhark_mc_task_235714->ctx;
    uint64_t futhark_mc_segmap_task_235715_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235715_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235714->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235714->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235714->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235714->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235714->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235714->free_s_n_m_203636;
    int64_t gtid_208654 = futhark_mc_task_235714->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235714->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235714->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235714->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235714->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235714->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 = futhark_mc_task_235714->free_gtid_223766;
    int64_t x_223767 = futhark_mc_task_235714->free_x_223767;
    struct memblock mem_223768 = {.desc ="mem_223768", .mem =
                                  futhark_mc_task_235714->free_mem_223768,
                                  .size =0, .references =NULL};
    struct memblock mem_223769 = {.desc ="mem_223769", .mem =
                                  futhark_mc_task_235714->free_mem_223769,
                                  .size =0, .references =NULL};
    int64_t iter_224406;
    struct futhark_mc_segmap_parloop_struct_235716
    futhark_mc_segmap_parloop_struct_235716;
    
    futhark_mc_segmap_parloop_struct_235716.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235716.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235716.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235716.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235716.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235716.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235716.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235716.free_gtid_208654 = gtid_208654;
    futhark_mc_segmap_parloop_struct_235716.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235716.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235716.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235716.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235716.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235716.free_gtid_223766 = gtid_223766;
    futhark_mc_segmap_parloop_struct_235716.free_x_223767 = x_223767;
    futhark_mc_segmap_parloop_struct_235716.free_mem_223768 = mem_223768.mem;
    futhark_mc_segmap_parloop_struct_235716.free_mem_223769 = mem_223769.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235717_task;
    
    futhark_mc_segmap_parloop_235717_task.name =
        "futhark_mc_segmap_parloop_235717";
    futhark_mc_segmap_parloop_235717_task.fn = futhark_mc_segmap_parloop_235717;
    futhark_mc_segmap_parloop_235717_task.args =
        &futhark_mc_segmap_parloop_struct_235716;
    futhark_mc_segmap_parloop_235717_task.iterations = iterations;
    futhark_mc_segmap_parloop_235717_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235717_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235717_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235717_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235717_task);
    
    if (futhark_mc_segmap_parloop_235717_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235717_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235717_total_end -
                 futhark_mc_segmap_parloop_235717_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235717_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235717_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235717_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235715_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235715_end -
                 futhark_mc_segmap_task_235715_start;
        
        ctx->futhark_mc_segmap_task_235715_runs[tid]++;
        ctx->futhark_mc_segmap_task_235715_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235715_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235719 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223766;
    int64_t free_x_223767;
    unsigned char *free_mem_223768;
    unsigned char *free_mem_223769;
};
struct futhark_mc_task_235721 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223766;
    int64_t free_x_223767;
    int64_t free_x_224202;
    double free_x_224203;
    int64_t free_defunc_0_m_fun_res_224205;
    double *retval_defunc_2_reduce_res_224214;
    double *retval_defunc_2_reduce_res_224215;
    double *retval_defunc_2_reduce_res_224216;
};
struct futhark_mc_segred_stage_1_parloop_struct_235726 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223766;
    int64_t free_x_223767;
    int64_t free_x_224202;
    double free_x_224203;
    int64_t free_defunc_0_m_fun_res_224205;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224581;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224583;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224585;
};
static int futhark_mc_segred_stage_1_parloop_235727(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_224501,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235726
    *futhark_mc_segred_stage_1_parloop_struct_235726 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235726 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235726->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235727_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235727_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235726->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235726->free_defunc_0_f_res_203631;
    int64_t gtid_208654 =
            futhark_mc_segred_stage_1_parloop_struct_235726->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235726->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235726->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 =
            futhark_mc_segred_stage_1_parloop_struct_235726->free_gtid_223766;
    int64_t x_223767 =
            futhark_mc_segred_stage_1_parloop_struct_235726->free_x_223767;
    int64_t x_224202 =
            futhark_mc_segred_stage_1_parloop_struct_235726->free_x_224202;
    double x_224203 =
           futhark_mc_segred_stage_1_parloop_struct_235726->free_x_224203;
    int64_t defunc_0_m_fun_res_224205 =
            futhark_mc_segred_stage_1_parloop_struct_235726->free_defunc_0_m_fun_res_224205;
    struct memblock reduce_stage_1_tid_res_arr_mem_224581 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224581",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235726->free_reduce_stage_1_tid_res_arr_mem_224581,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_224583 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224583",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235726->free_reduce_stage_1_tid_res_arr_mem_224583,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_224585 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224585",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235726->free_reduce_stage_1_tid_res_arr_mem_224585,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224587 = start;
    double x_224503;
    double x_224504;
    double x_224506;
    double x_224507;
    double x_224509;
    double x_224510;
    double local_acc_224588 = 0.0;
    double local_acc_224589 = 0.0;
    double local_acc_224590 = 0.0;
    
    for (; iter_224587 < end; iter_224587++) {
        int64_t gtid_224502 = iter_224587;
        bool cond_224512 = sle64(x_223767, gtid_224502);
        int64_t defunc_0_f_res_224513;
        
        if (cond_224512) {
            defunc_0_f_res_224513 = (int64_t) 0;
        } else {
            int64_t i_224514 = add64(x_224202, gtid_224502);
            int64_t defunc_0_add_arg_224515;
            
            defunc_0_add_arg_224515 = ((int64_t *) mem_217536.mem)[gtid_208654 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_223766 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_224514];
            
            int64_t defunc_1_add_res_224516 = add64((int64_t) 1,
                                                    defunc_0_add_arg_224515);
            
            defunc_0_f_res_224513 = defunc_1_add_res_224516;
        }
        
        double defunc_0_f_res_224517;
        
        if (cond_224512) {
            defunc_0_f_res_224517 = 0.0;
        } else {
            int64_t i_224518 = add64(x_224202, gtid_224502);
            double defunc_0_add_arg_224519;
            
            defunc_0_add_arg_224519 = ((double *) mem_218057.mem)[gtid_208654 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_223766 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_224518];
            defunc_0_f_res_224517 = defunc_0_add_arg_224519;
        }
        
        int64_t binop_p_224520 = sub64(defunc_0_f_res_224513,
                                       defunc_0_m_fun_res_224205);
        double defunc_0_f_res_224521 = sitofp_i64_f64(binop_p_224520);
        double abs_res_224522 = fabs(defunc_0_f_res_224521);
        double tmp1_224523 = abs_res_224522 / x_224203;
        double x_224524 = tmp1_224523 * tmp1_224523;
        double y_224525 = tmp1_224523 * x_224524;
        double tmp2_224526 = 1.0 - y_224525;
        double x_224527 = tmp2_224526 * tmp2_224526;
        double tmp3_224528 = tmp2_224526 * x_224527;
        double w_j_224529 = defunc_0_f_res_224517 * tmp3_224528;
        double xw_j_224530 = defunc_0_f_res_224521 * w_j_224529;
        double x2w_j_224531 = defunc_0_f_res_224521 * xw_j_224530;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_224503 = local_acc_224588;
        }
        // Load next params
        {
            x_224504 = w_j_224529;
        }
        // Red body
        {
            double defunc_1_op_res_224505 = x_224503 + x_224504;
            
            local_acc_224588 = defunc_1_op_res_224505;
        }
        // Load accum params
        {
            x_224506 = local_acc_224589;
        }
        // Load next params
        {
            x_224507 = xw_j_224530;
        }
        // Red body
        {
            double defunc_1_op_res_224508 = x_224506 + x_224507;
            
            local_acc_224589 = defunc_1_op_res_224508;
        }
        // Load accum params
        {
            x_224509 = local_acc_224590;
        }
        // Load next params
        {
            x_224510 = x2w_j_224531;
        }
        // Red body
        {
            double defunc_1_op_res_224511 = x_224509 + x_224510;
            
            local_acc_224590 = defunc_1_op_res_224511;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_224581.mem)[flat_tid_224501] =
        local_acc_224588;
    ((double *) reduce_stage_1_tid_res_arr_mem_224583.mem)[flat_tid_224501] =
        local_acc_224589;
    ((double *) reduce_stage_1_tid_res_arr_mem_224585.mem)[flat_tid_224501] =
        local_acc_224590;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235727_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235727_end -
                 futhark_mc_segred_stage_1_parloop_235727_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235727_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235727_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235727_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235722(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224501 = tid;
    int num_tasks_224580 = info.nsubtasks;
    struct futhark_mc_task_235721 *futhark_mc_task_235721 =
                                  (struct futhark_mc_task_235721 *) args;
    struct futhark_context *ctx = futhark_mc_task_235721->ctx;
    uint64_t futhark_mc_segred_task_235722_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235722_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235721->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235721->free_defunc_0_f_res_203631;
    int64_t gtid_208654 = futhark_mc_task_235721->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235721->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235721->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 = futhark_mc_task_235721->free_gtid_223766;
    int64_t x_223767 = futhark_mc_task_235721->free_x_223767;
    int64_t x_224202 = futhark_mc_task_235721->free_x_224202;
    double x_224203 = futhark_mc_task_235721->free_x_224203;
    int64_t defunc_0_m_fun_res_224205 =
            futhark_mc_task_235721->free_defunc_0_m_fun_res_224205;
    double defunc_2_reduce_res_224214 =
           *futhark_mc_task_235721->retval_defunc_2_reduce_res_224214;
    double defunc_2_reduce_res_224215 =
           *futhark_mc_task_235721->retval_defunc_2_reduce_res_224215;
    double defunc_2_reduce_res_224216 =
           *futhark_mc_task_235721->retval_defunc_2_reduce_res_224216;
    size_t reduce_stage_1_tid_res_arr_mem_224581_cached_sizze_235723 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224581 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_224583_cached_sizze_235724 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224583 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_224585_cached_sizze_235725 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224585 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_224581_cached_sizze_235723 <
        (size_t) ((int64_t) 8 * num_tasks_224580)) {
        reduce_stage_1_tid_res_arr_mem_224581 =
            realloc(reduce_stage_1_tid_res_arr_mem_224581, (int64_t) 8 *
                    num_tasks_224580);
        reduce_stage_1_tid_res_arr_mem_224581_cached_sizze_235723 =
            (int64_t) 8 * num_tasks_224580;
    }
    if (reduce_stage_1_tid_res_arr_mem_224583_cached_sizze_235724 <
        (size_t) ((int64_t) 8 * num_tasks_224580)) {
        reduce_stage_1_tid_res_arr_mem_224583 =
            realloc(reduce_stage_1_tid_res_arr_mem_224583, (int64_t) 8 *
                    num_tasks_224580);
        reduce_stage_1_tid_res_arr_mem_224583_cached_sizze_235724 =
            (int64_t) 8 * num_tasks_224580;
    }
    if (reduce_stage_1_tid_res_arr_mem_224585_cached_sizze_235725 <
        (size_t) ((int64_t) 8 * num_tasks_224580)) {
        reduce_stage_1_tid_res_arr_mem_224585 =
            realloc(reduce_stage_1_tid_res_arr_mem_224585, (int64_t) 8 *
                    num_tasks_224580);
        reduce_stage_1_tid_res_arr_mem_224585_cached_sizze_235725 =
            (int64_t) 8 * num_tasks_224580;
    }
    
    int64_t iter_224587;
    struct futhark_mc_segred_stage_1_parloop_struct_235726
    futhark_mc_segred_stage_1_parloop_struct_235726;
    
    futhark_mc_segred_stage_1_parloop_struct_235726.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_gtid_208654 =
        gtid_208654;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_gtid_223766 =
        gtid_223766;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_x_223767 = x_223767;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_x_224202 = x_224202;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_x_224203 = x_224203;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_defunc_0_m_fun_res_224205 =
        defunc_0_m_fun_res_224205;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_reduce_stage_1_tid_res_arr_mem_224581 =
        reduce_stage_1_tid_res_arr_mem_224581;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_reduce_stage_1_tid_res_arr_mem_224583 =
        reduce_stage_1_tid_res_arr_mem_224583;
    futhark_mc_segred_stage_1_parloop_struct_235726.free_reduce_stage_1_tid_res_arr_mem_224585 =
        reduce_stage_1_tid_res_arr_mem_224585;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235727_task;
    
    futhark_mc_segred_stage_1_parloop_235727_task.name =
        "futhark_mc_segred_stage_1_parloop_235727";
    futhark_mc_segred_stage_1_parloop_235727_task.fn =
        futhark_mc_segred_stage_1_parloop_235727;
    futhark_mc_segred_stage_1_parloop_235727_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235726;
    futhark_mc_segred_stage_1_parloop_235727_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235727_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235727_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235727_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235727_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235727_task);
    
    if (futhark_mc_segred_stage_1_parloop_235727_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235727_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235727_total_end -
                 futhark_mc_segred_stage_1_parloop_235727_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235727_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235727_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235727_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_224214 = 0.0;
        defunc_2_reduce_res_224215 = 0.0;
        defunc_2_reduce_res_224216 = 0.0;
    }
    
    double x_224591;
    double x_224592;
    double x_224594;
    double x_224595;
    double x_224597;
    double x_224598;
    
    for (int32_t i_224600 = 0; i_224600 < num_tasks_224580; i_224600++) {
        flat_tid_224501 = i_224600;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_224591 = defunc_2_reduce_res_224214;
            }
            // load next params
            {
                x_224592 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224581)[flat_tid_224501];
            }
            // red body
            {
                double defunc_1_op_res_224593 = x_224591 + x_224592;
                
                defunc_2_reduce_res_224214 = defunc_1_op_res_224593;
            }
            // load acc params
            {
                x_224594 = defunc_2_reduce_res_224215;
            }
            // load next params
            {
                x_224595 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224583)[flat_tid_224501];
            }
            // red body
            {
                double defunc_1_op_res_224596 = x_224594 + x_224595;
                
                defunc_2_reduce_res_224215 = defunc_1_op_res_224596;
            }
            // load acc params
            {
                x_224597 = defunc_2_reduce_res_224216;
            }
            // load next params
            {
                x_224598 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224585)[flat_tid_224501];
            }
            // red body
            {
                double defunc_1_op_res_224599 = x_224597 + x_224598;
                
                defunc_2_reduce_res_224216 = defunc_1_op_res_224599;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_224581);
        free(reduce_stage_1_tid_res_arr_mem_224583);
        free(reduce_stage_1_tid_res_arr_mem_224585);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235722_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235722_end -
                 futhark_mc_segred_task_235722_start;
        
        ctx->futhark_mc_segred_task_235722_runs[tid]++;
        ctx->futhark_mc_segred_task_235722_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235722_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235721->retval_defunc_2_reduce_res_224214 =
            defunc_2_reduce_res_224214;
        *futhark_mc_task_235721->retval_defunc_2_reduce_res_224215 =
            defunc_2_reduce_res_224215;
        *futhark_mc_task_235721->retval_defunc_2_reduce_res_224216 =
            defunc_2_reduce_res_224216;
    }
    return err;
}
struct futhark_mc_task_235728 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223766;
    int64_t free_x_223767;
    int64_t free_x_224202;
    double free_x_224203;
    double free_a11_224252;
    double free_b11_224254;
    double free_c11_224255;
    int64_t free_defunc_0_m_fun_res_224256;
    double *retval_defunc_2_reduce_res_224265;
    double *retval_defunc_2_reduce_res_224266;
};
struct futhark_mc_segred_stage_1_parloop_struct_235732 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_208654;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_223766;
    int64_t free_x_223767;
    int64_t free_x_224202;
    double free_x_224203;
    double free_a11_224252;
    double free_b11_224254;
    double free_c11_224255;
    int64_t free_defunc_0_m_fun_res_224256;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224602;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224604;
};
static int futhark_mc_segred_stage_1_parloop_235733(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_224540,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235732
    *futhark_mc_segred_stage_1_parloop_struct_235732 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235732 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235732->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235733_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235733_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235732->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235732->free_defunc_0_f_res_203631;
    int64_t gtid_208654 =
            futhark_mc_segred_stage_1_parloop_struct_235732->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235732->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235732->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235732->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 =
            futhark_mc_segred_stage_1_parloop_struct_235732->free_gtid_223766;
    int64_t x_223767 =
            futhark_mc_segred_stage_1_parloop_struct_235732->free_x_223767;
    int64_t x_224202 =
            futhark_mc_segred_stage_1_parloop_struct_235732->free_x_224202;
    double x_224203 =
           futhark_mc_segred_stage_1_parloop_struct_235732->free_x_224203;
    double a11_224252 =
           futhark_mc_segred_stage_1_parloop_struct_235732->free_a11_224252;
    double b11_224254 =
           futhark_mc_segred_stage_1_parloop_struct_235732->free_b11_224254;
    double c11_224255 =
           futhark_mc_segred_stage_1_parloop_struct_235732->free_c11_224255;
    int64_t defunc_0_m_fun_res_224256 =
            futhark_mc_segred_stage_1_parloop_struct_235732->free_defunc_0_m_fun_res_224256;
    struct memblock reduce_stage_1_tid_res_arr_mem_224602 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224602",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235732->free_reduce_stage_1_tid_res_arr_mem_224602,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_224604 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224604",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235732->free_reduce_stage_1_tid_res_arr_mem_224604,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224606 = start;
    double x_224542;
    double x_224543;
    double x_224545;
    double x_224546;
    double local_acc_224607 = 0.0;
    double local_acc_224608 = 0.0;
    
    for (; iter_224606 < end; iter_224606++) {
        int64_t gtid_224541 = iter_224606;
        bool cond_224548 = sle64(x_223767, gtid_224541);
        int64_t defunc_0_f_res_224549;
        
        if (cond_224548) {
            defunc_0_f_res_224549 = (int64_t) 0;
        } else {
            int64_t i_224550 = add64(x_224202, gtid_224541);
            int64_t defunc_0_add_arg_224551;
            
            defunc_0_add_arg_224551 = ((int64_t *) mem_217536.mem)[gtid_208654 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_223766 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_224550];
            
            int64_t defunc_1_add_res_224552 = add64((int64_t) 1,
                                                    defunc_0_add_arg_224551);
            
            defunc_0_f_res_224549 = defunc_1_add_res_224552;
        }
        
        double defunc_0_f_res_224553;
        
        if (cond_224548) {
            defunc_0_f_res_224553 = 0.0;
        } else {
            int64_t i_224554 = add64(x_224202, gtid_224541);
            double defunc_0_add_arg_224555;
            
            defunc_0_add_arg_224555 = ((double *) mem_218057.mem)[gtid_208654 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_223766 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_224554];
            defunc_0_f_res_224553 = defunc_0_add_arg_224555;
        }
        
        int64_t binop_p_224556 = sub64(defunc_0_f_res_224549,
                                       defunc_0_m_fun_res_224256);
        double defunc_0_f_res_224557 = sitofp_i64_f64(binop_p_224556);
        double abs_res_224558 = fabs(defunc_0_f_res_224557);
        double tmp1_224559 = abs_res_224558 / x_224203;
        double x_224560 = tmp1_224559 * tmp1_224559;
        double y_224561 = tmp1_224559 * x_224560;
        double tmp2_224562 = 1.0 - y_224561;
        double x_224563 = tmp2_224562 * tmp2_224562;
        double tmp3_224564 = tmp2_224562 * x_224563;
        double tmp4_224565 = defunc_0_f_res_224553 * tmp3_224564;
        double defunc_1_f_res_224566 = defunc_0_f_res_224557 * tmp4_224565;
        double defunc_0_f_res_224567;
        
        if (cond_224548) {
            defunc_0_f_res_224567 = 0.0;
        } else {
            int64_t i_224568 = add64(x_224202, gtid_224541);
            double defunc_0_add_arg_224569;
            
            defunc_0_add_arg_224569 = ((double *) mem_218052.mem)[gtid_208654 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_223766 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_224568];
            defunc_0_f_res_224567 = defunc_0_add_arg_224569;
        }
        
        double x_224570 = a11_224252 * tmp4_224565;
        double y_224571 = b11_224254 * defunc_1_f_res_224566;
        double x_224572 = x_224570 + y_224571;
        double defunc_9_fit_fun_res_224573 = defunc_0_f_res_224567 * x_224572;
        double x_224574 = b11_224254 * tmp4_224565;
        double y_224575 = c11_224255 * defunc_1_f_res_224566;
        double x_224576 = x_224574 + y_224575;
        double defunc_9_slope_fun_res_224577 = defunc_0_f_res_224567 * x_224576;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_224542 = local_acc_224607;
        }
        // Load next params
        {
            x_224543 = defunc_9_fit_fun_res_224573;
        }
        // Red body
        {
            double defunc_1_op_res_224544 = x_224542 + x_224543;
            
            local_acc_224607 = defunc_1_op_res_224544;
        }
        // Load accum params
        {
            x_224545 = local_acc_224608;
        }
        // Load next params
        {
            x_224546 = defunc_9_slope_fun_res_224577;
        }
        // Red body
        {
            double defunc_1_op_res_224547 = x_224545 + x_224546;
            
            local_acc_224608 = defunc_1_op_res_224547;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_224602.mem)[flat_tid_224540] =
        local_acc_224607;
    ((double *) reduce_stage_1_tid_res_arr_mem_224604.mem)[flat_tid_224540] =
        local_acc_224608;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235733_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235733_end -
                 futhark_mc_segred_stage_1_parloop_235733_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235733_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235733_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235733_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235729(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224540 = tid;
    int num_tasks_224601 = info.nsubtasks;
    struct futhark_mc_task_235728 *futhark_mc_task_235728 =
                                  (struct futhark_mc_task_235728 *) args;
    struct futhark_context *ctx = futhark_mc_task_235728->ctx;
    uint64_t futhark_mc_segred_task_235729_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235729_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235728->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235728->free_defunc_0_f_res_203631;
    int64_t gtid_208654 = futhark_mc_task_235728->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235728->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235728->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235728->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 = futhark_mc_task_235728->free_gtid_223766;
    int64_t x_223767 = futhark_mc_task_235728->free_x_223767;
    int64_t x_224202 = futhark_mc_task_235728->free_x_224202;
    double x_224203 = futhark_mc_task_235728->free_x_224203;
    double a11_224252 = futhark_mc_task_235728->free_a11_224252;
    double b11_224254 = futhark_mc_task_235728->free_b11_224254;
    double c11_224255 = futhark_mc_task_235728->free_c11_224255;
    int64_t defunc_0_m_fun_res_224256 =
            futhark_mc_task_235728->free_defunc_0_m_fun_res_224256;
    double defunc_2_reduce_res_224265 =
           *futhark_mc_task_235728->retval_defunc_2_reduce_res_224265;
    double defunc_2_reduce_res_224266 =
           *futhark_mc_task_235728->retval_defunc_2_reduce_res_224266;
    size_t reduce_stage_1_tid_res_arr_mem_224602_cached_sizze_235730 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224602 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_224604_cached_sizze_235731 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224604 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_224602_cached_sizze_235730 <
        (size_t) ((int64_t) 8 * num_tasks_224601)) {
        reduce_stage_1_tid_res_arr_mem_224602 =
            realloc(reduce_stage_1_tid_res_arr_mem_224602, (int64_t) 8 *
                    num_tasks_224601);
        reduce_stage_1_tid_res_arr_mem_224602_cached_sizze_235730 =
            (int64_t) 8 * num_tasks_224601;
    }
    if (reduce_stage_1_tid_res_arr_mem_224604_cached_sizze_235731 <
        (size_t) ((int64_t) 8 * num_tasks_224601)) {
        reduce_stage_1_tid_res_arr_mem_224604 =
            realloc(reduce_stage_1_tid_res_arr_mem_224604, (int64_t) 8 *
                    num_tasks_224601);
        reduce_stage_1_tid_res_arr_mem_224604_cached_sizze_235731 =
            (int64_t) 8 * num_tasks_224601;
    }
    
    int64_t iter_224606;
    struct futhark_mc_segred_stage_1_parloop_struct_235732
    futhark_mc_segred_stage_1_parloop_struct_235732;
    
    futhark_mc_segred_stage_1_parloop_struct_235732.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_gtid_208654 =
        gtid_208654;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_mem_218052 =
        mem_218052.mem;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_gtid_223766 =
        gtid_223766;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_x_223767 = x_223767;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_x_224202 = x_224202;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_x_224203 = x_224203;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_a11_224252 =
        a11_224252;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_b11_224254 =
        b11_224254;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_c11_224255 =
        c11_224255;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_defunc_0_m_fun_res_224256 =
        defunc_0_m_fun_res_224256;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_reduce_stage_1_tid_res_arr_mem_224602 =
        reduce_stage_1_tid_res_arr_mem_224602;
    futhark_mc_segred_stage_1_parloop_struct_235732.free_reduce_stage_1_tid_res_arr_mem_224604 =
        reduce_stage_1_tid_res_arr_mem_224604;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235733_task;
    
    futhark_mc_segred_stage_1_parloop_235733_task.name =
        "futhark_mc_segred_stage_1_parloop_235733";
    futhark_mc_segred_stage_1_parloop_235733_task.fn =
        futhark_mc_segred_stage_1_parloop_235733;
    futhark_mc_segred_stage_1_parloop_235733_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235732;
    futhark_mc_segred_stage_1_parloop_235733_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235733_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235733_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235733_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235733_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235733_task);
    
    if (futhark_mc_segred_stage_1_parloop_235733_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235733_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235733_total_end -
                 futhark_mc_segred_stage_1_parloop_235733_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235733_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235733_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235733_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_224265 = 0.0;
        defunc_2_reduce_res_224266 = 0.0;
    }
    
    double x_224609;
    double x_224610;
    double x_224612;
    double x_224613;
    
    for (int32_t i_224615 = 0; i_224615 < num_tasks_224601; i_224615++) {
        flat_tid_224540 = i_224615;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_224609 = defunc_2_reduce_res_224265;
            }
            // load next params
            {
                x_224610 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224602)[flat_tid_224540];
            }
            // red body
            {
                double defunc_1_op_res_224611 = x_224609 + x_224610;
                
                defunc_2_reduce_res_224265 = defunc_1_op_res_224611;
            }
            // load acc params
            {
                x_224612 = defunc_2_reduce_res_224266;
            }
            // load next params
            {
                x_224613 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224604)[flat_tid_224540];
            }
            // red body
            {
                double defunc_1_op_res_224614 = x_224612 + x_224613;
                
                defunc_2_reduce_res_224266 = defunc_1_op_res_224614;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_224602);
        free(reduce_stage_1_tid_res_arr_mem_224604);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235729_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235729_end -
                 futhark_mc_segred_task_235729_start;
        
        ctx->futhark_mc_segred_task_235729_runs[tid]++;
        ctx->futhark_mc_segred_task_235729_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235729_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235728->retval_defunc_2_reduce_res_224265 =
            defunc_2_reduce_res_224265;
        *futhark_mc_task_235728->retval_defunc_2_reduce_res_224266 =
            defunc_2_reduce_res_224266;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235720(void *args, int64_t start,
                                            int64_t end, int flat_tid_224200,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235719
    *futhark_mc_segmap_parloop_struct_235719 =
    (struct futhark_mc_segmap_parloop_struct_235719 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235719->ctx;
    uint64_t futhark_mc_segmap_parloop_235720_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235720_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235719->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235719->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235719->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235719->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235719->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235719->free_s_n_m_203636;
    int64_t gtid_208654 =
            futhark_mc_segmap_parloop_struct_235719->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235719->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235719->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235719->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235719->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235719->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 =
            futhark_mc_segmap_parloop_struct_235719->free_gtid_223766;
    int64_t x_223767 = futhark_mc_segmap_parloop_struct_235719->free_x_223767;
    struct memblock mem_223768 = {.desc ="mem_223768", .mem =
                                  futhark_mc_segmap_parloop_struct_235719->free_mem_223768,
                                  .size =0, .references =NULL};
    struct memblock mem_223769 = {.desc ="mem_223769", .mem =
                                  futhark_mc_segmap_parloop_struct_235719->free_mem_223769,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224492 = start;
    
    for (; iter_224492 < end; iter_224492++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224578 = s_n_m_203636;
        int64_t gtid_224201 = iter_224492;
        int64_t remnant_224579 = iter_224492 - gtid_224201;
        int64_t x_224202;
        
        x_224202 = ((int64_t *) mem_217710.mem)[gtid_208654 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_223766 * s_n_m_203636 +
                                                gtid_224201];
        
        double x_224203;
        
        x_224203 = ((double *) mem_217715.mem)[gtid_208654 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_223766 * s_n_m_203636 +
                                               gtid_224201];
        
        bool cond_224204 = gtid_224201 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_224205;
        
        if (cond_224204) {
            defunc_0_m_fun_res_224205 = (int64_t) 0;
        } else {
            int64_t y_224493 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_224494 = gtid_224201 == y_224493;
            int64_t defunc_0_m_fun_res_f_res_224495;
            
            if (cond_224494) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224496 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224495 =
                    defunc_0_m_fun_res_f_res_t_res_224496;
            } else {
                int64_t x_224497 = sub64(gtid_224201, (int64_t) 1);
                int64_t x_224498 = mul64(jump_s_203499, x_224497);
                int64_t min_arg_224499 = add64((int64_t) 1, x_224498);
                int64_t min_res_224500 = smin64(defunc_0_f_res_203631,
                                                min_arg_224499);
                
                defunc_0_m_fun_res_f_res_224495 = min_res_224500;
            }
            defunc_0_m_fun_res_224205 = defunc_0_m_fun_res_f_res_224495;
        }
        
        double defunc_2_reduce_res_224214;
        double defunc_2_reduce_res_224215;
        double defunc_2_reduce_res_224216;
        int64_t flat_tid_224501 = (int64_t) 0;
        int32_t num_tasks_224580;
        
        defunc_2_reduce_res_224214 = 0.0;
        defunc_2_reduce_res_224215 = 0.0;
        defunc_2_reduce_res_224216 = 0.0;
        
        struct futhark_mc_task_235721 futhark_mc_task_235721;
        
        futhark_mc_task_235721.ctx = ctx;
        futhark_mc_task_235721.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235721.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235721.free_gtid_208654 = gtid_208654;
        futhark_mc_task_235721.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235721.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235721.free_gtid_223766 = gtid_223766;
        futhark_mc_task_235721.free_x_223767 = x_223767;
        futhark_mc_task_235721.free_x_224202 = x_224202;
        futhark_mc_task_235721.free_x_224203 = x_224203;
        futhark_mc_task_235721.free_defunc_0_m_fun_res_224205 =
            defunc_0_m_fun_res_224205;
        futhark_mc_task_235721.retval_defunc_2_reduce_res_224214 =
            &defunc_2_reduce_res_224214;
        futhark_mc_task_235721.retval_defunc_2_reduce_res_224215 =
            &defunc_2_reduce_res_224215;
        futhark_mc_task_235721.retval_defunc_2_reduce_res_224216 =
            &defunc_2_reduce_res_224216;
        
        struct scheduler_segop futhark_mc_task_235721_task;
        
        futhark_mc_task_235721_task.args = &futhark_mc_task_235721;
        futhark_mc_task_235721_task.top_level_fn =
            futhark_mc_segred_task_235722;
        futhark_mc_task_235721_task.name = "futhark_mc_segred_task_235722";
        futhark_mc_task_235721_task.iterations = q_s_203493;
        futhark_mc_task_235721_task.task_time =
            &ctx->futhark_mc_segred_task_235722_total_time;
        futhark_mc_task_235721_task.task_iter =
            &ctx->futhark_mc_segred_task_235722_total_iter;
        futhark_mc_task_235721_task.sched = STATIC;
        futhark_mc_task_235721_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235722_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235721_task);
        
        if (futhark_mc_segred_task_235722_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_224248 = defunc_2_reduce_res_224214 *
               defunc_2_reduce_res_224216;
        double y_224249 = defunc_2_reduce_res_224215 *
               defunc_2_reduce_res_224215;
        double y_224250 = x_224248 - y_224249;
        double det1_224251 = 1.0 / y_224250;
        double a11_224252 = defunc_2_reduce_res_224216 * det1_224251;
        double x_224253 = 0.0 - defunc_2_reduce_res_224215;
        double b11_224254 = det1_224251 * x_224253;
        double c11_224255 = defunc_2_reduce_res_224214 * det1_224251;
        int64_t defunc_0_m_fun_res_224256;
        
        if (cond_224204) {
            defunc_0_m_fun_res_224256 = (int64_t) 0;
        } else {
            int64_t y_224532 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_224533 = gtid_224201 == y_224532;
            int64_t defunc_0_m_fun_res_f_res_224534;
            
            if (cond_224533) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224535 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224534 =
                    defunc_0_m_fun_res_f_res_t_res_224535;
            } else {
                int64_t x_224536 = sub64(gtid_224201, (int64_t) 1);
                int64_t x_224537 = mul64(jump_s_203499, x_224536);
                int64_t min_arg_224538 = add64((int64_t) 1, x_224537);
                int64_t min_res_224539 = smin64(defunc_0_f_res_203631,
                                                min_arg_224538);
                
                defunc_0_m_fun_res_f_res_224534 = min_res_224539;
            }
            defunc_0_m_fun_res_224256 = defunc_0_m_fun_res_f_res_224534;
        }
        
        double defunc_2_reduce_res_224265;
        double defunc_2_reduce_res_224266;
        int64_t flat_tid_224540 = (int64_t) 0;
        int32_t num_tasks_224601;
        
        defunc_2_reduce_res_224265 = 0.0;
        defunc_2_reduce_res_224266 = 0.0;
        
        struct futhark_mc_task_235728 futhark_mc_task_235728;
        
        futhark_mc_task_235728.ctx = ctx;
        futhark_mc_task_235728.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235728.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235728.free_gtid_208654 = gtid_208654;
        futhark_mc_task_235728.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235728.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235728.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235728.free_gtid_223766 = gtid_223766;
        futhark_mc_task_235728.free_x_223767 = x_223767;
        futhark_mc_task_235728.free_x_224202 = x_224202;
        futhark_mc_task_235728.free_x_224203 = x_224203;
        futhark_mc_task_235728.free_a11_224252 = a11_224252;
        futhark_mc_task_235728.free_b11_224254 = b11_224254;
        futhark_mc_task_235728.free_c11_224255 = c11_224255;
        futhark_mc_task_235728.free_defunc_0_m_fun_res_224256 =
            defunc_0_m_fun_res_224256;
        futhark_mc_task_235728.retval_defunc_2_reduce_res_224265 =
            &defunc_2_reduce_res_224265;
        futhark_mc_task_235728.retval_defunc_2_reduce_res_224266 =
            &defunc_2_reduce_res_224266;
        
        struct scheduler_segop futhark_mc_task_235728_task;
        
        futhark_mc_task_235728_task.args = &futhark_mc_task_235728;
        futhark_mc_task_235728_task.top_level_fn =
            futhark_mc_segred_task_235729;
        futhark_mc_task_235728_task.name = "futhark_mc_segred_task_235729";
        futhark_mc_task_235728_task.iterations = q_s_203493;
        futhark_mc_task_235728_task.task_time =
            &ctx->futhark_mc_segred_task_235729_total_time;
        futhark_mc_task_235728_task.task_iter =
            &ctx->futhark_mc_segred_task_235729_total_iter;
        futhark_mc_task_235728_task.sched = STATIC;
        futhark_mc_task_235728_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235729_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235728_task);
        
        if (futhark_mc_segred_task_235729_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_223768.mem)[gtid_224201] = defunc_2_reduce_res_224265;
        ((double *) mem_223769.mem)[gtid_224201] = defunc_2_reduce_res_224266;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235720_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235720_end -
                 futhark_mc_segmap_parloop_235720_start;
        
        ctx->futhark_mc_segmap_parloop_235720_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235720_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235720_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235718(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224200 = tid;
    int num_tasks_224405 = info.nsubtasks;
    struct futhark_mc_task_235714 *futhark_mc_task_235714 =
                                  (struct futhark_mc_task_235714 *) args;
    struct futhark_context *ctx = futhark_mc_task_235714->ctx;
    uint64_t futhark_mc_segmap_nested_task_235718_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235718_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235714->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235714->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235714->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235714->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235714->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235714->free_s_n_m_203636;
    int64_t gtid_208654 = futhark_mc_task_235714->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235714->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235714->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235714->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235714->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235714->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_223766 = futhark_mc_task_235714->free_gtid_223766;
    int64_t x_223767 = futhark_mc_task_235714->free_x_223767;
    struct memblock mem_223768 = {.desc ="mem_223768", .mem =
                                  futhark_mc_task_235714->free_mem_223768,
                                  .size =0, .references =NULL};
    struct memblock mem_223769 = {.desc ="mem_223769", .mem =
                                  futhark_mc_task_235714->free_mem_223769,
                                  .size =0, .references =NULL};
    int64_t iter_224492;
    struct futhark_mc_segmap_parloop_struct_235719
    futhark_mc_segmap_parloop_struct_235719;
    
    futhark_mc_segmap_parloop_struct_235719.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235719.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235719.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235719.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235719.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235719.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235719.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235719.free_gtid_208654 = gtid_208654;
    futhark_mc_segmap_parloop_struct_235719.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235719.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235719.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235719.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235719.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235719.free_gtid_223766 = gtid_223766;
    futhark_mc_segmap_parloop_struct_235719.free_x_223767 = x_223767;
    futhark_mc_segmap_parloop_struct_235719.free_mem_223768 = mem_223768.mem;
    futhark_mc_segmap_parloop_struct_235719.free_mem_223769 = mem_223769.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235720_task;
    
    futhark_mc_segmap_parloop_235720_task.name =
        "futhark_mc_segmap_parloop_235720";
    futhark_mc_segmap_parloop_235720_task.fn = futhark_mc_segmap_parloop_235720;
    futhark_mc_segmap_parloop_235720_task.args =
        &futhark_mc_segmap_parloop_struct_235719;
    futhark_mc_segmap_parloop_235720_task.iterations = iterations;
    futhark_mc_segmap_parloop_235720_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235720_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235720_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235720_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235720_task);
    
    if (futhark_mc_segmap_parloop_235720_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235720_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235720_total_end -
                 futhark_mc_segmap_parloop_235720_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235720_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235720_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235720_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235718_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235718_end -
                 futhark_mc_segmap_nested_task_235718_start;
        
        ctx->futhark_mc_segmap_nested_task_235718_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235718_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235718_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235711(void *args, int64_t start,
                                            int64_t end, int flat_tid_223765,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235710
    *futhark_mc_segmap_parloop_struct_235710 =
    (struct futhark_mc_segmap_parloop_struct_235710 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235710->ctx;
    uint64_t futhark_mc_segmap_parloop_235711_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235711_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235710->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235710->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235710->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235710->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235710->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235710->free_s_n_m_203636;
    int64_t gtid_208654 =
            futhark_mc_segmap_parloop_struct_235710->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235710->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218173 = {.desc ="mem_218173", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_218173,
                                  .size =0, .references =NULL};
    struct memblock mem_218177 = {.desc ="mem_218177", .mem =
                                  futhark_mc_segmap_parloop_struct_235710->free_mem_218177,
                                  .size =0, .references =NULL};
    size_t mem_223768_cached_sizze_235712 = 0;
    unsigned char *mem_223768 = NULL;
    size_t mem_223769_cached_sizze_235713 = 0;
    unsigned char *mem_223769 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224199 = start;
    
    if (mem_223768_cached_sizze_235712 < (size_t) bytes_217545) {
        mem_223768 = realloc(mem_223768, bytes_217545);
        mem_223768_cached_sizze_235712 = bytes_217545;
    }
    if (mem_223769_cached_sizze_235713 < (size_t) bytes_217545) {
        mem_223769 = realloc(mem_223769, bytes_217545);
        mem_223769_cached_sizze_235713 = bytes_217545;
    }
    for (; iter_224199 < end; iter_224199++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224403 = n_p_203492;
        int64_t gtid_223766 = iter_224199;
        int64_t remnant_224404 = iter_224199 - gtid_223766;
        int64_t x_223767;
        
        x_223767 = ((int64_t *) mem_217540.mem)[gtid_208654 * n_p_203492 +
                                                gtid_223766];
        
        int64_t flat_tid_224305 = (int64_t) 0;
        int32_t num_tasks_224405;
        int64_t flat_tid_224200 = (int64_t) 0;
        struct futhark_mc_task_235714 futhark_mc_task_235714;
        
        futhark_mc_task_235714.ctx = ctx;
        futhark_mc_task_235714.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235714.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235714.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235714.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235714.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235714.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235714.free_gtid_208654 = gtid_208654;
        futhark_mc_task_235714.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235714.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235714.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235714.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235714.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235714.free_gtid_223766 = gtid_223766;
        futhark_mc_task_235714.free_x_223767 = x_223767;
        futhark_mc_task_235714.free_mem_223768 = mem_223768;
        futhark_mc_task_235714.free_mem_223769 = mem_223769;
        
        struct scheduler_segop futhark_mc_task_235714_task;
        
        futhark_mc_task_235714_task.args = &futhark_mc_task_235714;
        futhark_mc_task_235714_task.top_level_fn =
            futhark_mc_segmap_task_235715;
        futhark_mc_task_235714_task.name = "futhark_mc_segmap_task_235715";
        futhark_mc_task_235714_task.iterations = s_n_m_203636;
        futhark_mc_task_235714_task.task_time =
            &ctx->futhark_mc_segmap_task_235715_total_time;
        futhark_mc_task_235714_task.task_iter =
            &ctx->futhark_mc_segmap_task_235715_total_iter;
        futhark_mc_task_235714_task.sched = STATIC;
        futhark_mc_task_235714_task.nested_fn =
            futhark_mc_segmap_nested_task_235718;
        
        int futhark_mc_segmap_task_235715_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235714_task);
        
        if (futhark_mc_segmap_task_235715_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218173.mem + gtid_223766 * s_n_m_203636 * (int64_t) 8,
                    mem_223768 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218177.mem + gtid_223766 * s_n_m_203636 * (int64_t) 8,
                    mem_223769 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223768);
    free(mem_223769);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235711_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235711_end -
                 futhark_mc_segmap_parloop_235711_start;
        
        ctx->futhark_mc_segmap_parloop_235711_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235711_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235711_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235709(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223765 = tid;
    int num_tasks_224087 = info.nsubtasks;
    struct futhark_mc_task_235703 *futhark_mc_task_235703 =
                                  (struct futhark_mc_task_235703 *) args;
    struct futhark_context *ctx = futhark_mc_task_235703->ctx;
    uint64_t futhark_mc_segmap_nested_task_235709_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235709_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235703->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235703->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235703->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235703->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235703->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235703->free_s_n_m_203636;
    int64_t gtid_208654 = futhark_mc_task_235703->free_gtid_208654;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235703->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235703->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235703->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235703->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235703->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235703->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235703->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218173 = {.desc ="mem_218173", .mem =
                                  futhark_mc_task_235703->free_mem_218173,
                                  .size =0, .references =NULL};
    struct memblock mem_218177 = {.desc ="mem_218177", .mem =
                                  futhark_mc_task_235703->free_mem_218177,
                                  .size =0, .references =NULL};
    int64_t iter_224199;
    struct futhark_mc_segmap_parloop_struct_235710
    futhark_mc_segmap_parloop_struct_235710;
    
    futhark_mc_segmap_parloop_struct_235710.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235710.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235710.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235710.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235710.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235710.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235710.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235710.free_gtid_208654 = gtid_208654;
    futhark_mc_segmap_parloop_struct_235710.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235710.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235710.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235710.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235710.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235710.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235710.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235710.free_mem_218173 = mem_218173.mem;
    futhark_mc_segmap_parloop_struct_235710.free_mem_218177 = mem_218177.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235711_task;
    
    futhark_mc_segmap_parloop_235711_task.name =
        "futhark_mc_segmap_parloop_235711";
    futhark_mc_segmap_parloop_235711_task.fn = futhark_mc_segmap_parloop_235711;
    futhark_mc_segmap_parloop_235711_task.args =
        &futhark_mc_segmap_parloop_struct_235710;
    futhark_mc_segmap_parloop_235711_task.iterations = iterations;
    futhark_mc_segmap_parloop_235711_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235711_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235711_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235711_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235711_task);
    
    if (futhark_mc_segmap_parloop_235711_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235711_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235711_total_end -
                 futhark_mc_segmap_parloop_235711_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235711_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235711_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235711_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235709_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235709_end -
                 futhark_mc_segmap_nested_task_235709_start;
        
        ctx->futhark_mc_segmap_nested_task_235709_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235709_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235709_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235700(void *args, int64_t start,
                                            int64_t end, int flat_tid_208653,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235699
    *futhark_mc_segmap_parloop_struct_235699 =
    (struct futhark_mc_segmap_parloop_struct_235699 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235699->ctx;
    uint64_t futhark_mc_segmap_parloop_235700_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235700_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235699->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235699->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235699->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235699->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235699->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235699->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235699->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235699->free_bytes_217545;
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235699->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218270 = {.desc ="mem_218270", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_218270,
                                  .size =0, .references =NULL};
    struct memblock mem_218275 = {.desc ="mem_218275", .mem =
                                  futhark_mc_segmap_parloop_struct_235699->free_mem_218275,
                                  .size =0, .references =NULL};
    size_t mem_218173_cached_sizze_235701 = 0;
    unsigned char *mem_218173 = NULL;
    size_t mem_218177_cached_sizze_235702 = 0;
    unsigned char *mem_218177 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223764 = start;
    
    if (mem_218173_cached_sizze_235701 < (size_t) bytes_217597) {
        mem_218173 = realloc(mem_218173, bytes_217597);
        mem_218173_cached_sizze_235701 = bytes_217597;
    }
    if (mem_218177_cached_sizze_235702 < (size_t) bytes_217597) {
        mem_218177 = realloc(mem_218177, bytes_217597);
        mem_218177_cached_sizze_235702 = bytes_217597;
    }
    for (; iter_223764 < end; iter_223764++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224085 = partition_sizze_203577;
        int64_t gtid_208654 = iter_223764;
        int64_t remnant_224086 = iter_223764 - gtid_208654;
        int64_t flat_tid_223975 = (int64_t) 0;
        int32_t num_tasks_224087;
        int64_t flat_tid_223765 = (int64_t) 0;
        struct futhark_mc_task_235703 futhark_mc_task_235703;
        
        futhark_mc_task_235703.ctx = ctx;
        futhark_mc_task_235703.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235703.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235703.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235703.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235703.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235703.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235703.free_gtid_208654 = gtid_208654;
        futhark_mc_task_235703.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235703.free_mem_217540 = mem_217540.mem;
        futhark_mc_task_235703.free_bytes_217545 = bytes_217545;
        futhark_mc_task_235703.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235703.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235703.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235703.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235703.free_mem_218173 = mem_218173;
        futhark_mc_task_235703.free_mem_218177 = mem_218177;
        
        struct scheduler_segop futhark_mc_task_235703_task;
        
        futhark_mc_task_235703_task.args = &futhark_mc_task_235703;
        futhark_mc_task_235703_task.top_level_fn =
            futhark_mc_segmap_task_235704;
        futhark_mc_task_235703_task.name = "futhark_mc_segmap_task_235704";
        futhark_mc_task_235703_task.iterations = n_p_203492;
        futhark_mc_task_235703_task.task_time =
            &ctx->futhark_mc_segmap_task_235704_total_time;
        futhark_mc_task_235703_task.task_iter =
            &ctx->futhark_mc_segmap_task_235704_total_iter;
        futhark_mc_task_235703_task.sched = STATIC;
        futhark_mc_task_235703_task.nested_fn =
            futhark_mc_segmap_nested_task_235709;
        
        int futhark_mc_segmap_task_235704_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235703_task);
        
        if (futhark_mc_segmap_task_235704_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218270.mem + gtid_208654 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218173 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218275.mem + gtid_208654 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218177 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218173);
    free(mem_218177);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235700_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235700_end -
                 futhark_mc_segmap_parloop_235700_start;
        
        ctx->futhark_mc_segmap_parloop_235700_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235700_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235700_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235698(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_208653 = tid;
    int num_tasks_223644 = info.nsubtasks;
    struct futhark_mc_task_235692 *futhark_mc_task_235692 =
                                  (struct futhark_mc_task_235692 *) args;
    struct futhark_context *ctx = futhark_mc_task_235692->ctx;
    uint64_t futhark_mc_segmap_nested_task_235698_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235698_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235692->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235692->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235692->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235692->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235692->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235692->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235692->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235692->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235692->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235692->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235692->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235692->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235692->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235692->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235692->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218270 = {.desc ="mem_218270", .mem =
                                  futhark_mc_task_235692->free_mem_218270,
                                  .size =0, .references =NULL};
    struct memblock mem_218275 = {.desc ="mem_218275", .mem =
                                  futhark_mc_task_235692->free_mem_218275,
                                  .size =0, .references =NULL};
    int64_t iter_223764;
    struct futhark_mc_segmap_parloop_struct_235699
    futhark_mc_segmap_parloop_struct_235699;
    
    futhark_mc_segmap_parloop_struct_235699.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235699.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235699.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235699.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235699.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235699.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235699.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235699.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235699.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235699.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235699.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235699.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235699.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235699.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235699.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235699.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235699.free_mem_218270 = mem_218270.mem;
    futhark_mc_segmap_parloop_struct_235699.free_mem_218275 = mem_218275.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235700_task;
    
    futhark_mc_segmap_parloop_235700_task.name =
        "futhark_mc_segmap_parloop_235700";
    futhark_mc_segmap_parloop_235700_task.fn = futhark_mc_segmap_parloop_235700;
    futhark_mc_segmap_parloop_235700_task.args =
        &futhark_mc_segmap_parloop_struct_235699;
    futhark_mc_segmap_parloop_235700_task.iterations = iterations;
    futhark_mc_segmap_parloop_235700_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235700_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235700_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235700_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235700_task);
    
    if (futhark_mc_segmap_parloop_235700_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235700_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235700_total_end -
                 futhark_mc_segmap_parloop_235700_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235700_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235700_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235700_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235698_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235698_end -
                 futhark_mc_segmap_nested_task_235698_start;
        
        ctx->futhark_mc_segmap_nested_task_235698_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235698_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235698_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235734 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218412;
    unsigned char *free_mem_218417;
};
struct futhark_mc_segmap_parloop_struct_235736 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218412;
    unsigned char *free_mem_218417;
};
static int futhark_mc_segmap_parloop_235737(void *args, int64_t start,
                                            int64_t end, int flat_tid_208997,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235736
    *futhark_mc_segmap_parloop_struct_235736 =
    (struct futhark_mc_segmap_parloop_struct_235736 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235736->ctx;
    uint64_t futhark_mc_segmap_parloop_235737_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235737_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235736->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235736->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235736->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235736->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235736->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235736->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235736->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235736->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218412 = {.desc ="mem_218412", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_218412,
                                  .size =0, .references =NULL};
    struct memblock mem_218417 = {.desc ="mem_218417", .mem =
                                  futhark_mc_segmap_parloop_struct_235736->free_mem_218417,
                                  .size =0, .references =NULL};
    size_t mem_218323_cached_sizze_235738 = 0;
    unsigned char *mem_218323 = NULL;
    size_t mem_218327_cached_sizze_235739 = 0;
    unsigned char *mem_218327 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224617 = start;
    
    if (mem_218323_cached_sizze_235738 < (size_t) bytes_217597) {
        mem_218323 = realloc(mem_218323, bytes_217597);
        mem_218323_cached_sizze_235738 = bytes_217597;
    }
    if (mem_218327_cached_sizze_235739 < (size_t) bytes_217597) {
        mem_218327 = realloc(mem_218327, bytes_217597);
        mem_218327_cached_sizze_235739 = bytes_217597;
    }
    for (; iter_224617 < end; iter_224617++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224755 = partition_sizze_203577;
        int64_t gtid_208998 = iter_224617;
        int64_t remnant_224756 = iter_224617 - gtid_208998;
        
        for (int64_t i_224618 = 0; i_224618 < n_p_203492; i_224618++) {
            int64_t x_224621;
            
            x_224621 = ((int64_t *) mem_217540.mem)[gtid_208998 * n_p_203492 +
                                                    i_224618];
            for (int64_t i_224624 = 0; i_224624 < s_n_m_203636; i_224624++) {
                int64_t x_224627;
                
                x_224627 = ((int64_t *) mem_217710.mem)[gtid_208998 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        i_224618 *
                                                        s_n_m_203636 +
                                                        i_224624];
                
                double x_224628;
                
                x_224628 = ((double *) mem_217715.mem)[gtid_208998 *
                                                       (s_n_m_203636 *
                                                        n_p_203492) + i_224618 *
                                                       s_n_m_203636 + i_224624];
                
                bool cond_224629 = i_224624 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_224630;
                
                if (cond_224629) {
                    defunc_0_m_fun_res_224630 = (int64_t) 0;
                } else {
                    int64_t y_224631 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_224632 = i_224624 == y_224631;
                    int64_t defunc_0_m_fun_res_f_res_224633;
                    
                    if (cond_224632) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_224634 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_224633 =
                            defunc_0_m_fun_res_f_res_t_res_224634;
                    } else {
                        int64_t x_224635 = sub64(i_224624, (int64_t) 1);
                        int64_t x_224636 = mul64(jump_s_203499, x_224635);
                        int64_t min_arg_224637 = add64((int64_t) 1, x_224636);
                        int64_t min_res_224638 = smin64(defunc_0_f_res_203631,
                                                        min_arg_224637);
                        
                        defunc_0_m_fun_res_f_res_224633 = min_res_224638;
                    }
                    defunc_0_m_fun_res_224630 = defunc_0_m_fun_res_f_res_224633;
                }
                
                double defunc_2_reduce_res_224639;
                double defunc_2_reduce_res_224640;
                double defunc_2_reduce_res_224641;
                double defunc_2_reduce_res_224642;
                double defunc_2_reduce_res_224643;
                double redout_224645;
                double redout_224646;
                double redout_224647;
                double redout_224648;
                double redout_224649;
                
                redout_224645 = 0.0;
                redout_224646 = 0.0;
                redout_224647 = 0.0;
                redout_224648 = 0.0;
                redout_224649 = 0.0;
                for (int64_t i_224644 = 0; i_224644 < q_s_203493; i_224644++) {
                    bool cond_224650 = sle64(x_224621, i_224644);
                    int64_t defunc_0_f_res_224651;
                    
                    if (cond_224650) {
                        defunc_0_f_res_224651 = (int64_t) 0;
                    } else {
                        int64_t i_224652 = add64(x_224627, i_224644);
                        int64_t defunc_0_add_arg_224653;
                        
                        defunc_0_add_arg_224653 =
                            ((int64_t *) mem_217536.mem)[gtid_208998 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_224618 *
                                                         defunc_0_f_res_203631 +
                                                         i_224652];
                        
                        int64_t defunc_1_add_res_224654 = add64((int64_t) 1,
                                                                defunc_0_add_arg_224653);
                        
                        defunc_0_f_res_224651 = defunc_1_add_res_224654;
                    }
                    
                    double defunc_0_f_res_224655;
                    
                    if (cond_224650) {
                        defunc_0_f_res_224655 = 0.0;
                    } else {
                        int64_t i_224656 = add64(x_224627, i_224644);
                        double defunc_0_add_arg_224657;
                        
                        defunc_0_add_arg_224657 =
                            ((double *) mem_218057.mem)[gtid_208998 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_224618 *
                                                        defunc_0_f_res_203631 +
                                                        i_224656];
                        defunc_0_f_res_224655 = defunc_0_add_arg_224657;
                    }
                    
                    int64_t binop_p_224658 = sub64(defunc_0_f_res_224651,
                                                   defunc_0_m_fun_res_224630);
                    double defunc_0_f_res_224659 =
                           sitofp_i64_f64(binop_p_224658);
                    double abs_res_224660 = fabs(defunc_0_f_res_224659);
                    double tmp1_224661 = abs_res_224660 / x_224628;
                    double x_224662 = tmp1_224661 * tmp1_224661;
                    double y_224663 = tmp1_224661 * x_224662;
                    double tmp2_224664 = 1.0 - y_224663;
                    double x_224665 = tmp2_224664 * tmp2_224664;
                    double tmp3_224666 = tmp2_224664 * x_224665;
                    double w_j_224667 = defunc_0_f_res_224655 * tmp3_224666;
                    double xw_j_224668 = defunc_0_f_res_224659 * w_j_224667;
                    double x2w_j_224669 = defunc_0_f_res_224659 * xw_j_224668;
                    double x3w_j_224670 = defunc_0_f_res_224659 * x2w_j_224669;
                    double x4w_j_224671 = defunc_0_f_res_224659 * x3w_j_224670;
                    double defunc_1_op_res_224672 = w_j_224667 + redout_224645;
                    double defunc_1_op_res_224673 = xw_j_224668 + redout_224646;
                    double defunc_1_op_res_224674 = x2w_j_224669 +
                           redout_224647;
                    double defunc_1_op_res_224675 = x3w_j_224670 +
                           redout_224648;
                    double defunc_1_op_res_224676 = x4w_j_224671 +
                           redout_224649;
                    double redout_tmp_224761 = defunc_1_op_res_224672;
                    double redout_tmp_224762 = defunc_1_op_res_224673;
                    double redout_tmp_224763 = defunc_1_op_res_224674;
                    double redout_tmp_224764 = defunc_1_op_res_224675;
                    double redout_tmp_224765 = defunc_1_op_res_224676;
                    
                    redout_224645 = redout_tmp_224761;
                    redout_224646 = redout_tmp_224762;
                    redout_224647 = redout_tmp_224763;
                    redout_224648 = redout_tmp_224764;
                    redout_224649 = redout_tmp_224765;
                }
                defunc_2_reduce_res_224639 = redout_224645;
                defunc_2_reduce_res_224640 = redout_224646;
                defunc_2_reduce_res_224641 = redout_224647;
                defunc_2_reduce_res_224642 = redout_224648;
                defunc_2_reduce_res_224643 = redout_224649;
                
                double x_224677 = defunc_2_reduce_res_224641 *
                       defunc_2_reduce_res_224643;
                double y_224678 = defunc_2_reduce_res_224642 *
                       defunc_2_reduce_res_224642;
                double a12_224679 = x_224677 - y_224678;
                double x_224680 = defunc_2_reduce_res_224641 *
                       defunc_2_reduce_res_224642;
                double y_224681 = defunc_2_reduce_res_224640 *
                       defunc_2_reduce_res_224643;
                double b12_224682 = x_224680 - y_224681;
                double x_224683 = defunc_2_reduce_res_224640 *
                       defunc_2_reduce_res_224642;
                double y_224684 = defunc_2_reduce_res_224641 *
                       defunc_2_reduce_res_224641;
                double c12_224685 = x_224683 - y_224684;
                double x_224686 = defunc_2_reduce_res_224639 *
                       defunc_2_reduce_res_224643;
                double b2_224687 = x_224686 - y_224684;
                double x_224688 = defunc_2_reduce_res_224640 *
                       defunc_2_reduce_res_224641;
                double y_224689 = defunc_2_reduce_res_224639 *
                       defunc_2_reduce_res_224642;
                double c2_224690 = x_224688 - y_224689;
                double x_224691 = defunc_2_reduce_res_224639 * a12_224679;
                double y_224692 = defunc_2_reduce_res_224640 * b12_224682;
                double x_224693 = x_224691 + y_224692;
                double y_224694 = defunc_2_reduce_res_224641 * c12_224685;
                double y_224695 = x_224693 + y_224694;
                double det_224696 = 1.0 / y_224695;
                double a12_224697 = a12_224679 * det_224696;
                double b12_224698 = b12_224682 * det_224696;
                double c12_224699 = c12_224685 * det_224696;
                double b2_224700 = b2_224687 * det_224696;
                double c2_224701 = c2_224690 * det_224696;
                int64_t defunc_0_m_fun_res_224702;
                
                if (cond_224629) {
                    defunc_0_m_fun_res_224702 = (int64_t) 0;
                } else {
                    int64_t y_224703 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_224704 = i_224624 == y_224703;
                    int64_t defunc_0_m_fun_res_f_res_224705;
                    
                    if (cond_224704) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_224706 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_224705 =
                            defunc_0_m_fun_res_f_res_t_res_224706;
                    } else {
                        int64_t x_224707 = sub64(i_224624, (int64_t) 1);
                        int64_t x_224708 = mul64(jump_s_203499, x_224707);
                        int64_t min_arg_224709 = add64((int64_t) 1, x_224708);
                        int64_t min_res_224710 = smin64(defunc_0_f_res_203631,
                                                        min_arg_224709);
                        
                        defunc_0_m_fun_res_f_res_224705 = min_res_224710;
                    }
                    defunc_0_m_fun_res_224702 = defunc_0_m_fun_res_f_res_224705;
                }
                
                double defunc_2_reduce_res_224711;
                double defunc_2_reduce_res_224712;
                double redout_224714;
                double redout_224715;
                
                redout_224714 = 0.0;
                redout_224715 = 0.0;
                for (int64_t i_224713 = 0; i_224713 < q_s_203493; i_224713++) {
                    bool cond_224716 = sle64(x_224621, i_224713);
                    int64_t defunc_0_f_res_224717;
                    
                    if (cond_224716) {
                        defunc_0_f_res_224717 = (int64_t) 0;
                    } else {
                        int64_t i_224718 = add64(x_224627, i_224713);
                        int64_t defunc_0_add_arg_224719;
                        
                        defunc_0_add_arg_224719 =
                            ((int64_t *) mem_217536.mem)[gtid_208998 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_224618 *
                                                         defunc_0_f_res_203631 +
                                                         i_224718];
                        
                        int64_t defunc_1_add_res_224720 = add64((int64_t) 1,
                                                                defunc_0_add_arg_224719);
                        
                        defunc_0_f_res_224717 = defunc_1_add_res_224720;
                    }
                    
                    double defunc_0_f_res_224721;
                    
                    if (cond_224716) {
                        defunc_0_f_res_224721 = 0.0;
                    } else {
                        int64_t i_224722 = add64(x_224627, i_224713);
                        double defunc_0_add_arg_224723;
                        
                        defunc_0_add_arg_224723 =
                            ((double *) mem_218057.mem)[gtid_208998 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_224618 *
                                                        defunc_0_f_res_203631 +
                                                        i_224722];
                        defunc_0_f_res_224721 = defunc_0_add_arg_224723;
                    }
                    
                    int64_t binop_p_224724 = sub64(defunc_0_f_res_224717,
                                                   defunc_0_m_fun_res_224702);
                    double defunc_0_f_res_224725 =
                           sitofp_i64_f64(binop_p_224724);
                    double abs_res_224726 = fabs(defunc_0_f_res_224725);
                    double tmp1_224727 = abs_res_224726 / x_224628;
                    double x_224728 = tmp1_224727 * tmp1_224727;
                    double y_224729 = tmp1_224727 * x_224728;
                    double tmp2_224730 = 1.0 - y_224729;
                    double x_224731 = tmp2_224730 * tmp2_224730;
                    double tmp3_224732 = tmp2_224730 * x_224731;
                    double tmp4_224733 = defunc_0_f_res_224721 * tmp3_224732;
                    double defunc_1_f_res_224734 = defunc_0_f_res_224725 *
                           tmp4_224733;
                    double defunc_1_f_res_224735 = defunc_0_f_res_224725 *
                           defunc_1_f_res_224734;
                    double defunc_0_f_res_224736;
                    
                    if (cond_224716) {
                        defunc_0_f_res_224736 = 0.0;
                    } else {
                        int64_t i_224737 = add64(x_224627, i_224713);
                        double defunc_0_add_arg_224738;
                        
                        defunc_0_add_arg_224738 =
                            ((double *) mem_218052.mem)[gtid_208998 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_224618 *
                                                        defunc_0_f_res_203631 +
                                                        i_224737];
                        defunc_0_f_res_224736 = defunc_0_add_arg_224738;
                    }
                    
                    double x_224739 = a12_224697 * tmp4_224733;
                    double y_224740 = b12_224698 * defunc_1_f_res_224734;
                    double x_224741 = x_224739 + y_224740;
                    double y_224742 = c12_224699 * defunc_1_f_res_224735;
                    double x_224743 = x_224741 + y_224742;
                    double defunc_9_fit_fun_res_224744 = defunc_0_f_res_224736 *
                           x_224743;
                    double x_224745 = b12_224698 * tmp4_224733;
                    double y_224746 = b2_224700 * defunc_1_f_res_224734;
                    double x_224747 = x_224745 + y_224746;
                    double y_224748 = c2_224701 * defunc_1_f_res_224735;
                    double x_224749 = x_224747 + y_224748;
                    double defunc_9_slope_fun_res_224750 =
                           defunc_0_f_res_224736 * x_224749;
                    double defunc_1_op_res_224751 =
                           defunc_9_fit_fun_res_224744 + redout_224714;
                    double defunc_1_op_res_224752 =
                           defunc_9_slope_fun_res_224750 + redout_224715;
                    double redout_tmp_224766 = defunc_1_op_res_224751;
                    double redout_tmp_224767 = defunc_1_op_res_224752;
                    
                    redout_224714 = redout_tmp_224766;
                    redout_224715 = redout_tmp_224767;
                }
                defunc_2_reduce_res_224711 = redout_224714;
                defunc_2_reduce_res_224712 = redout_224715;
                ((double *) mem_218323)[i_224618 * s_n_m_203636 + i_224624] =
                    defunc_2_reduce_res_224711;
                ((double *) mem_218327)[i_224618 * s_n_m_203636 + i_224624] =
                    defunc_2_reduce_res_224712;
            }
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218412.mem + gtid_208998 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218323 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218417.mem + gtid_208998 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218327 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218323);
    free(mem_218327);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235737_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235737_end -
                 futhark_mc_segmap_parloop_235737_start;
        
        ctx->futhark_mc_segmap_parloop_235737_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235737_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235737_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235735(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_208997 = tid;
    int num_tasks_224616 = info.nsubtasks;
    struct futhark_mc_task_235734 *futhark_mc_task_235734 =
                                  (struct futhark_mc_task_235734 *) args;
    struct futhark_context *ctx = futhark_mc_task_235734->ctx;
    uint64_t futhark_mc_segmap_task_235735_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235735_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235734->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235734->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235734->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235734->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235734->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235734->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235734->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235734->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235734->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235734->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235734->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235734->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235734->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235734->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235734->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218412 = {.desc ="mem_218412", .mem =
                                  futhark_mc_task_235734->free_mem_218412,
                                  .size =0, .references =NULL};
    struct memblock mem_218417 = {.desc ="mem_218417", .mem =
                                  futhark_mc_task_235734->free_mem_218417,
                                  .size =0, .references =NULL};
    int64_t iter_224617;
    struct futhark_mc_segmap_parloop_struct_235736
    futhark_mc_segmap_parloop_struct_235736;
    
    futhark_mc_segmap_parloop_struct_235736.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235736.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235736.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235736.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235736.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235736.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235736.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235736.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235736.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235736.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235736.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235736.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235736.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235736.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235736.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235736.free_mem_218412 = mem_218412.mem;
    futhark_mc_segmap_parloop_struct_235736.free_mem_218417 = mem_218417.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235737_task;
    
    futhark_mc_segmap_parloop_235737_task.name =
        "futhark_mc_segmap_parloop_235737";
    futhark_mc_segmap_parloop_235737_task.fn = futhark_mc_segmap_parloop_235737;
    futhark_mc_segmap_parloop_235737_task.args =
        &futhark_mc_segmap_parloop_struct_235736;
    futhark_mc_segmap_parloop_235737_task.iterations = iterations;
    futhark_mc_segmap_parloop_235737_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235737_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235737_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235737_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235737_task);
    
    if (futhark_mc_segmap_parloop_235737_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235737_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235737_total_end -
                 futhark_mc_segmap_parloop_235737_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235737_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235737_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235737_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235735_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235735_end -
                 futhark_mc_segmap_task_235735_start;
        
        ctx->futhark_mc_segmap_task_235735_runs[tid]++;
        ctx->futhark_mc_segmap_task_235735_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235735_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235741 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218412;
    unsigned char *free_mem_218417;
};
struct futhark_mc_task_235745 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218315;
    unsigned char *free_mem_218319;
};
struct futhark_mc_segmap_parloop_struct_235747 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218315;
    unsigned char *free_mem_218319;
};
static int futhark_mc_segmap_parloop_235748(void *args, int64_t start,
                                            int64_t end, int flat_tid_225041,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235747
    *futhark_mc_segmap_parloop_struct_235747 =
    (struct futhark_mc_segmap_parloop_struct_235747 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235747->ctx;
    uint64_t futhark_mc_segmap_parloop_235748_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235748_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235747->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235747->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235747->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235747->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235747->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235747->free_s_n_m_203636;
    int64_t gtid_209440 =
            futhark_mc_segmap_parloop_struct_235747->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235747->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218315 = {.desc ="mem_218315", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_218315,
                                  .size =0, .references =NULL};
    struct memblock mem_218319 = {.desc ="mem_218319", .mem =
                                  futhark_mc_segmap_parloop_struct_235747->free_mem_218319,
                                  .size =0, .references =NULL};
    size_t mem_225044_cached_sizze_235749 = 0;
    unsigned char *mem_225044 = NULL;
    size_t mem_225046_cached_sizze_235750 = 0;
    unsigned char *mem_225046 = NULL;
    int64_t iterations = end - start;
    int64_t iter_225184 = start;
    
    if (mem_225044_cached_sizze_235749 < (size_t) bytes_217545) {
        mem_225044 = realloc(mem_225044, bytes_217545);
        mem_225044_cached_sizze_235749 = bytes_217545;
    }
    if (mem_225046_cached_sizze_235750 < (size_t) bytes_217545) {
        mem_225046 = realloc(mem_225046, bytes_217545);
        mem_225046_cached_sizze_235750 = bytes_217545;
    }
    for (; iter_225184 < end; iter_225184++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225316 = n_p_203492;
        int64_t gtid_225042 = iter_225184;
        int64_t remnant_225317 = iter_225184 - gtid_225042;
        int64_t x_225043;
        
        x_225043 = ((int64_t *) mem_217540.mem)[gtid_209440 * n_p_203492 +
                                                gtid_225042];
        for (int64_t i_225185 = 0; i_225185 < s_n_m_203636; i_225185++) {
            int64_t x_225188;
            
            x_225188 = ((int64_t *) mem_217710.mem)[gtid_209440 *
                                                    (s_n_m_203636 *
                                                     n_p_203492) + gtid_225042 *
                                                    s_n_m_203636 + i_225185];
            
            double x_225189;
            
            x_225189 = ((double *) mem_217715.mem)[gtid_209440 * (s_n_m_203636 *
                                                                  n_p_203492) +
                                                   gtid_225042 * s_n_m_203636 +
                                                   i_225185];
            
            bool cond_225190 = i_225185 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_225191;
            
            if (cond_225190) {
                defunc_0_m_fun_res_225191 = (int64_t) 0;
            } else {
                int64_t y_225192 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_225193 = i_225185 == y_225192;
                int64_t defunc_0_m_fun_res_f_res_225194;
                
                if (cond_225193) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_225195 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_225194 =
                        defunc_0_m_fun_res_f_res_t_res_225195;
                } else {
                    int64_t x_225196 = sub64(i_225185, (int64_t) 1);
                    int64_t x_225197 = mul64(jump_s_203499, x_225196);
                    int64_t min_arg_225198 = add64((int64_t) 1, x_225197);
                    int64_t min_res_225199 = smin64(defunc_0_f_res_203631,
                                                    min_arg_225198);
                    
                    defunc_0_m_fun_res_f_res_225194 = min_res_225199;
                }
                defunc_0_m_fun_res_225191 = defunc_0_m_fun_res_f_res_225194;
            }
            
            double defunc_2_reduce_res_225200;
            double defunc_2_reduce_res_225201;
            double defunc_2_reduce_res_225202;
            double defunc_2_reduce_res_225203;
            double defunc_2_reduce_res_225204;
            double redout_225206;
            double redout_225207;
            double redout_225208;
            double redout_225209;
            double redout_225210;
            
            redout_225206 = 0.0;
            redout_225207 = 0.0;
            redout_225208 = 0.0;
            redout_225209 = 0.0;
            redout_225210 = 0.0;
            for (int64_t i_225205 = 0; i_225205 < q_s_203493; i_225205++) {
                bool cond_225211 = sle64(x_225043, i_225205);
                int64_t defunc_0_f_res_225212;
                
                if (cond_225211) {
                    defunc_0_f_res_225212 = (int64_t) 0;
                } else {
                    int64_t i_225213 = add64(x_225188, i_225205);
                    int64_t defunc_0_add_arg_225214;
                    
                    defunc_0_add_arg_225214 =
                        ((int64_t *) mem_217536.mem)[gtid_209440 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_225042 *
                                                     defunc_0_f_res_203631 +
                                                     i_225213];
                    
                    int64_t defunc_1_add_res_225215 = add64((int64_t) 1,
                                                            defunc_0_add_arg_225214);
                    
                    defunc_0_f_res_225212 = defunc_1_add_res_225215;
                }
                
                double defunc_0_f_res_225216;
                
                if (cond_225211) {
                    defunc_0_f_res_225216 = 0.0;
                } else {
                    int64_t i_225217 = add64(x_225188, i_225205);
                    double defunc_0_add_arg_225218;
                    
                    defunc_0_add_arg_225218 =
                        ((double *) mem_218057.mem)[gtid_209440 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_225042 *
                                                    defunc_0_f_res_203631 +
                                                    i_225217];
                    defunc_0_f_res_225216 = defunc_0_add_arg_225218;
                }
                
                int64_t binop_p_225219 = sub64(defunc_0_f_res_225212,
                                               defunc_0_m_fun_res_225191);
                double defunc_0_f_res_225220 = sitofp_i64_f64(binop_p_225219);
                double abs_res_225221 = fabs(defunc_0_f_res_225220);
                double tmp1_225222 = abs_res_225221 / x_225189;
                double x_225223 = tmp1_225222 * tmp1_225222;
                double y_225224 = tmp1_225222 * x_225223;
                double tmp2_225225 = 1.0 - y_225224;
                double x_225226 = tmp2_225225 * tmp2_225225;
                double tmp3_225227 = tmp2_225225 * x_225226;
                double w_j_225228 = defunc_0_f_res_225216 * tmp3_225227;
                double xw_j_225229 = defunc_0_f_res_225220 * w_j_225228;
                double x2w_j_225230 = defunc_0_f_res_225220 * xw_j_225229;
                double x3w_j_225231 = defunc_0_f_res_225220 * x2w_j_225230;
                double x4w_j_225232 = defunc_0_f_res_225220 * x3w_j_225231;
                double defunc_1_op_res_225233 = w_j_225228 + redout_225206;
                double defunc_1_op_res_225234 = xw_j_225229 + redout_225207;
                double defunc_1_op_res_225235 = x2w_j_225230 + redout_225208;
                double defunc_1_op_res_225236 = x3w_j_225231 + redout_225209;
                double defunc_1_op_res_225237 = x4w_j_225232 + redout_225210;
                double redout_tmp_225320 = defunc_1_op_res_225233;
                double redout_tmp_225321 = defunc_1_op_res_225234;
                double redout_tmp_225322 = defunc_1_op_res_225235;
                double redout_tmp_225323 = defunc_1_op_res_225236;
                double redout_tmp_225324 = defunc_1_op_res_225237;
                
                redout_225206 = redout_tmp_225320;
                redout_225207 = redout_tmp_225321;
                redout_225208 = redout_tmp_225322;
                redout_225209 = redout_tmp_225323;
                redout_225210 = redout_tmp_225324;
            }
            defunc_2_reduce_res_225200 = redout_225206;
            defunc_2_reduce_res_225201 = redout_225207;
            defunc_2_reduce_res_225202 = redout_225208;
            defunc_2_reduce_res_225203 = redout_225209;
            defunc_2_reduce_res_225204 = redout_225210;
            
            double x_225238 = defunc_2_reduce_res_225202 *
                   defunc_2_reduce_res_225204;
            double y_225239 = defunc_2_reduce_res_225203 *
                   defunc_2_reduce_res_225203;
            double a12_225240 = x_225238 - y_225239;
            double x_225241 = defunc_2_reduce_res_225202 *
                   defunc_2_reduce_res_225203;
            double y_225242 = defunc_2_reduce_res_225201 *
                   defunc_2_reduce_res_225204;
            double b12_225243 = x_225241 - y_225242;
            double x_225244 = defunc_2_reduce_res_225201 *
                   defunc_2_reduce_res_225203;
            double y_225245 = defunc_2_reduce_res_225202 *
                   defunc_2_reduce_res_225202;
            double c12_225246 = x_225244 - y_225245;
            double x_225247 = defunc_2_reduce_res_225200 *
                   defunc_2_reduce_res_225204;
            double b2_225248 = x_225247 - y_225245;
            double x_225249 = defunc_2_reduce_res_225201 *
                   defunc_2_reduce_res_225202;
            double y_225250 = defunc_2_reduce_res_225200 *
                   defunc_2_reduce_res_225203;
            double c2_225251 = x_225249 - y_225250;
            double x_225252 = defunc_2_reduce_res_225200 * a12_225240;
            double y_225253 = defunc_2_reduce_res_225201 * b12_225243;
            double x_225254 = x_225252 + y_225253;
            double y_225255 = defunc_2_reduce_res_225202 * c12_225246;
            double y_225256 = x_225254 + y_225255;
            double det_225257 = 1.0 / y_225256;
            double a12_225258 = a12_225240 * det_225257;
            double b12_225259 = b12_225243 * det_225257;
            double c12_225260 = c12_225246 * det_225257;
            double b2_225261 = b2_225248 * det_225257;
            double c2_225262 = c2_225251 * det_225257;
            int64_t defunc_0_m_fun_res_225263;
            
            if (cond_225190) {
                defunc_0_m_fun_res_225263 = (int64_t) 0;
            } else {
                int64_t y_225264 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_225265 = i_225185 == y_225264;
                int64_t defunc_0_m_fun_res_f_res_225266;
                
                if (cond_225265) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_225267 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_225266 =
                        defunc_0_m_fun_res_f_res_t_res_225267;
                } else {
                    int64_t x_225268 = sub64(i_225185, (int64_t) 1);
                    int64_t x_225269 = mul64(jump_s_203499, x_225268);
                    int64_t min_arg_225270 = add64((int64_t) 1, x_225269);
                    int64_t min_res_225271 = smin64(defunc_0_f_res_203631,
                                                    min_arg_225270);
                    
                    defunc_0_m_fun_res_f_res_225266 = min_res_225271;
                }
                defunc_0_m_fun_res_225263 = defunc_0_m_fun_res_f_res_225266;
            }
            
            double defunc_2_reduce_res_225272;
            double defunc_2_reduce_res_225273;
            double redout_225275;
            double redout_225276;
            
            redout_225275 = 0.0;
            redout_225276 = 0.0;
            for (int64_t i_225274 = 0; i_225274 < q_s_203493; i_225274++) {
                bool cond_225277 = sle64(x_225043, i_225274);
                int64_t defunc_0_f_res_225278;
                
                if (cond_225277) {
                    defunc_0_f_res_225278 = (int64_t) 0;
                } else {
                    int64_t i_225279 = add64(x_225188, i_225274);
                    int64_t defunc_0_add_arg_225280;
                    
                    defunc_0_add_arg_225280 =
                        ((int64_t *) mem_217536.mem)[gtid_209440 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_225042 *
                                                     defunc_0_f_res_203631 +
                                                     i_225279];
                    
                    int64_t defunc_1_add_res_225281 = add64((int64_t) 1,
                                                            defunc_0_add_arg_225280);
                    
                    defunc_0_f_res_225278 = defunc_1_add_res_225281;
                }
                
                double defunc_0_f_res_225282;
                
                if (cond_225277) {
                    defunc_0_f_res_225282 = 0.0;
                } else {
                    int64_t i_225283 = add64(x_225188, i_225274);
                    double defunc_0_add_arg_225284;
                    
                    defunc_0_add_arg_225284 =
                        ((double *) mem_218057.mem)[gtid_209440 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_225042 *
                                                    defunc_0_f_res_203631 +
                                                    i_225283];
                    defunc_0_f_res_225282 = defunc_0_add_arg_225284;
                }
                
                int64_t binop_p_225285 = sub64(defunc_0_f_res_225278,
                                               defunc_0_m_fun_res_225263);
                double defunc_0_f_res_225286 = sitofp_i64_f64(binop_p_225285);
                double abs_res_225287 = fabs(defunc_0_f_res_225286);
                double tmp1_225288 = abs_res_225287 / x_225189;
                double x_225289 = tmp1_225288 * tmp1_225288;
                double y_225290 = tmp1_225288 * x_225289;
                double tmp2_225291 = 1.0 - y_225290;
                double x_225292 = tmp2_225291 * tmp2_225291;
                double tmp3_225293 = tmp2_225291 * x_225292;
                double tmp4_225294 = defunc_0_f_res_225282 * tmp3_225293;
                double defunc_1_f_res_225295 = defunc_0_f_res_225286 *
                       tmp4_225294;
                double defunc_1_f_res_225296 = defunc_0_f_res_225286 *
                       defunc_1_f_res_225295;
                double defunc_0_f_res_225297;
                
                if (cond_225277) {
                    defunc_0_f_res_225297 = 0.0;
                } else {
                    int64_t i_225298 = add64(x_225188, i_225274);
                    double defunc_0_add_arg_225299;
                    
                    defunc_0_add_arg_225299 =
                        ((double *) mem_218052.mem)[gtid_209440 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_225042 *
                                                    defunc_0_f_res_203631 +
                                                    i_225298];
                    defunc_0_f_res_225297 = defunc_0_add_arg_225299;
                }
                
                double x_225300 = a12_225258 * tmp4_225294;
                double y_225301 = b12_225259 * defunc_1_f_res_225295;
                double x_225302 = x_225300 + y_225301;
                double y_225303 = c12_225260 * defunc_1_f_res_225296;
                double x_225304 = x_225302 + y_225303;
                double defunc_9_fit_fun_res_225305 = defunc_0_f_res_225297 *
                       x_225304;
                double x_225306 = b12_225259 * tmp4_225294;
                double y_225307 = b2_225261 * defunc_1_f_res_225295;
                double x_225308 = x_225306 + y_225307;
                double y_225309 = c2_225262 * defunc_1_f_res_225296;
                double x_225310 = x_225308 + y_225309;
                double defunc_9_slope_fun_res_225311 = defunc_0_f_res_225297 *
                       x_225310;
                double defunc_1_op_res_225312 = defunc_9_fit_fun_res_225305 +
                       redout_225275;
                double defunc_1_op_res_225313 = defunc_9_slope_fun_res_225311 +
                       redout_225276;
                double redout_tmp_225325 = defunc_1_op_res_225312;
                double redout_tmp_225326 = defunc_1_op_res_225313;
                
                redout_225275 = redout_tmp_225325;
                redout_225276 = redout_tmp_225326;
            }
            defunc_2_reduce_res_225272 = redout_225275;
            defunc_2_reduce_res_225273 = redout_225276;
            ((double *) mem_225044)[i_225185] = defunc_2_reduce_res_225272;
            ((double *) mem_225046)[i_225185] = defunc_2_reduce_res_225273;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218315.mem + gtid_225042 * s_n_m_203636 * (int64_t) 8,
                    mem_225044 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218319.mem + gtid_225042 * s_n_m_203636 * (int64_t) 8,
                    mem_225046 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_225044);
    free(mem_225046);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235748_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235748_end -
                 futhark_mc_segmap_parloop_235748_start;
        
        ctx->futhark_mc_segmap_parloop_235748_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235748_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235748_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235746(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225041 = tid;
    int num_tasks_225183 = info.nsubtasks;
    struct futhark_mc_task_235745 *futhark_mc_task_235745 =
                                  (struct futhark_mc_task_235745 *) args;
    struct futhark_context *ctx = futhark_mc_task_235745->ctx;
    uint64_t futhark_mc_segmap_task_235746_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235746_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235745->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235745->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235745->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235745->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235745->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235745->free_s_n_m_203636;
    int64_t gtid_209440 = futhark_mc_task_235745->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235745->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235745->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235745->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235745->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235745->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235745->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235745->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218315 = {.desc ="mem_218315", .mem =
                                  futhark_mc_task_235745->free_mem_218315,
                                  .size =0, .references =NULL};
    struct memblock mem_218319 = {.desc ="mem_218319", .mem =
                                  futhark_mc_task_235745->free_mem_218319,
                                  .size =0, .references =NULL};
    int64_t iter_225184;
    struct futhark_mc_segmap_parloop_struct_235747
    futhark_mc_segmap_parloop_struct_235747;
    
    futhark_mc_segmap_parloop_struct_235747.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235747.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235747.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235747.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235747.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235747.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235747.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235747.free_gtid_209440 = gtid_209440;
    futhark_mc_segmap_parloop_struct_235747.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235747.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235747.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235747.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235747.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235747.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235747.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235747.free_mem_218315 = mem_218315.mem;
    futhark_mc_segmap_parloop_struct_235747.free_mem_218319 = mem_218319.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235748_task;
    
    futhark_mc_segmap_parloop_235748_task.name =
        "futhark_mc_segmap_parloop_235748";
    futhark_mc_segmap_parloop_235748_task.fn = futhark_mc_segmap_parloop_235748;
    futhark_mc_segmap_parloop_235748_task.args =
        &futhark_mc_segmap_parloop_struct_235747;
    futhark_mc_segmap_parloop_235748_task.iterations = iterations;
    futhark_mc_segmap_parloop_235748_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235748_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235748_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235748_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235748_task);
    
    if (futhark_mc_segmap_parloop_235748_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235748_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235748_total_end -
                 futhark_mc_segmap_parloop_235748_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235748_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235748_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235748_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235746_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235746_end -
                 futhark_mc_segmap_task_235746_start;
        
        ctx->futhark_mc_segmap_task_235746_runs[tid]++;
        ctx->futhark_mc_segmap_task_235746_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235746_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235752 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    unsigned char *free_mem_218315;
    unsigned char *free_mem_218319;
};
struct futhark_mc_task_235756 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_224770;
    int64_t free_x_224771;
    unsigned char *free_mem_224772;
    unsigned char *free_mem_224773;
};
struct futhark_mc_segmap_parloop_struct_235758 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_224770;
    int64_t free_x_224771;
    unsigned char *free_mem_224772;
    unsigned char *free_mem_224773;
};
static int futhark_mc_segmap_parloop_235759(void *args, int64_t start,
                                            int64_t end, int flat_tid_225465,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235758
    *futhark_mc_segmap_parloop_struct_235758 =
    (struct futhark_mc_segmap_parloop_struct_235758 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235758->ctx;
    uint64_t futhark_mc_segmap_parloop_235759_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235759_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235758->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235758->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235758->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235758->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235758->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235758->free_s_n_m_203636;
    int64_t gtid_209440 =
            futhark_mc_segmap_parloop_struct_235758->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235758->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235758->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235758->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235758->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235758->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 =
            futhark_mc_segmap_parloop_struct_235758->free_gtid_224770;
    int64_t x_224771 = futhark_mc_segmap_parloop_struct_235758->free_x_224771;
    struct memblock mem_224772 = {.desc ="mem_224772", .mem =
                                  futhark_mc_segmap_parloop_struct_235758->free_mem_224772,
                                  .size =0, .references =NULL};
    struct memblock mem_224773 = {.desc ="mem_224773", .mem =
                                  futhark_mc_segmap_parloop_struct_235758->free_mem_224773,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225596 = start;
    
    for (; iter_225596 < end; iter_225596++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225686 = s_n_m_203636;
        int64_t gtid_225466 = iter_225596;
        int64_t remnant_225687 = iter_225596 - gtid_225466;
        int64_t x_225467;
        
        x_225467 = ((int64_t *) mem_217710.mem)[gtid_209440 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_224770 * s_n_m_203636 +
                                                gtid_225466];
        
        double x_225468;
        
        x_225468 = ((double *) mem_217715.mem)[gtid_209440 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_224770 * s_n_m_203636 +
                                               gtid_225466];
        
        bool cond_225469 = gtid_225466 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_225470;
        
        if (cond_225469) {
            defunc_0_m_fun_res_225470 = (int64_t) 0;
        } else {
            int64_t y_225597 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_225598 = gtid_225466 == y_225597;
            int64_t defunc_0_m_fun_res_f_res_225599;
            
            if (cond_225598) {
                int64_t defunc_0_m_fun_res_f_res_t_res_225600 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_225599 =
                    defunc_0_m_fun_res_f_res_t_res_225600;
            } else {
                int64_t x_225601 = sub64(gtid_225466, (int64_t) 1);
                int64_t x_225602 = mul64(jump_s_203499, x_225601);
                int64_t min_arg_225603 = add64((int64_t) 1, x_225602);
                int64_t min_res_225604 = smin64(defunc_0_f_res_203631,
                                                min_arg_225603);
                
                defunc_0_m_fun_res_f_res_225599 = min_res_225604;
            }
            defunc_0_m_fun_res_225470 = defunc_0_m_fun_res_f_res_225599;
        }
        
        double defunc_2_reduce_res_225479;
        double defunc_2_reduce_res_225480;
        double defunc_2_reduce_res_225481;
        double defunc_2_reduce_res_225482;
        double defunc_2_reduce_res_225483;
        double redout_225606;
        double redout_225607;
        double redout_225608;
        double redout_225609;
        double redout_225610;
        
        redout_225606 = 0.0;
        redout_225607 = 0.0;
        redout_225608 = 0.0;
        redout_225609 = 0.0;
        redout_225610 = 0.0;
        for (int64_t i_225605 = 0; i_225605 < q_s_203493; i_225605++) {
            bool cond_225611 = sle64(x_224771, i_225605);
            int64_t defunc_0_f_res_225612;
            
            if (cond_225611) {
                defunc_0_f_res_225612 = (int64_t) 0;
            } else {
                int64_t i_225613 = add64(x_225467, i_225605);
                int64_t defunc_0_add_arg_225614;
                
                defunc_0_add_arg_225614 =
                    ((int64_t *) mem_217536.mem)[gtid_209440 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_224770 *
                                                 defunc_0_f_res_203631 +
                                                 i_225613];
                
                int64_t defunc_1_add_res_225615 = add64((int64_t) 1,
                                                        defunc_0_add_arg_225614);
                
                defunc_0_f_res_225612 = defunc_1_add_res_225615;
            }
            
            double defunc_0_f_res_225616;
            
            if (cond_225611) {
                defunc_0_f_res_225616 = 0.0;
            } else {
                int64_t i_225617 = add64(x_225467, i_225605);
                double defunc_0_add_arg_225618;
                
                defunc_0_add_arg_225618 =
                    ((double *) mem_218057.mem)[gtid_209440 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_224770 *
                                                defunc_0_f_res_203631 +
                                                i_225617];
                defunc_0_f_res_225616 = defunc_0_add_arg_225618;
            }
            
            int64_t binop_p_225619 = sub64(defunc_0_f_res_225612,
                                           defunc_0_m_fun_res_225470);
            double defunc_0_f_res_225620 = sitofp_i64_f64(binop_p_225619);
            double abs_res_225621 = fabs(defunc_0_f_res_225620);
            double tmp1_225622 = abs_res_225621 / x_225468;
            double x_225623 = tmp1_225622 * tmp1_225622;
            double y_225624 = tmp1_225622 * x_225623;
            double tmp2_225625 = 1.0 - y_225624;
            double x_225626 = tmp2_225625 * tmp2_225625;
            double tmp3_225627 = tmp2_225625 * x_225626;
            double w_j_225628 = defunc_0_f_res_225616 * tmp3_225627;
            double xw_j_225629 = defunc_0_f_res_225620 * w_j_225628;
            double x2w_j_225630 = defunc_0_f_res_225620 * xw_j_225629;
            double x3w_j_225631 = defunc_0_f_res_225620 * x2w_j_225630;
            double x4w_j_225632 = defunc_0_f_res_225620 * x3w_j_225631;
            double defunc_1_op_res_225633 = w_j_225628 + redout_225606;
            double defunc_1_op_res_225634 = xw_j_225629 + redout_225607;
            double defunc_1_op_res_225635 = x2w_j_225630 + redout_225608;
            double defunc_1_op_res_225636 = x3w_j_225631 + redout_225609;
            double defunc_1_op_res_225637 = x4w_j_225632 + redout_225610;
            double redout_tmp_225688 = defunc_1_op_res_225633;
            double redout_tmp_225689 = defunc_1_op_res_225634;
            double redout_tmp_225690 = defunc_1_op_res_225635;
            double redout_tmp_225691 = defunc_1_op_res_225636;
            double redout_tmp_225692 = defunc_1_op_res_225637;
            
            redout_225606 = redout_tmp_225688;
            redout_225607 = redout_tmp_225689;
            redout_225608 = redout_tmp_225690;
            redout_225609 = redout_tmp_225691;
            redout_225610 = redout_tmp_225692;
        }
        defunc_2_reduce_res_225479 = redout_225606;
        defunc_2_reduce_res_225480 = redout_225607;
        defunc_2_reduce_res_225481 = redout_225608;
        defunc_2_reduce_res_225482 = redout_225609;
        defunc_2_reduce_res_225483 = redout_225610;
        
        double x_225517 = defunc_2_reduce_res_225481 *
               defunc_2_reduce_res_225483;
        double y_225518 = defunc_2_reduce_res_225482 *
               defunc_2_reduce_res_225482;
        double a12_225519 = x_225517 - y_225518;
        double x_225520 = defunc_2_reduce_res_225481 *
               defunc_2_reduce_res_225482;
        double y_225521 = defunc_2_reduce_res_225480 *
               defunc_2_reduce_res_225483;
        double b12_225522 = x_225520 - y_225521;
        double x_225523 = defunc_2_reduce_res_225480 *
               defunc_2_reduce_res_225482;
        double y_225524 = defunc_2_reduce_res_225481 *
               defunc_2_reduce_res_225481;
        double c12_225525 = x_225523 - y_225524;
        double x_225526 = defunc_2_reduce_res_225479 *
               defunc_2_reduce_res_225483;
        double b2_225527 = x_225526 - y_225524;
        double x_225528 = defunc_2_reduce_res_225480 *
               defunc_2_reduce_res_225481;
        double y_225529 = defunc_2_reduce_res_225479 *
               defunc_2_reduce_res_225482;
        double c2_225530 = x_225528 - y_225529;
        double x_225531 = defunc_2_reduce_res_225479 * a12_225519;
        double y_225532 = defunc_2_reduce_res_225480 * b12_225522;
        double x_225533 = x_225531 + y_225532;
        double y_225534 = defunc_2_reduce_res_225481 * c12_225525;
        double y_225535 = x_225533 + y_225534;
        double det_225536 = 1.0 / y_225535;
        double a12_225537 = a12_225519 * det_225536;
        double b12_225538 = b12_225522 * det_225536;
        double c12_225539 = c12_225525 * det_225536;
        double b2_225540 = b2_225527 * det_225536;
        double c2_225541 = c2_225530 * det_225536;
        int64_t defunc_0_m_fun_res_225542;
        
        if (cond_225469) {
            defunc_0_m_fun_res_225542 = (int64_t) 0;
        } else {
            int64_t y_225638 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_225639 = gtid_225466 == y_225638;
            int64_t defunc_0_m_fun_res_f_res_225640;
            
            if (cond_225639) {
                int64_t defunc_0_m_fun_res_f_res_t_res_225641 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_225640 =
                    defunc_0_m_fun_res_f_res_t_res_225641;
            } else {
                int64_t x_225642 = sub64(gtid_225466, (int64_t) 1);
                int64_t x_225643 = mul64(jump_s_203499, x_225642);
                int64_t min_arg_225644 = add64((int64_t) 1, x_225643);
                int64_t min_res_225645 = smin64(defunc_0_f_res_203631,
                                                min_arg_225644);
                
                defunc_0_m_fun_res_f_res_225640 = min_res_225645;
            }
            defunc_0_m_fun_res_225542 = defunc_0_m_fun_res_f_res_225640;
        }
        
        double defunc_2_reduce_res_225551;
        double defunc_2_reduce_res_225552;
        double redout_225647;
        double redout_225648;
        
        redout_225647 = 0.0;
        redout_225648 = 0.0;
        for (int64_t i_225646 = 0; i_225646 < q_s_203493; i_225646++) {
            bool cond_225649 = sle64(x_224771, i_225646);
            int64_t defunc_0_f_res_225650;
            
            if (cond_225649) {
                defunc_0_f_res_225650 = (int64_t) 0;
            } else {
                int64_t i_225651 = add64(x_225467, i_225646);
                int64_t defunc_0_add_arg_225652;
                
                defunc_0_add_arg_225652 =
                    ((int64_t *) mem_217536.mem)[gtid_209440 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_224770 *
                                                 defunc_0_f_res_203631 +
                                                 i_225651];
                
                int64_t defunc_1_add_res_225653 = add64((int64_t) 1,
                                                        defunc_0_add_arg_225652);
                
                defunc_0_f_res_225650 = defunc_1_add_res_225653;
            }
            
            double defunc_0_f_res_225654;
            
            if (cond_225649) {
                defunc_0_f_res_225654 = 0.0;
            } else {
                int64_t i_225655 = add64(x_225467, i_225646);
                double defunc_0_add_arg_225656;
                
                defunc_0_add_arg_225656 =
                    ((double *) mem_218057.mem)[gtid_209440 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_224770 *
                                                defunc_0_f_res_203631 +
                                                i_225655];
                defunc_0_f_res_225654 = defunc_0_add_arg_225656;
            }
            
            int64_t binop_p_225657 = sub64(defunc_0_f_res_225650,
                                           defunc_0_m_fun_res_225542);
            double defunc_0_f_res_225658 = sitofp_i64_f64(binop_p_225657);
            double abs_res_225659 = fabs(defunc_0_f_res_225658);
            double tmp1_225660 = abs_res_225659 / x_225468;
            double x_225661 = tmp1_225660 * tmp1_225660;
            double y_225662 = tmp1_225660 * x_225661;
            double tmp2_225663 = 1.0 - y_225662;
            double x_225664 = tmp2_225663 * tmp2_225663;
            double tmp3_225665 = tmp2_225663 * x_225664;
            double tmp4_225666 = defunc_0_f_res_225654 * tmp3_225665;
            double defunc_1_f_res_225667 = defunc_0_f_res_225658 * tmp4_225666;
            double defunc_1_f_res_225668 = defunc_0_f_res_225658 *
                   defunc_1_f_res_225667;
            double defunc_0_f_res_225669;
            
            if (cond_225649) {
                defunc_0_f_res_225669 = 0.0;
            } else {
                int64_t i_225670 = add64(x_225467, i_225646);
                double defunc_0_add_arg_225671;
                
                defunc_0_add_arg_225671 =
                    ((double *) mem_218052.mem)[gtid_209440 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_224770 *
                                                defunc_0_f_res_203631 +
                                                i_225670];
                defunc_0_f_res_225669 = defunc_0_add_arg_225671;
            }
            
            double x_225672 = a12_225537 * tmp4_225666;
            double y_225673 = b12_225538 * defunc_1_f_res_225667;
            double x_225674 = x_225672 + y_225673;
            double y_225675 = c12_225539 * defunc_1_f_res_225668;
            double x_225676 = x_225674 + y_225675;
            double defunc_9_fit_fun_res_225677 = defunc_0_f_res_225669 *
                   x_225676;
            double x_225678 = b12_225538 * tmp4_225666;
            double y_225679 = b2_225540 * defunc_1_f_res_225667;
            double x_225680 = x_225678 + y_225679;
            double y_225681 = c2_225541 * defunc_1_f_res_225668;
            double x_225682 = x_225680 + y_225681;
            double defunc_9_slope_fun_res_225683 = defunc_0_f_res_225669 *
                   x_225682;
            double defunc_1_op_res_225684 = defunc_9_fit_fun_res_225677 +
                   redout_225647;
            double defunc_1_op_res_225685 = defunc_9_slope_fun_res_225683 +
                   redout_225648;
            double redout_tmp_225693 = defunc_1_op_res_225684;
            double redout_tmp_225694 = defunc_1_op_res_225685;
            
            redout_225647 = redout_tmp_225693;
            redout_225648 = redout_tmp_225694;
        }
        defunc_2_reduce_res_225551 = redout_225647;
        defunc_2_reduce_res_225552 = redout_225648;
        ((double *) mem_224772.mem)[gtid_225466] = defunc_2_reduce_res_225551;
        ((double *) mem_224773.mem)[gtid_225466] = defunc_2_reduce_res_225552;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235759_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235759_end -
                 futhark_mc_segmap_parloop_235759_start;
        
        ctx->futhark_mc_segmap_parloop_235759_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235759_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235759_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235757(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225465 = tid;
    int num_tasks_225595 = info.nsubtasks;
    struct futhark_mc_task_235756 *futhark_mc_task_235756 =
                                  (struct futhark_mc_task_235756 *) args;
    struct futhark_context *ctx = futhark_mc_task_235756->ctx;
    uint64_t futhark_mc_segmap_task_235757_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235757_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235756->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235756->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235756->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235756->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235756->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235756->free_s_n_m_203636;
    int64_t gtid_209440 = futhark_mc_task_235756->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235756->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235756->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235756->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235756->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235756->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 = futhark_mc_task_235756->free_gtid_224770;
    int64_t x_224771 = futhark_mc_task_235756->free_x_224771;
    struct memblock mem_224772 = {.desc ="mem_224772", .mem =
                                  futhark_mc_task_235756->free_mem_224772,
                                  .size =0, .references =NULL};
    struct memblock mem_224773 = {.desc ="mem_224773", .mem =
                                  futhark_mc_task_235756->free_mem_224773,
                                  .size =0, .references =NULL};
    int64_t iter_225596;
    struct futhark_mc_segmap_parloop_struct_235758
    futhark_mc_segmap_parloop_struct_235758;
    
    futhark_mc_segmap_parloop_struct_235758.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235758.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235758.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235758.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235758.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235758.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235758.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235758.free_gtid_209440 = gtid_209440;
    futhark_mc_segmap_parloop_struct_235758.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235758.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235758.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235758.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235758.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235758.free_gtid_224770 = gtid_224770;
    futhark_mc_segmap_parloop_struct_235758.free_x_224771 = x_224771;
    futhark_mc_segmap_parloop_struct_235758.free_mem_224772 = mem_224772.mem;
    futhark_mc_segmap_parloop_struct_235758.free_mem_224773 = mem_224773.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235759_task;
    
    futhark_mc_segmap_parloop_235759_task.name =
        "futhark_mc_segmap_parloop_235759";
    futhark_mc_segmap_parloop_235759_task.fn = futhark_mc_segmap_parloop_235759;
    futhark_mc_segmap_parloop_235759_task.args =
        &futhark_mc_segmap_parloop_struct_235758;
    futhark_mc_segmap_parloop_235759_task.iterations = iterations;
    futhark_mc_segmap_parloop_235759_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235759_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235759_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235759_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235759_task);
    
    if (futhark_mc_segmap_parloop_235759_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235759_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235759_total_end -
                 futhark_mc_segmap_parloop_235759_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235759_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235759_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235759_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235757_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235757_end -
                 futhark_mc_segmap_task_235757_start;
        
        ctx->futhark_mc_segmap_task_235757_runs[tid]++;
        ctx->futhark_mc_segmap_task_235757_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235757_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235761 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_224770;
    int64_t free_x_224771;
    unsigned char *free_mem_224772;
    unsigned char *free_mem_224773;
};
struct futhark_mc_task_235763 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_224770;
    int64_t free_x_224771;
    int64_t free_x_225330;
    double free_x_225331;
    int64_t free_defunc_0_m_fun_res_225333;
    double *retval_defunc_2_reduce_res_225342;
    double *retval_defunc_2_reduce_res_225343;
    double *retval_defunc_2_reduce_res_225344;
    double *retval_defunc_2_reduce_res_225345;
    double *retval_defunc_2_reduce_res_225346;
};
struct futhark_mc_segred_stage_1_parloop_struct_235770 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_224770;
    int64_t free_x_224771;
    int64_t free_x_225330;
    double free_x_225331;
    int64_t free_defunc_0_m_fun_res_225333;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225797;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225799;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225801;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225803;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225805;
};
static int futhark_mc_segred_stage_1_parloop_235771(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_225704,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235770
    *futhark_mc_segred_stage_1_parloop_struct_235770 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235770 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235770->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235771_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235771_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235770->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235770->free_defunc_0_f_res_203631;
    int64_t gtid_209440 =
            futhark_mc_segred_stage_1_parloop_struct_235770->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235770->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235770->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 =
            futhark_mc_segred_stage_1_parloop_struct_235770->free_gtid_224770;
    int64_t x_224771 =
            futhark_mc_segred_stage_1_parloop_struct_235770->free_x_224771;
    int64_t x_225330 =
            futhark_mc_segred_stage_1_parloop_struct_235770->free_x_225330;
    double x_225331 =
           futhark_mc_segred_stage_1_parloop_struct_235770->free_x_225331;
    int64_t defunc_0_m_fun_res_225333 =
            futhark_mc_segred_stage_1_parloop_struct_235770->free_defunc_0_m_fun_res_225333;
    struct memblock reduce_stage_1_tid_res_arr_mem_225797 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225797",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235770->free_reduce_stage_1_tid_res_arr_mem_225797,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225799 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225799",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235770->free_reduce_stage_1_tid_res_arr_mem_225799,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225801 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225801",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235770->free_reduce_stage_1_tid_res_arr_mem_225801,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225803 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225803",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235770->free_reduce_stage_1_tid_res_arr_mem_225803,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225805 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225805",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235770->free_reduce_stage_1_tid_res_arr_mem_225805,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225807 = start;
    double x_225706;
    double x_225707;
    double x_225709;
    double x_225710;
    double x_225712;
    double x_225713;
    double x_225715;
    double x_225716;
    double x_225718;
    double x_225719;
    double local_acc_225808 = 0.0;
    double local_acc_225809 = 0.0;
    double local_acc_225810 = 0.0;
    double local_acc_225811 = 0.0;
    double local_acc_225812 = 0.0;
    
    for (; iter_225807 < end; iter_225807++) {
        int64_t gtid_225705 = iter_225807;
        bool cond_225721 = sle64(x_224771, gtid_225705);
        int64_t defunc_0_f_res_225722;
        
        if (cond_225721) {
            defunc_0_f_res_225722 = (int64_t) 0;
        } else {
            int64_t i_225723 = add64(x_225330, gtid_225705);
            int64_t defunc_0_add_arg_225724;
            
            defunc_0_add_arg_225724 = ((int64_t *) mem_217536.mem)[gtid_209440 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_224770 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_225723];
            
            int64_t defunc_1_add_res_225725 = add64((int64_t) 1,
                                                    defunc_0_add_arg_225724);
            
            defunc_0_f_res_225722 = defunc_1_add_res_225725;
        }
        
        double defunc_0_f_res_225726;
        
        if (cond_225721) {
            defunc_0_f_res_225726 = 0.0;
        } else {
            int64_t i_225727 = add64(x_225330, gtid_225705);
            double defunc_0_add_arg_225728;
            
            defunc_0_add_arg_225728 = ((double *) mem_218057.mem)[gtid_209440 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_224770 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_225727];
            defunc_0_f_res_225726 = defunc_0_add_arg_225728;
        }
        
        int64_t binop_p_225729 = sub64(defunc_0_f_res_225722,
                                       defunc_0_m_fun_res_225333);
        double defunc_0_f_res_225730 = sitofp_i64_f64(binop_p_225729);
        double abs_res_225731 = fabs(defunc_0_f_res_225730);
        double tmp1_225732 = abs_res_225731 / x_225331;
        double x_225733 = tmp1_225732 * tmp1_225732;
        double y_225734 = tmp1_225732 * x_225733;
        double tmp2_225735 = 1.0 - y_225734;
        double x_225736 = tmp2_225735 * tmp2_225735;
        double tmp3_225737 = tmp2_225735 * x_225736;
        double w_j_225738 = defunc_0_f_res_225726 * tmp3_225737;
        double xw_j_225739 = defunc_0_f_res_225730 * w_j_225738;
        double x2w_j_225740 = defunc_0_f_res_225730 * xw_j_225739;
        double x3w_j_225741 = defunc_0_f_res_225730 * x2w_j_225740;
        double x4w_j_225742 = defunc_0_f_res_225730 * x3w_j_225741;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_225706 = local_acc_225808;
        }
        // Load next params
        {
            x_225707 = w_j_225738;
        }
        // Red body
        {
            double defunc_1_op_res_225708 = x_225706 + x_225707;
            
            local_acc_225808 = defunc_1_op_res_225708;
        }
        // Load accum params
        {
            x_225709 = local_acc_225809;
        }
        // Load next params
        {
            x_225710 = xw_j_225739;
        }
        // Red body
        {
            double defunc_1_op_res_225711 = x_225709 + x_225710;
            
            local_acc_225809 = defunc_1_op_res_225711;
        }
        // Load accum params
        {
            x_225712 = local_acc_225810;
        }
        // Load next params
        {
            x_225713 = x2w_j_225740;
        }
        // Red body
        {
            double defunc_1_op_res_225714 = x_225712 + x_225713;
            
            local_acc_225810 = defunc_1_op_res_225714;
        }
        // Load accum params
        {
            x_225715 = local_acc_225811;
        }
        // Load next params
        {
            x_225716 = x3w_j_225741;
        }
        // Red body
        {
            double defunc_1_op_res_225717 = x_225715 + x_225716;
            
            local_acc_225811 = defunc_1_op_res_225717;
        }
        // Load accum params
        {
            x_225718 = local_acc_225812;
        }
        // Load next params
        {
            x_225719 = x4w_j_225742;
        }
        // Red body
        {
            double defunc_1_op_res_225720 = x_225718 + x_225719;
            
            local_acc_225812 = defunc_1_op_res_225720;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_225797.mem)[flat_tid_225704] =
        local_acc_225808;
    ((double *) reduce_stage_1_tid_res_arr_mem_225799.mem)[flat_tid_225704] =
        local_acc_225809;
    ((double *) reduce_stage_1_tid_res_arr_mem_225801.mem)[flat_tid_225704] =
        local_acc_225810;
    ((double *) reduce_stage_1_tid_res_arr_mem_225803.mem)[flat_tid_225704] =
        local_acc_225811;
    ((double *) reduce_stage_1_tid_res_arr_mem_225805.mem)[flat_tid_225704] =
        local_acc_225812;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235771_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235771_end -
                 futhark_mc_segred_stage_1_parloop_235771_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235771_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235771_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235771_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235764(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225704 = tid;
    int num_tasks_225796 = info.nsubtasks;
    struct futhark_mc_task_235763 *futhark_mc_task_235763 =
                                  (struct futhark_mc_task_235763 *) args;
    struct futhark_context *ctx = futhark_mc_task_235763->ctx;
    uint64_t futhark_mc_segred_task_235764_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235764_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235763->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235763->free_defunc_0_f_res_203631;
    int64_t gtid_209440 = futhark_mc_task_235763->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235763->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235763->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 = futhark_mc_task_235763->free_gtid_224770;
    int64_t x_224771 = futhark_mc_task_235763->free_x_224771;
    int64_t x_225330 = futhark_mc_task_235763->free_x_225330;
    double x_225331 = futhark_mc_task_235763->free_x_225331;
    int64_t defunc_0_m_fun_res_225333 =
            futhark_mc_task_235763->free_defunc_0_m_fun_res_225333;
    double defunc_2_reduce_res_225342 =
           *futhark_mc_task_235763->retval_defunc_2_reduce_res_225342;
    double defunc_2_reduce_res_225343 =
           *futhark_mc_task_235763->retval_defunc_2_reduce_res_225343;
    double defunc_2_reduce_res_225344 =
           *futhark_mc_task_235763->retval_defunc_2_reduce_res_225344;
    double defunc_2_reduce_res_225345 =
           *futhark_mc_task_235763->retval_defunc_2_reduce_res_225345;
    double defunc_2_reduce_res_225346 =
           *futhark_mc_task_235763->retval_defunc_2_reduce_res_225346;
    size_t reduce_stage_1_tid_res_arr_mem_225797_cached_sizze_235765 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225797 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225799_cached_sizze_235766 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225799 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225801_cached_sizze_235767 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225801 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225803_cached_sizze_235768 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225803 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225805_cached_sizze_235769 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225805 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_225797_cached_sizze_235765 <
        (size_t) ((int64_t) 8 * num_tasks_225796)) {
        reduce_stage_1_tid_res_arr_mem_225797 =
            realloc(reduce_stage_1_tid_res_arr_mem_225797, (int64_t) 8 *
                    num_tasks_225796);
        reduce_stage_1_tid_res_arr_mem_225797_cached_sizze_235765 =
            (int64_t) 8 * num_tasks_225796;
    }
    if (reduce_stage_1_tid_res_arr_mem_225799_cached_sizze_235766 <
        (size_t) ((int64_t) 8 * num_tasks_225796)) {
        reduce_stage_1_tid_res_arr_mem_225799 =
            realloc(reduce_stage_1_tid_res_arr_mem_225799, (int64_t) 8 *
                    num_tasks_225796);
        reduce_stage_1_tid_res_arr_mem_225799_cached_sizze_235766 =
            (int64_t) 8 * num_tasks_225796;
    }
    if (reduce_stage_1_tid_res_arr_mem_225801_cached_sizze_235767 <
        (size_t) ((int64_t) 8 * num_tasks_225796)) {
        reduce_stage_1_tid_res_arr_mem_225801 =
            realloc(reduce_stage_1_tid_res_arr_mem_225801, (int64_t) 8 *
                    num_tasks_225796);
        reduce_stage_1_tid_res_arr_mem_225801_cached_sizze_235767 =
            (int64_t) 8 * num_tasks_225796;
    }
    if (reduce_stage_1_tid_res_arr_mem_225803_cached_sizze_235768 <
        (size_t) ((int64_t) 8 * num_tasks_225796)) {
        reduce_stage_1_tid_res_arr_mem_225803 =
            realloc(reduce_stage_1_tid_res_arr_mem_225803, (int64_t) 8 *
                    num_tasks_225796);
        reduce_stage_1_tid_res_arr_mem_225803_cached_sizze_235768 =
            (int64_t) 8 * num_tasks_225796;
    }
    if (reduce_stage_1_tid_res_arr_mem_225805_cached_sizze_235769 <
        (size_t) ((int64_t) 8 * num_tasks_225796)) {
        reduce_stage_1_tid_res_arr_mem_225805 =
            realloc(reduce_stage_1_tid_res_arr_mem_225805, (int64_t) 8 *
                    num_tasks_225796);
        reduce_stage_1_tid_res_arr_mem_225805_cached_sizze_235769 =
            (int64_t) 8 * num_tasks_225796;
    }
    
    int64_t iter_225807;
    struct futhark_mc_segred_stage_1_parloop_struct_235770
    futhark_mc_segred_stage_1_parloop_struct_235770;
    
    futhark_mc_segred_stage_1_parloop_struct_235770.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_gtid_209440 =
        gtid_209440;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_gtid_224770 =
        gtid_224770;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_x_224771 = x_224771;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_x_225330 = x_225330;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_x_225331 = x_225331;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_defunc_0_m_fun_res_225333 =
        defunc_0_m_fun_res_225333;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_reduce_stage_1_tid_res_arr_mem_225797 =
        reduce_stage_1_tid_res_arr_mem_225797;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_reduce_stage_1_tid_res_arr_mem_225799 =
        reduce_stage_1_tid_res_arr_mem_225799;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_reduce_stage_1_tid_res_arr_mem_225801 =
        reduce_stage_1_tid_res_arr_mem_225801;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_reduce_stage_1_tid_res_arr_mem_225803 =
        reduce_stage_1_tid_res_arr_mem_225803;
    futhark_mc_segred_stage_1_parloop_struct_235770.free_reduce_stage_1_tid_res_arr_mem_225805 =
        reduce_stage_1_tid_res_arr_mem_225805;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235771_task;
    
    futhark_mc_segred_stage_1_parloop_235771_task.name =
        "futhark_mc_segred_stage_1_parloop_235771";
    futhark_mc_segred_stage_1_parloop_235771_task.fn =
        futhark_mc_segred_stage_1_parloop_235771;
    futhark_mc_segred_stage_1_parloop_235771_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235770;
    futhark_mc_segred_stage_1_parloop_235771_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235771_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235771_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235771_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235771_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235771_task);
    
    if (futhark_mc_segred_stage_1_parloop_235771_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235771_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235771_total_end -
                 futhark_mc_segred_stage_1_parloop_235771_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235771_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235771_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235771_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_225342 = 0.0;
        defunc_2_reduce_res_225343 = 0.0;
        defunc_2_reduce_res_225344 = 0.0;
        defunc_2_reduce_res_225345 = 0.0;
        defunc_2_reduce_res_225346 = 0.0;
    }
    
    double x_225813;
    double x_225814;
    double x_225816;
    double x_225817;
    double x_225819;
    double x_225820;
    double x_225822;
    double x_225823;
    double x_225825;
    double x_225826;
    
    for (int32_t i_225828 = 0; i_225828 < num_tasks_225796; i_225828++) {
        flat_tid_225704 = i_225828;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_225813 = defunc_2_reduce_res_225342;
            }
            // load next params
            {
                x_225814 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225797)[flat_tid_225704];
            }
            // red body
            {
                double defunc_1_op_res_225815 = x_225813 + x_225814;
                
                defunc_2_reduce_res_225342 = defunc_1_op_res_225815;
            }
            // load acc params
            {
                x_225816 = defunc_2_reduce_res_225343;
            }
            // load next params
            {
                x_225817 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225799)[flat_tid_225704];
            }
            // red body
            {
                double defunc_1_op_res_225818 = x_225816 + x_225817;
                
                defunc_2_reduce_res_225343 = defunc_1_op_res_225818;
            }
            // load acc params
            {
                x_225819 = defunc_2_reduce_res_225344;
            }
            // load next params
            {
                x_225820 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225801)[flat_tid_225704];
            }
            // red body
            {
                double defunc_1_op_res_225821 = x_225819 + x_225820;
                
                defunc_2_reduce_res_225344 = defunc_1_op_res_225821;
            }
            // load acc params
            {
                x_225822 = defunc_2_reduce_res_225345;
            }
            // load next params
            {
                x_225823 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225803)[flat_tid_225704];
            }
            // red body
            {
                double defunc_1_op_res_225824 = x_225822 + x_225823;
                
                defunc_2_reduce_res_225345 = defunc_1_op_res_225824;
            }
            // load acc params
            {
                x_225825 = defunc_2_reduce_res_225346;
            }
            // load next params
            {
                x_225826 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225805)[flat_tid_225704];
            }
            // red body
            {
                double defunc_1_op_res_225827 = x_225825 + x_225826;
                
                defunc_2_reduce_res_225346 = defunc_1_op_res_225827;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_225797);
        free(reduce_stage_1_tid_res_arr_mem_225799);
        free(reduce_stage_1_tid_res_arr_mem_225801);
        free(reduce_stage_1_tid_res_arr_mem_225803);
        free(reduce_stage_1_tid_res_arr_mem_225805);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235764_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235764_end -
                 futhark_mc_segred_task_235764_start;
        
        ctx->futhark_mc_segred_task_235764_runs[tid]++;
        ctx->futhark_mc_segred_task_235764_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235764_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235763->retval_defunc_2_reduce_res_225342 =
            defunc_2_reduce_res_225342;
        *futhark_mc_task_235763->retval_defunc_2_reduce_res_225343 =
            defunc_2_reduce_res_225343;
        *futhark_mc_task_235763->retval_defunc_2_reduce_res_225344 =
            defunc_2_reduce_res_225344;
        *futhark_mc_task_235763->retval_defunc_2_reduce_res_225345 =
            defunc_2_reduce_res_225345;
        *futhark_mc_task_235763->retval_defunc_2_reduce_res_225346 =
            defunc_2_reduce_res_225346;
    }
    return err;
}
struct futhark_mc_task_235772 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_224770;
    int64_t free_x_224771;
    int64_t free_x_225330;
    double free_x_225331;
    double free_a12_225406;
    double free_b12_225407;
    double free_c12_225408;
    double free_b2_225409;
    double free_c2_225410;
    int64_t free_defunc_0_m_fun_res_225411;
    double *retval_defunc_2_reduce_res_225420;
    double *retval_defunc_2_reduce_res_225421;
};
struct futhark_mc_segred_stage_1_parloop_struct_235776 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_209440;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_gtid_224770;
    int64_t free_x_224771;
    int64_t free_x_225330;
    double free_x_225331;
    double free_a12_225406;
    double free_b12_225407;
    double free_c12_225408;
    double free_b2_225409;
    double free_c2_225410;
    int64_t free_defunc_0_m_fun_res_225411;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225830;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225832;
};
static int futhark_mc_segred_stage_1_parloop_235777(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_225751,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235776
    *futhark_mc_segred_stage_1_parloop_struct_235776 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235776 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235776->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235777_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235777_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235776->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235776->free_defunc_0_f_res_203631;
    int64_t gtid_209440 =
            futhark_mc_segred_stage_1_parloop_struct_235776->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235776->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235776->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235776->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 =
            futhark_mc_segred_stage_1_parloop_struct_235776->free_gtid_224770;
    int64_t x_224771 =
            futhark_mc_segred_stage_1_parloop_struct_235776->free_x_224771;
    int64_t x_225330 =
            futhark_mc_segred_stage_1_parloop_struct_235776->free_x_225330;
    double x_225331 =
           futhark_mc_segred_stage_1_parloop_struct_235776->free_x_225331;
    double a12_225406 =
           futhark_mc_segred_stage_1_parloop_struct_235776->free_a12_225406;
    double b12_225407 =
           futhark_mc_segred_stage_1_parloop_struct_235776->free_b12_225407;
    double c12_225408 =
           futhark_mc_segred_stage_1_parloop_struct_235776->free_c12_225408;
    double b2_225409 =
           futhark_mc_segred_stage_1_parloop_struct_235776->free_b2_225409;
    double c2_225410 =
           futhark_mc_segred_stage_1_parloop_struct_235776->free_c2_225410;
    int64_t defunc_0_m_fun_res_225411 =
            futhark_mc_segred_stage_1_parloop_struct_235776->free_defunc_0_m_fun_res_225411;
    struct memblock reduce_stage_1_tid_res_arr_mem_225830 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225830",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235776->free_reduce_stage_1_tid_res_arr_mem_225830,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225832 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225832",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235776->free_reduce_stage_1_tid_res_arr_mem_225832,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225834 = start;
    double x_225753;
    double x_225754;
    double x_225756;
    double x_225757;
    double local_acc_225835 = 0.0;
    double local_acc_225836 = 0.0;
    
    for (; iter_225834 < end; iter_225834++) {
        int64_t gtid_225752 = iter_225834;
        bool cond_225759 = sle64(x_224771, gtid_225752);
        int64_t defunc_0_f_res_225760;
        
        if (cond_225759) {
            defunc_0_f_res_225760 = (int64_t) 0;
        } else {
            int64_t i_225761 = add64(x_225330, gtid_225752);
            int64_t defunc_0_add_arg_225762;
            
            defunc_0_add_arg_225762 = ((int64_t *) mem_217536.mem)[gtid_209440 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_224770 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_225761];
            
            int64_t defunc_1_add_res_225763 = add64((int64_t) 1,
                                                    defunc_0_add_arg_225762);
            
            defunc_0_f_res_225760 = defunc_1_add_res_225763;
        }
        
        double defunc_0_f_res_225764;
        
        if (cond_225759) {
            defunc_0_f_res_225764 = 0.0;
        } else {
            int64_t i_225765 = add64(x_225330, gtid_225752);
            double defunc_0_add_arg_225766;
            
            defunc_0_add_arg_225766 = ((double *) mem_218057.mem)[gtid_209440 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_224770 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_225765];
            defunc_0_f_res_225764 = defunc_0_add_arg_225766;
        }
        
        int64_t binop_p_225767 = sub64(defunc_0_f_res_225760,
                                       defunc_0_m_fun_res_225411);
        double defunc_0_f_res_225768 = sitofp_i64_f64(binop_p_225767);
        double abs_res_225769 = fabs(defunc_0_f_res_225768);
        double tmp1_225770 = abs_res_225769 / x_225331;
        double x_225771 = tmp1_225770 * tmp1_225770;
        double y_225772 = tmp1_225770 * x_225771;
        double tmp2_225773 = 1.0 - y_225772;
        double x_225774 = tmp2_225773 * tmp2_225773;
        double tmp3_225775 = tmp2_225773 * x_225774;
        double tmp4_225776 = defunc_0_f_res_225764 * tmp3_225775;
        double defunc_1_f_res_225777 = defunc_0_f_res_225768 * tmp4_225776;
        double defunc_1_f_res_225778 = defunc_0_f_res_225768 *
               defunc_1_f_res_225777;
        double defunc_0_f_res_225779;
        
        if (cond_225759) {
            defunc_0_f_res_225779 = 0.0;
        } else {
            int64_t i_225780 = add64(x_225330, gtid_225752);
            double defunc_0_add_arg_225781;
            
            defunc_0_add_arg_225781 = ((double *) mem_218052.mem)[gtid_209440 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_224770 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_225780];
            defunc_0_f_res_225779 = defunc_0_add_arg_225781;
        }
        
        double x_225782 = a12_225406 * tmp4_225776;
        double y_225783 = b12_225407 * defunc_1_f_res_225777;
        double x_225784 = x_225782 + y_225783;
        double y_225785 = c12_225408 * defunc_1_f_res_225778;
        double x_225786 = x_225784 + y_225785;
        double defunc_9_fit_fun_res_225787 = defunc_0_f_res_225779 * x_225786;
        double x_225788 = b12_225407 * tmp4_225776;
        double y_225789 = b2_225409 * defunc_1_f_res_225777;
        double x_225790 = x_225788 + y_225789;
        double y_225791 = c2_225410 * defunc_1_f_res_225778;
        double x_225792 = x_225790 + y_225791;
        double defunc_9_slope_fun_res_225793 = defunc_0_f_res_225779 * x_225792;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_225753 = local_acc_225835;
        }
        // Load next params
        {
            x_225754 = defunc_9_fit_fun_res_225787;
        }
        // Red body
        {
            double defunc_1_op_res_225755 = x_225753 + x_225754;
            
            local_acc_225835 = defunc_1_op_res_225755;
        }
        // Load accum params
        {
            x_225756 = local_acc_225836;
        }
        // Load next params
        {
            x_225757 = defunc_9_slope_fun_res_225793;
        }
        // Red body
        {
            double defunc_1_op_res_225758 = x_225756 + x_225757;
            
            local_acc_225836 = defunc_1_op_res_225758;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_225830.mem)[flat_tid_225751] =
        local_acc_225835;
    ((double *) reduce_stage_1_tid_res_arr_mem_225832.mem)[flat_tid_225751] =
        local_acc_225836;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235777_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235777_end -
                 futhark_mc_segred_stage_1_parloop_235777_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235777_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235777_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235777_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235773(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225751 = tid;
    int num_tasks_225829 = info.nsubtasks;
    struct futhark_mc_task_235772 *futhark_mc_task_235772 =
                                  (struct futhark_mc_task_235772 *) args;
    struct futhark_context *ctx = futhark_mc_task_235772->ctx;
    uint64_t futhark_mc_segred_task_235773_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235773_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235772->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235772->free_defunc_0_f_res_203631;
    int64_t gtid_209440 = futhark_mc_task_235772->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235772->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235772->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235772->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 = futhark_mc_task_235772->free_gtid_224770;
    int64_t x_224771 = futhark_mc_task_235772->free_x_224771;
    int64_t x_225330 = futhark_mc_task_235772->free_x_225330;
    double x_225331 = futhark_mc_task_235772->free_x_225331;
    double a12_225406 = futhark_mc_task_235772->free_a12_225406;
    double b12_225407 = futhark_mc_task_235772->free_b12_225407;
    double c12_225408 = futhark_mc_task_235772->free_c12_225408;
    double b2_225409 = futhark_mc_task_235772->free_b2_225409;
    double c2_225410 = futhark_mc_task_235772->free_c2_225410;
    int64_t defunc_0_m_fun_res_225411 =
            futhark_mc_task_235772->free_defunc_0_m_fun_res_225411;
    double defunc_2_reduce_res_225420 =
           *futhark_mc_task_235772->retval_defunc_2_reduce_res_225420;
    double defunc_2_reduce_res_225421 =
           *futhark_mc_task_235772->retval_defunc_2_reduce_res_225421;
    size_t reduce_stage_1_tid_res_arr_mem_225830_cached_sizze_235774 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225830 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225832_cached_sizze_235775 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225832 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_225830_cached_sizze_235774 <
        (size_t) ((int64_t) 8 * num_tasks_225829)) {
        reduce_stage_1_tid_res_arr_mem_225830 =
            realloc(reduce_stage_1_tid_res_arr_mem_225830, (int64_t) 8 *
                    num_tasks_225829);
        reduce_stage_1_tid_res_arr_mem_225830_cached_sizze_235774 =
            (int64_t) 8 * num_tasks_225829;
    }
    if (reduce_stage_1_tid_res_arr_mem_225832_cached_sizze_235775 <
        (size_t) ((int64_t) 8 * num_tasks_225829)) {
        reduce_stage_1_tid_res_arr_mem_225832 =
            realloc(reduce_stage_1_tid_res_arr_mem_225832, (int64_t) 8 *
                    num_tasks_225829);
        reduce_stage_1_tid_res_arr_mem_225832_cached_sizze_235775 =
            (int64_t) 8 * num_tasks_225829;
    }
    
    int64_t iter_225834;
    struct futhark_mc_segred_stage_1_parloop_struct_235776
    futhark_mc_segred_stage_1_parloop_struct_235776;
    
    futhark_mc_segred_stage_1_parloop_struct_235776.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_gtid_209440 =
        gtid_209440;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_mem_218052 =
        mem_218052.mem;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_gtid_224770 =
        gtid_224770;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_x_224771 = x_224771;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_x_225330 = x_225330;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_x_225331 = x_225331;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_a12_225406 =
        a12_225406;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_b12_225407 =
        b12_225407;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_c12_225408 =
        c12_225408;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_b2_225409 = b2_225409;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_c2_225410 = c2_225410;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_defunc_0_m_fun_res_225411 =
        defunc_0_m_fun_res_225411;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_reduce_stage_1_tid_res_arr_mem_225830 =
        reduce_stage_1_tid_res_arr_mem_225830;
    futhark_mc_segred_stage_1_parloop_struct_235776.free_reduce_stage_1_tid_res_arr_mem_225832 =
        reduce_stage_1_tid_res_arr_mem_225832;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235777_task;
    
    futhark_mc_segred_stage_1_parloop_235777_task.name =
        "futhark_mc_segred_stage_1_parloop_235777";
    futhark_mc_segred_stage_1_parloop_235777_task.fn =
        futhark_mc_segred_stage_1_parloop_235777;
    futhark_mc_segred_stage_1_parloop_235777_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235776;
    futhark_mc_segred_stage_1_parloop_235777_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235777_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235777_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235777_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235777_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235777_task);
    
    if (futhark_mc_segred_stage_1_parloop_235777_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235777_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235777_total_end -
                 futhark_mc_segred_stage_1_parloop_235777_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235777_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235777_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235777_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_225420 = 0.0;
        defunc_2_reduce_res_225421 = 0.0;
    }
    
    double x_225837;
    double x_225838;
    double x_225840;
    double x_225841;
    
    for (int32_t i_225843 = 0; i_225843 < num_tasks_225829; i_225843++) {
        flat_tid_225751 = i_225843;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_225837 = defunc_2_reduce_res_225420;
            }
            // load next params
            {
                x_225838 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225830)[flat_tid_225751];
            }
            // red body
            {
                double defunc_1_op_res_225839 = x_225837 + x_225838;
                
                defunc_2_reduce_res_225420 = defunc_1_op_res_225839;
            }
            // load acc params
            {
                x_225840 = defunc_2_reduce_res_225421;
            }
            // load next params
            {
                x_225841 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225832)[flat_tid_225751];
            }
            // red body
            {
                double defunc_1_op_res_225842 = x_225840 + x_225841;
                
                defunc_2_reduce_res_225421 = defunc_1_op_res_225842;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_225830);
        free(reduce_stage_1_tid_res_arr_mem_225832);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235773_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235773_end -
                 futhark_mc_segred_task_235773_start;
        
        ctx->futhark_mc_segred_task_235773_runs[tid]++;
        ctx->futhark_mc_segred_task_235773_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235773_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235772->retval_defunc_2_reduce_res_225420 =
            defunc_2_reduce_res_225420;
        *futhark_mc_task_235772->retval_defunc_2_reduce_res_225421 =
            defunc_2_reduce_res_225421;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235762(void *args, int64_t start,
                                            int64_t end, int flat_tid_225328,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235761
    *futhark_mc_segmap_parloop_struct_235761 =
    (struct futhark_mc_segmap_parloop_struct_235761 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235761->ctx;
    uint64_t futhark_mc_segmap_parloop_235762_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235762_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235761->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235761->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235761->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235761->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235761->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235761->free_s_n_m_203636;
    int64_t gtid_209440 =
            futhark_mc_segmap_parloop_struct_235761->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235761->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235761->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235761->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235761->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235761->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 =
            futhark_mc_segmap_parloop_struct_235761->free_gtid_224770;
    int64_t x_224771 = futhark_mc_segmap_parloop_struct_235761->free_x_224771;
    struct memblock mem_224772 = {.desc ="mem_224772", .mem =
                                  futhark_mc_segmap_parloop_struct_235761->free_mem_224772,
                                  .size =0, .references =NULL};
    struct memblock mem_224773 = {.desc ="mem_224773", .mem =
                                  futhark_mc_segmap_parloop_struct_235761->free_mem_224773,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225695 = start;
    
    for (; iter_225695 < end; iter_225695++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225794 = s_n_m_203636;
        int64_t gtid_225329 = iter_225695;
        int64_t remnant_225795 = iter_225695 - gtid_225329;
        int64_t x_225330;
        
        x_225330 = ((int64_t *) mem_217710.mem)[gtid_209440 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_224770 * s_n_m_203636 +
                                                gtid_225329];
        
        double x_225331;
        
        x_225331 = ((double *) mem_217715.mem)[gtid_209440 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_224770 * s_n_m_203636 +
                                               gtid_225329];
        
        bool cond_225332 = gtid_225329 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_225333;
        
        if (cond_225332) {
            defunc_0_m_fun_res_225333 = (int64_t) 0;
        } else {
            int64_t y_225696 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_225697 = gtid_225329 == y_225696;
            int64_t defunc_0_m_fun_res_f_res_225698;
            
            if (cond_225697) {
                int64_t defunc_0_m_fun_res_f_res_t_res_225699 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_225698 =
                    defunc_0_m_fun_res_f_res_t_res_225699;
            } else {
                int64_t x_225700 = sub64(gtid_225329, (int64_t) 1);
                int64_t x_225701 = mul64(jump_s_203499, x_225700);
                int64_t min_arg_225702 = add64((int64_t) 1, x_225701);
                int64_t min_res_225703 = smin64(defunc_0_f_res_203631,
                                                min_arg_225702);
                
                defunc_0_m_fun_res_f_res_225698 = min_res_225703;
            }
            defunc_0_m_fun_res_225333 = defunc_0_m_fun_res_f_res_225698;
        }
        
        double defunc_2_reduce_res_225342;
        double defunc_2_reduce_res_225343;
        double defunc_2_reduce_res_225344;
        double defunc_2_reduce_res_225345;
        double defunc_2_reduce_res_225346;
        int64_t flat_tid_225704 = (int64_t) 0;
        int32_t num_tasks_225796;
        
        defunc_2_reduce_res_225342 = 0.0;
        defunc_2_reduce_res_225343 = 0.0;
        defunc_2_reduce_res_225344 = 0.0;
        defunc_2_reduce_res_225345 = 0.0;
        defunc_2_reduce_res_225346 = 0.0;
        
        struct futhark_mc_task_235763 futhark_mc_task_235763;
        
        futhark_mc_task_235763.ctx = ctx;
        futhark_mc_task_235763.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235763.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235763.free_gtid_209440 = gtid_209440;
        futhark_mc_task_235763.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235763.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235763.free_gtid_224770 = gtid_224770;
        futhark_mc_task_235763.free_x_224771 = x_224771;
        futhark_mc_task_235763.free_x_225330 = x_225330;
        futhark_mc_task_235763.free_x_225331 = x_225331;
        futhark_mc_task_235763.free_defunc_0_m_fun_res_225333 =
            defunc_0_m_fun_res_225333;
        futhark_mc_task_235763.retval_defunc_2_reduce_res_225342 =
            &defunc_2_reduce_res_225342;
        futhark_mc_task_235763.retval_defunc_2_reduce_res_225343 =
            &defunc_2_reduce_res_225343;
        futhark_mc_task_235763.retval_defunc_2_reduce_res_225344 =
            &defunc_2_reduce_res_225344;
        futhark_mc_task_235763.retval_defunc_2_reduce_res_225345 =
            &defunc_2_reduce_res_225345;
        futhark_mc_task_235763.retval_defunc_2_reduce_res_225346 =
            &defunc_2_reduce_res_225346;
        
        struct scheduler_segop futhark_mc_task_235763_task;
        
        futhark_mc_task_235763_task.args = &futhark_mc_task_235763;
        futhark_mc_task_235763_task.top_level_fn =
            futhark_mc_segred_task_235764;
        futhark_mc_task_235763_task.name = "futhark_mc_segred_task_235764";
        futhark_mc_task_235763_task.iterations = q_s_203493;
        futhark_mc_task_235763_task.task_time =
            &ctx->futhark_mc_segred_task_235764_total_time;
        futhark_mc_task_235763_task.task_iter =
            &ctx->futhark_mc_segred_task_235764_total_iter;
        futhark_mc_task_235763_task.sched = STATIC;
        futhark_mc_task_235763_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235764_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235763_task);
        
        if (futhark_mc_segred_task_235764_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_225386 = defunc_2_reduce_res_225344 *
               defunc_2_reduce_res_225346;
        double y_225387 = defunc_2_reduce_res_225345 *
               defunc_2_reduce_res_225345;
        double a12_225388 = x_225386 - y_225387;
        double x_225389 = defunc_2_reduce_res_225344 *
               defunc_2_reduce_res_225345;
        double y_225390 = defunc_2_reduce_res_225343 *
               defunc_2_reduce_res_225346;
        double b12_225391 = x_225389 - y_225390;
        double x_225392 = defunc_2_reduce_res_225343 *
               defunc_2_reduce_res_225345;
        double y_225393 = defunc_2_reduce_res_225344 *
               defunc_2_reduce_res_225344;
        double c12_225394 = x_225392 - y_225393;
        double x_225395 = defunc_2_reduce_res_225342 *
               defunc_2_reduce_res_225346;
        double b2_225396 = x_225395 - y_225393;
        double x_225397 = defunc_2_reduce_res_225343 *
               defunc_2_reduce_res_225344;
        double y_225398 = defunc_2_reduce_res_225342 *
               defunc_2_reduce_res_225345;
        double c2_225399 = x_225397 - y_225398;
        double x_225400 = defunc_2_reduce_res_225342 * a12_225388;
        double y_225401 = defunc_2_reduce_res_225343 * b12_225391;
        double x_225402 = x_225400 + y_225401;
        double y_225403 = defunc_2_reduce_res_225344 * c12_225394;
        double y_225404 = x_225402 + y_225403;
        double det_225405 = 1.0 / y_225404;
        double a12_225406 = a12_225388 * det_225405;
        double b12_225407 = b12_225391 * det_225405;
        double c12_225408 = c12_225394 * det_225405;
        double b2_225409 = b2_225396 * det_225405;
        double c2_225410 = c2_225399 * det_225405;
        int64_t defunc_0_m_fun_res_225411;
        
        if (cond_225332) {
            defunc_0_m_fun_res_225411 = (int64_t) 0;
        } else {
            int64_t y_225743 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_225744 = gtid_225329 == y_225743;
            int64_t defunc_0_m_fun_res_f_res_225745;
            
            if (cond_225744) {
                int64_t defunc_0_m_fun_res_f_res_t_res_225746 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_225745 =
                    defunc_0_m_fun_res_f_res_t_res_225746;
            } else {
                int64_t x_225747 = sub64(gtid_225329, (int64_t) 1);
                int64_t x_225748 = mul64(jump_s_203499, x_225747);
                int64_t min_arg_225749 = add64((int64_t) 1, x_225748);
                int64_t min_res_225750 = smin64(defunc_0_f_res_203631,
                                                min_arg_225749);
                
                defunc_0_m_fun_res_f_res_225745 = min_res_225750;
            }
            defunc_0_m_fun_res_225411 = defunc_0_m_fun_res_f_res_225745;
        }
        
        double defunc_2_reduce_res_225420;
        double defunc_2_reduce_res_225421;
        int64_t flat_tid_225751 = (int64_t) 0;
        int32_t num_tasks_225829;
        
        defunc_2_reduce_res_225420 = 0.0;
        defunc_2_reduce_res_225421 = 0.0;
        
        struct futhark_mc_task_235772 futhark_mc_task_235772;
        
        futhark_mc_task_235772.ctx = ctx;
        futhark_mc_task_235772.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235772.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235772.free_gtid_209440 = gtid_209440;
        futhark_mc_task_235772.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235772.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235772.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235772.free_gtid_224770 = gtid_224770;
        futhark_mc_task_235772.free_x_224771 = x_224771;
        futhark_mc_task_235772.free_x_225330 = x_225330;
        futhark_mc_task_235772.free_x_225331 = x_225331;
        futhark_mc_task_235772.free_a12_225406 = a12_225406;
        futhark_mc_task_235772.free_b12_225407 = b12_225407;
        futhark_mc_task_235772.free_c12_225408 = c12_225408;
        futhark_mc_task_235772.free_b2_225409 = b2_225409;
        futhark_mc_task_235772.free_c2_225410 = c2_225410;
        futhark_mc_task_235772.free_defunc_0_m_fun_res_225411 =
            defunc_0_m_fun_res_225411;
        futhark_mc_task_235772.retval_defunc_2_reduce_res_225420 =
            &defunc_2_reduce_res_225420;
        futhark_mc_task_235772.retval_defunc_2_reduce_res_225421 =
            &defunc_2_reduce_res_225421;
        
        struct scheduler_segop futhark_mc_task_235772_task;
        
        futhark_mc_task_235772_task.args = &futhark_mc_task_235772;
        futhark_mc_task_235772_task.top_level_fn =
            futhark_mc_segred_task_235773;
        futhark_mc_task_235772_task.name = "futhark_mc_segred_task_235773";
        futhark_mc_task_235772_task.iterations = q_s_203493;
        futhark_mc_task_235772_task.task_time =
            &ctx->futhark_mc_segred_task_235773_total_time;
        futhark_mc_task_235772_task.task_iter =
            &ctx->futhark_mc_segred_task_235773_total_iter;
        futhark_mc_task_235772_task.sched = STATIC;
        futhark_mc_task_235772_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235773_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235772_task);
        
        if (futhark_mc_segred_task_235773_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_224772.mem)[gtid_225329] = defunc_2_reduce_res_225420;
        ((double *) mem_224773.mem)[gtid_225329] = defunc_2_reduce_res_225421;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235762_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235762_end -
                 futhark_mc_segmap_parloop_235762_start;
        
        ctx->futhark_mc_segmap_parloop_235762_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235762_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235762_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235760(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225328 = tid;
    int num_tasks_225595 = info.nsubtasks;
    struct futhark_mc_task_235756 *futhark_mc_task_235756 =
                                  (struct futhark_mc_task_235756 *) args;
    struct futhark_context *ctx = futhark_mc_task_235756->ctx;
    uint64_t futhark_mc_segmap_nested_task_235760_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235760_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235756->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235756->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235756->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235756->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235756->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235756->free_s_n_m_203636;
    int64_t gtid_209440 = futhark_mc_task_235756->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235756->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235756->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235756->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235756->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235756->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_224770 = futhark_mc_task_235756->free_gtid_224770;
    int64_t x_224771 = futhark_mc_task_235756->free_x_224771;
    struct memblock mem_224772 = {.desc ="mem_224772", .mem =
                                  futhark_mc_task_235756->free_mem_224772,
                                  .size =0, .references =NULL};
    struct memblock mem_224773 = {.desc ="mem_224773", .mem =
                                  futhark_mc_task_235756->free_mem_224773,
                                  .size =0, .references =NULL};
    int64_t iter_225695;
    struct futhark_mc_segmap_parloop_struct_235761
    futhark_mc_segmap_parloop_struct_235761;
    
    futhark_mc_segmap_parloop_struct_235761.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235761.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235761.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235761.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235761.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235761.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235761.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235761.free_gtid_209440 = gtid_209440;
    futhark_mc_segmap_parloop_struct_235761.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235761.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235761.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235761.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235761.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235761.free_gtid_224770 = gtid_224770;
    futhark_mc_segmap_parloop_struct_235761.free_x_224771 = x_224771;
    futhark_mc_segmap_parloop_struct_235761.free_mem_224772 = mem_224772.mem;
    futhark_mc_segmap_parloop_struct_235761.free_mem_224773 = mem_224773.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235762_task;
    
    futhark_mc_segmap_parloop_235762_task.name =
        "futhark_mc_segmap_parloop_235762";
    futhark_mc_segmap_parloop_235762_task.fn = futhark_mc_segmap_parloop_235762;
    futhark_mc_segmap_parloop_235762_task.args =
        &futhark_mc_segmap_parloop_struct_235761;
    futhark_mc_segmap_parloop_235762_task.iterations = iterations;
    futhark_mc_segmap_parloop_235762_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235762_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235762_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235762_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235762_task);
    
    if (futhark_mc_segmap_parloop_235762_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235762_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235762_total_end -
                 futhark_mc_segmap_parloop_235762_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235762_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235762_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235762_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235760_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235760_end -
                 futhark_mc_segmap_nested_task_235760_start;
        
        ctx->futhark_mc_segmap_nested_task_235760_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235760_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235760_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235753(void *args, int64_t start,
                                            int64_t end, int flat_tid_224769,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235752
    *futhark_mc_segmap_parloop_struct_235752 =
    (struct futhark_mc_segmap_parloop_struct_235752 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235752->ctx;
    uint64_t futhark_mc_segmap_parloop_235753_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235753_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235752->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235752->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235752->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235752->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235752->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235752->free_s_n_m_203636;
    int64_t gtid_209440 =
            futhark_mc_segmap_parloop_struct_235752->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235752->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218315 = {.desc ="mem_218315", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_218315,
                                  .size =0, .references =NULL};
    struct memblock mem_218319 = {.desc ="mem_218319", .mem =
                                  futhark_mc_segmap_parloop_struct_235752->free_mem_218319,
                                  .size =0, .references =NULL};
    size_t mem_224772_cached_sizze_235754 = 0;
    unsigned char *mem_224772 = NULL;
    size_t mem_224773_cached_sizze_235755 = 0;
    unsigned char *mem_224773 = NULL;
    int64_t iterations = end - start;
    int64_t iter_225327 = start;
    
    if (mem_224772_cached_sizze_235754 < (size_t) bytes_217545) {
        mem_224772 = realloc(mem_224772, bytes_217545);
        mem_224772_cached_sizze_235754 = bytes_217545;
    }
    if (mem_224773_cached_sizze_235755 < (size_t) bytes_217545) {
        mem_224773 = realloc(mem_224773, bytes_217545);
        mem_224773_cached_sizze_235755 = bytes_217545;
    }
    for (; iter_225327 < end; iter_225327++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225593 = n_p_203492;
        int64_t gtid_224770 = iter_225327;
        int64_t remnant_225594 = iter_225327 - gtid_224770;
        int64_t x_224771;
        
        x_224771 = ((int64_t *) mem_217540.mem)[gtid_209440 * n_p_203492 +
                                                gtid_224770];
        
        int64_t flat_tid_225465 = (int64_t) 0;
        int32_t num_tasks_225595;
        int64_t flat_tid_225328 = (int64_t) 0;
        struct futhark_mc_task_235756 futhark_mc_task_235756;
        
        futhark_mc_task_235756.ctx = ctx;
        futhark_mc_task_235756.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235756.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235756.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235756.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235756.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235756.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235756.free_gtid_209440 = gtid_209440;
        futhark_mc_task_235756.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235756.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235756.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235756.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235756.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235756.free_gtid_224770 = gtid_224770;
        futhark_mc_task_235756.free_x_224771 = x_224771;
        futhark_mc_task_235756.free_mem_224772 = mem_224772;
        futhark_mc_task_235756.free_mem_224773 = mem_224773;
        
        struct scheduler_segop futhark_mc_task_235756_task;
        
        futhark_mc_task_235756_task.args = &futhark_mc_task_235756;
        futhark_mc_task_235756_task.top_level_fn =
            futhark_mc_segmap_task_235757;
        futhark_mc_task_235756_task.name = "futhark_mc_segmap_task_235757";
        futhark_mc_task_235756_task.iterations = s_n_m_203636;
        futhark_mc_task_235756_task.task_time =
            &ctx->futhark_mc_segmap_task_235757_total_time;
        futhark_mc_task_235756_task.task_iter =
            &ctx->futhark_mc_segmap_task_235757_total_iter;
        futhark_mc_task_235756_task.sched = STATIC;
        futhark_mc_task_235756_task.nested_fn =
            futhark_mc_segmap_nested_task_235760;
        
        int futhark_mc_segmap_task_235757_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235756_task);
        
        if (futhark_mc_segmap_task_235757_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218315.mem + gtid_224770 * s_n_m_203636 * (int64_t) 8,
                    mem_224772 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218319.mem + gtid_224770 * s_n_m_203636 * (int64_t) 8,
                    mem_224773 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_224772);
    free(mem_224773);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235753_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235753_end -
                 futhark_mc_segmap_parloop_235753_start;
        
        ctx->futhark_mc_segmap_parloop_235753_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235753_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235753_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235751(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224769 = tid;
    int num_tasks_225183 = info.nsubtasks;
    struct futhark_mc_task_235745 *futhark_mc_task_235745 =
                                  (struct futhark_mc_task_235745 *) args;
    struct futhark_context *ctx = futhark_mc_task_235745->ctx;
    uint64_t futhark_mc_segmap_nested_task_235751_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235751_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235745->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235745->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235745->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235745->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235745->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235745->free_s_n_m_203636;
    int64_t gtid_209440 = futhark_mc_task_235745->free_gtid_209440;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235745->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235745->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235745->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235745->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235745->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235745->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235745->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218315 = {.desc ="mem_218315", .mem =
                                  futhark_mc_task_235745->free_mem_218315,
                                  .size =0, .references =NULL};
    struct memblock mem_218319 = {.desc ="mem_218319", .mem =
                                  futhark_mc_task_235745->free_mem_218319,
                                  .size =0, .references =NULL};
    int64_t iter_225327;
    struct futhark_mc_segmap_parloop_struct_235752
    futhark_mc_segmap_parloop_struct_235752;
    
    futhark_mc_segmap_parloop_struct_235752.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235752.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235752.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235752.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235752.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235752.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235752.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235752.free_gtid_209440 = gtid_209440;
    futhark_mc_segmap_parloop_struct_235752.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235752.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235752.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235752.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235752.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235752.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235752.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235752.free_mem_218315 = mem_218315.mem;
    futhark_mc_segmap_parloop_struct_235752.free_mem_218319 = mem_218319.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235753_task;
    
    futhark_mc_segmap_parloop_235753_task.name =
        "futhark_mc_segmap_parloop_235753";
    futhark_mc_segmap_parloop_235753_task.fn = futhark_mc_segmap_parloop_235753;
    futhark_mc_segmap_parloop_235753_task.args =
        &futhark_mc_segmap_parloop_struct_235752;
    futhark_mc_segmap_parloop_235753_task.iterations = iterations;
    futhark_mc_segmap_parloop_235753_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235753_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235753_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235753_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235753_task);
    
    if (futhark_mc_segmap_parloop_235753_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235753_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235753_total_end -
                 futhark_mc_segmap_parloop_235753_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235753_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235753_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235753_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235751_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235751_end -
                 futhark_mc_segmap_nested_task_235751_start;
        
        ctx->futhark_mc_segmap_nested_task_235751_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235751_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235751_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235742(void *args, int64_t start,
                                            int64_t end, int flat_tid_209439,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235741
    *futhark_mc_segmap_parloop_struct_235741 =
    (struct futhark_mc_segmap_parloop_struct_235741 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235741->ctx;
    uint64_t futhark_mc_segmap_parloop_235742_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235742_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235741->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235741->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235741->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235741->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235741->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235741->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235741->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235741->free_bytes_217545;
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235741->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218412 = {.desc ="mem_218412", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_218412,
                                  .size =0, .references =NULL};
    struct memblock mem_218417 = {.desc ="mem_218417", .mem =
                                  futhark_mc_segmap_parloop_struct_235741->free_mem_218417,
                                  .size =0, .references =NULL};
    size_t mem_218315_cached_sizze_235743 = 0;
    unsigned char *mem_218315 = NULL;
    size_t mem_218319_cached_sizze_235744 = 0;
    unsigned char *mem_218319 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224768 = start;
    
    if (mem_218315_cached_sizze_235743 < (size_t) bytes_217597) {
        mem_218315 = realloc(mem_218315, bytes_217597);
        mem_218315_cached_sizze_235743 = bytes_217597;
    }
    if (mem_218319_cached_sizze_235744 < (size_t) bytes_217597) {
        mem_218319 = realloc(mem_218319, bytes_217597);
        mem_218319_cached_sizze_235744 = bytes_217597;
    }
    for (; iter_224768 < end; iter_224768++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225181 = partition_sizze_203577;
        int64_t gtid_209440 = iter_224768;
        int64_t remnant_225182 = iter_224768 - gtid_209440;
        int64_t flat_tid_225041 = (int64_t) 0;
        int32_t num_tasks_225183;
        int64_t flat_tid_224769 = (int64_t) 0;
        struct futhark_mc_task_235745 futhark_mc_task_235745;
        
        futhark_mc_task_235745.ctx = ctx;
        futhark_mc_task_235745.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235745.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235745.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235745.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235745.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235745.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235745.free_gtid_209440 = gtid_209440;
        futhark_mc_task_235745.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235745.free_mem_217540 = mem_217540.mem;
        futhark_mc_task_235745.free_bytes_217545 = bytes_217545;
        futhark_mc_task_235745.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235745.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235745.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235745.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235745.free_mem_218315 = mem_218315;
        futhark_mc_task_235745.free_mem_218319 = mem_218319;
        
        struct scheduler_segop futhark_mc_task_235745_task;
        
        futhark_mc_task_235745_task.args = &futhark_mc_task_235745;
        futhark_mc_task_235745_task.top_level_fn =
            futhark_mc_segmap_task_235746;
        futhark_mc_task_235745_task.name = "futhark_mc_segmap_task_235746";
        futhark_mc_task_235745_task.iterations = n_p_203492;
        futhark_mc_task_235745_task.task_time =
            &ctx->futhark_mc_segmap_task_235746_total_time;
        futhark_mc_task_235745_task.task_iter =
            &ctx->futhark_mc_segmap_task_235746_total_iter;
        futhark_mc_task_235745_task.sched = STATIC;
        futhark_mc_task_235745_task.nested_fn =
            futhark_mc_segmap_nested_task_235751;
        
        int futhark_mc_segmap_task_235746_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235745_task);
        
        if (futhark_mc_segmap_task_235746_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218412.mem + gtid_209440 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218315 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218417.mem + gtid_209440 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218319 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218315);
    free(mem_218319);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235742_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235742_end -
                 futhark_mc_segmap_parloop_235742_start;
        
        ctx->futhark_mc_segmap_parloop_235742_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235742_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235742_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235740(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_209439 = tid;
    int num_tasks_224616 = info.nsubtasks;
    struct futhark_mc_task_235734 *futhark_mc_task_235734 =
                                  (struct futhark_mc_task_235734 *) args;
    struct futhark_context *ctx = futhark_mc_task_235734->ctx;
    uint64_t futhark_mc_segmap_nested_task_235740_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235740_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235734->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235734->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235734->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235734->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235734->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235734->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235734->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235734->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235734->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235734->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235734->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235734->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235734->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235734->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235734->free_mem_218057,
                                  .size =0, .references =NULL};
    struct memblock mem_218412 = {.desc ="mem_218412", .mem =
                                  futhark_mc_task_235734->free_mem_218412,
                                  .size =0, .references =NULL};
    struct memblock mem_218417 = {.desc ="mem_218417", .mem =
                                  futhark_mc_task_235734->free_mem_218417,
                                  .size =0, .references =NULL};
    int64_t iter_224768;
    struct futhark_mc_segmap_parloop_struct_235741
    futhark_mc_segmap_parloop_struct_235741;
    
    futhark_mc_segmap_parloop_struct_235741.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235741.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235741.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235741.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235741.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235741.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235741.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235741.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235741.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235741.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235741.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235741.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235741.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235741.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235741.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235741.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235741.free_mem_218412 = mem_218412.mem;
    futhark_mc_segmap_parloop_struct_235741.free_mem_218417 = mem_218417.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235742_task;
    
    futhark_mc_segmap_parloop_235742_task.name =
        "futhark_mc_segmap_parloop_235742";
    futhark_mc_segmap_parloop_235742_task.fn = futhark_mc_segmap_parloop_235742;
    futhark_mc_segmap_parloop_235742_task.args =
        &futhark_mc_segmap_parloop_struct_235741;
    futhark_mc_segmap_parloop_235742_task.iterations = iterations;
    futhark_mc_segmap_parloop_235742_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235742_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235742_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235742_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235742_task);
    
    if (futhark_mc_segmap_parloop_235742_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235742_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235742_total_end -
                 futhark_mc_segmap_parloop_235742_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235742_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235742_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235742_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235740_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235740_end -
                 futhark_mc_segmap_nested_task_235740_start;
        
        ctx->futhark_mc_segmap_nested_task_235740_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235740_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235740_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235778 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    unsigned char *free_mem_218545;
};
struct futhark_mc_segmap_parloop_struct_235780 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    unsigned char *free_mem_218545;
};
static int futhark_mc_segmap_parloop_235781(void *args, int64_t start,
                                            int64_t end, int flat_tid_209879,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235780
    *futhark_mc_segmap_parloop_struct_235780 =
    (struct futhark_mc_segmap_parloop_struct_235780 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235780->ctx;
    uint64_t futhark_mc_segmap_parloop_235781_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235781_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235780->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235780->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235780->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235780->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235780->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235780->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235780->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235780->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 =
            futhark_mc_segmap_parloop_struct_235780->free_bytes_218428;
    struct memblock mem_218545 = {.desc ="mem_218545", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_218545,
                                  .size =0, .references =NULL};
    size_t mem_218485_cached_sizze_235782 = 0;
    unsigned char *mem_218485 = NULL;
    size_t mem_218509_cached_sizze_235783 = 0;
    unsigned char *mem_218509 = NULL;
    int64_t iterations = end - start;
    int64_t iter_225848 = start;
    
    if (mem_218485_cached_sizze_235782 < (size_t) bytes_217597) {
        mem_218485 = realloc(mem_218485, bytes_217597);
        mem_218485_cached_sizze_235782 = bytes_217597;
    }
    if (mem_218509_cached_sizze_235783 < (size_t) bytes_218428) {
        mem_218509 = realloc(mem_218509, bytes_218428);
        mem_218509_cached_sizze_235783 = bytes_218428;
    }
    for (; iter_225848 < end; iter_225848++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225906 = partition_sizze_203577;
        int64_t gtid_209880 = iter_225848;
        int64_t remnant_225907 = iter_225848 - gtid_209880;
        
        for (int64_t i_225849 = 0; i_225849 < n_p_203492; i_225849++) {
            int64_t x_225851;
            
            x_225851 = ((int64_t *) mem_217540.mem)[gtid_209880 * n_p_203492 +
                                                    i_225849];
            for (int64_t i_225853 = 0; i_225853 < s_n_m_203636; i_225853++) {
                int64_t x_225855;
                
                x_225855 = ((int64_t *) mem_217710.mem)[gtid_209880 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        i_225849 *
                                                        s_n_m_203636 +
                                                        i_225853];
                
                double x_225856;
                
                x_225856 = ((double *) mem_217715.mem)[gtid_209880 *
                                                       (s_n_m_203636 *
                                                        n_p_203492) + i_225849 *
                                                       s_n_m_203636 + i_225853];
                
                bool cond_225857 = i_225853 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_225858;
                
                if (cond_225857) {
                    defunc_0_m_fun_res_225858 = (int64_t) 0;
                } else {
                    int64_t y_225859 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_225860 = i_225853 == y_225859;
                    int64_t defunc_0_m_fun_res_f_res_225861;
                    
                    if (cond_225860) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_225862 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_225861 =
                            defunc_0_m_fun_res_f_res_t_res_225862;
                    } else {
                        int64_t x_225863 = sub64(i_225853, (int64_t) 1);
                        int64_t x_225864 = mul64(jump_s_203499, x_225863);
                        int64_t min_arg_225865 = add64((int64_t) 1, x_225864);
                        int64_t min_res_225866 = smin64(defunc_0_f_res_203631,
                                                        min_arg_225865);
                        
                        defunc_0_m_fun_res_f_res_225861 = min_res_225866;
                    }
                    defunc_0_m_fun_res_225858 = defunc_0_m_fun_res_f_res_225861;
                }
                
                double defunc_2_reduce_res_225868;
                double redout_225871 = 0.0;
                
                for (int64_t i_225870 = 0; i_225870 < q_s_203493; i_225870++) {
                    bool cond_225873 = sle64(x_225851, i_225870);
                    int64_t defunc_0_f_res_225874;
                    
                    if (cond_225873) {
                        defunc_0_f_res_225874 = (int64_t) 0;
                    } else {
                        int64_t i_225875 = add64(x_225855, i_225870);
                        int64_t defunc_0_add_arg_225876;
                        
                        defunc_0_add_arg_225876 =
                            ((int64_t *) mem_217536.mem)[gtid_209880 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_225849 *
                                                         defunc_0_f_res_203631 +
                                                         i_225875];
                        
                        int64_t defunc_1_add_res_225877 = add64((int64_t) 1,
                                                                defunc_0_add_arg_225876);
                        
                        defunc_0_f_res_225874 = defunc_1_add_res_225877;
                    }
                    
                    double defunc_0_f_res_225878;
                    
                    if (cond_225873) {
                        defunc_0_f_res_225878 = 0.0;
                    } else {
                        int64_t i_225879 = add64(x_225855, i_225870);
                        double defunc_0_add_arg_225880;
                        
                        defunc_0_add_arg_225880 =
                            ((double *) mem_218057.mem)[gtid_209880 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_225849 *
                                                        defunc_0_f_res_203631 +
                                                        i_225879];
                        defunc_0_f_res_225878 = defunc_0_add_arg_225880;
                    }
                    
                    int64_t binop_p_225881 = sub64(defunc_0_f_res_225874,
                                                   defunc_0_m_fun_res_225858);
                    double defunc_0_f_res_225882 =
                           sitofp_i64_f64(binop_p_225881);
                    double abs_res_225883 = fabs(defunc_0_f_res_225882);
                    double tmp1_225884 = abs_res_225883 / x_225856;
                    double x_225885 = tmp1_225884 * tmp1_225884;
                    double y_225886 = tmp1_225884 * x_225885;
                    double tmp2_225887 = 1.0 - y_225886;
                    double x_225888 = tmp2_225887 * tmp2_225887;
                    double tmp3_225889 = tmp2_225887 * x_225888;
                    double tmp4_225890 = defunc_0_f_res_225878 * tmp3_225889;
                    double defunc_1_op_res_225891 = tmp4_225890 + redout_225871;
                    
                    ((double *) mem_218509)[i_225870] = tmp4_225890;
                    
                    double redout_tmp_225910 = defunc_1_op_res_225891;
                    
                    redout_225871 = redout_tmp_225910;
                }
                defunc_2_reduce_res_225868 = redout_225871;
                
                double a0_225893 = 1.0 / defunc_2_reduce_res_225868;
                double defunc_2_reduce_res_225894;
                double redout_225896 = 0.0;
                
                for (int64_t i_225895 = 0; i_225895 < q_s_203493; i_225895++) {
                    double x_225897;
                    
                    x_225897 = ((double *) mem_218509)[i_225895];
                    
                    bool cond_225898 = sle64(x_225851, i_225895);
                    double defunc_0_f_res_225899;
                    
                    if (cond_225898) {
                        defunc_0_f_res_225899 = 0.0;
                    } else {
                        int64_t i_225900 = add64(x_225855, i_225895);
                        double defunc_0_add_arg_225901;
                        
                        defunc_0_add_arg_225901 =
                            ((double *) mem_218052.mem)[gtid_209880 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_225849 *
                                                        defunc_0_f_res_203631 +
                                                        i_225900];
                        defunc_0_f_res_225899 = defunc_0_add_arg_225901;
                    }
                    
                    double x_225902 = a0_225893 * x_225897;
                    double defunc_9_fit_fun_res_225903 = defunc_0_f_res_225899 *
                           x_225902;
                    double defunc_1_op_res_225904 =
                           defunc_9_fit_fun_res_225903 + redout_225896;
                    double redout_tmp_225912 = defunc_1_op_res_225904;
                    
                    redout_225896 = redout_tmp_225912;
                }
                defunc_2_reduce_res_225894 = redout_225896;
                ((double *) mem_218485)[i_225849 * s_n_m_203636 + i_225853] =
                    defunc_2_reduce_res_225894;
            }
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218545.mem + gtid_209880 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218485 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218485);
    free(mem_218509);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235781_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235781_end -
                 futhark_mc_segmap_parloop_235781_start;
        
        ctx->futhark_mc_segmap_parloop_235781_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235781_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235781_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235779(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_209879 = tid;
    int num_tasks_225847 = info.nsubtasks;
    struct futhark_mc_task_235778 *futhark_mc_task_235778 =
                                  (struct futhark_mc_task_235778 *) args;
    struct futhark_context *ctx = futhark_mc_task_235778->ctx;
    uint64_t futhark_mc_segmap_task_235779_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235779_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235778->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235778->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235778->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235778->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235778->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235778->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235778->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235778->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235778->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235778->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235778->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235778->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235778->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235778->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235778->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 = futhark_mc_task_235778->free_bytes_218428;
    struct memblock mem_218545 = {.desc ="mem_218545", .mem =
                                  futhark_mc_task_235778->free_mem_218545,
                                  .size =0, .references =NULL};
    int64_t iter_225848;
    struct futhark_mc_segmap_parloop_struct_235780
    futhark_mc_segmap_parloop_struct_235780;
    
    futhark_mc_segmap_parloop_struct_235780.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235780.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235780.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235780.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235780.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235780.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235780.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235780.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235780.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235780.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235780.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235780.free_bytes_218428 = bytes_218428;
    futhark_mc_segmap_parloop_struct_235780.free_mem_218545 = mem_218545.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235781_task;
    
    futhark_mc_segmap_parloop_235781_task.name =
        "futhark_mc_segmap_parloop_235781";
    futhark_mc_segmap_parloop_235781_task.fn = futhark_mc_segmap_parloop_235781;
    futhark_mc_segmap_parloop_235781_task.args =
        &futhark_mc_segmap_parloop_struct_235780;
    futhark_mc_segmap_parloop_235781_task.iterations = iterations;
    futhark_mc_segmap_parloop_235781_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235781_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235781_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235781_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235781_task);
    
    if (futhark_mc_segmap_parloop_235781_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235781_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235781_total_end -
                 futhark_mc_segmap_parloop_235781_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235781_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235781_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235781_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235779_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235779_end -
                 futhark_mc_segmap_task_235779_start;
        
        ctx->futhark_mc_segmap_task_235779_runs[tid]++;
        ctx->futhark_mc_segmap_task_235779_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235779_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235785 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    unsigned char *free_mem_218545;
};
struct futhark_mc_task_235788 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    unsigned char *free_mem_218481;
};
struct futhark_mc_segmap_parloop_struct_235790 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    unsigned char *free_mem_218481;
};
static int futhark_mc_segmap_parloop_235791(void *args, int64_t start,
                                            int64_t end, int flat_tid_226026,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235790
    *futhark_mc_segmap_parloop_struct_235790 =
    (struct futhark_mc_segmap_parloop_struct_235790 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235790->ctx;
    uint64_t futhark_mc_segmap_parloop_235791_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235791_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235790->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235790->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235790->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235790->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235790->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235790->free_s_n_m_203636;
    int64_t gtid_210069 =
            futhark_mc_segmap_parloop_struct_235790->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235790->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235790->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235790->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235790->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235790->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235790->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235790->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 =
            futhark_mc_segmap_parloop_struct_235790->free_bytes_218428;
    struct memblock mem_218481 = {.desc ="mem_218481", .mem =
                                  futhark_mc_segmap_parloop_struct_235790->free_mem_218481,
                                  .size =0, .references =NULL};
    size_t mem_226029_cached_sizze_235792 = 0;
    unsigned char *mem_226029 = NULL;
    size_t mem_226031_cached_sizze_235793 = 0;
    unsigned char *mem_226031 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226089 = start;
    
    if (mem_226029_cached_sizze_235792 < (size_t) bytes_217545) {
        mem_226029 = realloc(mem_226029, bytes_217545);
        mem_226029_cached_sizze_235792 = bytes_217545;
    }
    if (mem_226031_cached_sizze_235793 < (size_t) bytes_218428) {
        mem_226031 = realloc(mem_226031, bytes_218428);
        mem_226031_cached_sizze_235793 = bytes_218428;
    }
    for (; iter_226089 < end; iter_226089++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226143 = n_p_203492;
        int64_t gtid_226027 = iter_226089;
        int64_t remnant_226144 = iter_226089 - gtid_226027;
        int64_t x_226028;
        
        x_226028 = ((int64_t *) mem_217540.mem)[gtid_210069 * n_p_203492 +
                                                gtid_226027];
        for (int64_t i_226090 = 0; i_226090 < s_n_m_203636; i_226090++) {
            int64_t x_226092;
            
            x_226092 = ((int64_t *) mem_217710.mem)[gtid_210069 *
                                                    (s_n_m_203636 *
                                                     n_p_203492) + gtid_226027 *
                                                    s_n_m_203636 + i_226090];
            
            double x_226093;
            
            x_226093 = ((double *) mem_217715.mem)[gtid_210069 * (s_n_m_203636 *
                                                                  n_p_203492) +
                                                   gtid_226027 * s_n_m_203636 +
                                                   i_226090];
            
            bool cond_226094 = i_226090 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_226095;
            
            if (cond_226094) {
                defunc_0_m_fun_res_226095 = (int64_t) 0;
            } else {
                int64_t y_226096 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_226097 = i_226090 == y_226096;
                int64_t defunc_0_m_fun_res_f_res_226098;
                
                if (cond_226097) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_226099 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_226098 =
                        defunc_0_m_fun_res_f_res_t_res_226099;
                } else {
                    int64_t x_226100 = sub64(i_226090, (int64_t) 1);
                    int64_t x_226101 = mul64(jump_s_203499, x_226100);
                    int64_t min_arg_226102 = add64((int64_t) 1, x_226101);
                    int64_t min_res_226103 = smin64(defunc_0_f_res_203631,
                                                    min_arg_226102);
                    
                    defunc_0_m_fun_res_f_res_226098 = min_res_226103;
                }
                defunc_0_m_fun_res_226095 = defunc_0_m_fun_res_f_res_226098;
            }
            
            double defunc_2_reduce_res_226105;
            double redout_226108 = 0.0;
            
            for (int64_t i_226107 = 0; i_226107 < q_s_203493; i_226107++) {
                bool cond_226110 = sle64(x_226028, i_226107);
                int64_t defunc_0_f_res_226111;
                
                if (cond_226110) {
                    defunc_0_f_res_226111 = (int64_t) 0;
                } else {
                    int64_t i_226112 = add64(x_226092, i_226107);
                    int64_t defunc_0_add_arg_226113;
                    
                    defunc_0_add_arg_226113 =
                        ((int64_t *) mem_217536.mem)[gtid_210069 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_226027 *
                                                     defunc_0_f_res_203631 +
                                                     i_226112];
                    
                    int64_t defunc_1_add_res_226114 = add64((int64_t) 1,
                                                            defunc_0_add_arg_226113);
                    
                    defunc_0_f_res_226111 = defunc_1_add_res_226114;
                }
                
                double defunc_0_f_res_226115;
                
                if (cond_226110) {
                    defunc_0_f_res_226115 = 0.0;
                } else {
                    int64_t i_226116 = add64(x_226092, i_226107);
                    double defunc_0_add_arg_226117;
                    
                    defunc_0_add_arg_226117 =
                        ((double *) mem_218057.mem)[gtid_210069 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_226027 *
                                                    defunc_0_f_res_203631 +
                                                    i_226116];
                    defunc_0_f_res_226115 = defunc_0_add_arg_226117;
                }
                
                int64_t binop_p_226118 = sub64(defunc_0_f_res_226111,
                                               defunc_0_m_fun_res_226095);
                double defunc_0_f_res_226119 = sitofp_i64_f64(binop_p_226118);
                double abs_res_226120 = fabs(defunc_0_f_res_226119);
                double tmp1_226121 = abs_res_226120 / x_226093;
                double x_226122 = tmp1_226121 * tmp1_226121;
                double y_226123 = tmp1_226121 * x_226122;
                double tmp2_226124 = 1.0 - y_226123;
                double x_226125 = tmp2_226124 * tmp2_226124;
                double tmp3_226126 = tmp2_226124 * x_226125;
                double tmp4_226127 = defunc_0_f_res_226115 * tmp3_226126;
                double defunc_1_op_res_226128 = tmp4_226127 + redout_226108;
                
                ((double *) mem_226031)[i_226107] = tmp4_226127;
                
                double redout_tmp_226146 = defunc_1_op_res_226128;
                
                redout_226108 = redout_tmp_226146;
            }
            defunc_2_reduce_res_226105 = redout_226108;
            
            double a0_226130 = 1.0 / defunc_2_reduce_res_226105;
            double defunc_2_reduce_res_226131;
            double redout_226133 = 0.0;
            
            for (int64_t i_226132 = 0; i_226132 < q_s_203493; i_226132++) {
                double x_226134;
                
                x_226134 = ((double *) mem_226031)[i_226132];
                
                bool cond_226135 = sle64(x_226028, i_226132);
                double defunc_0_f_res_226136;
                
                if (cond_226135) {
                    defunc_0_f_res_226136 = 0.0;
                } else {
                    int64_t i_226137 = add64(x_226092, i_226132);
                    double defunc_0_add_arg_226138;
                    
                    defunc_0_add_arg_226138 =
                        ((double *) mem_218052.mem)[gtid_210069 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_226027 *
                                                    defunc_0_f_res_203631 +
                                                    i_226137];
                    defunc_0_f_res_226136 = defunc_0_add_arg_226138;
                }
                
                double x_226139 = a0_226130 * x_226134;
                double defunc_9_fit_fun_res_226140 = defunc_0_f_res_226136 *
                       x_226139;
                double defunc_1_op_res_226141 = defunc_9_fit_fun_res_226140 +
                       redout_226133;
                double redout_tmp_226148 = defunc_1_op_res_226141;
                
                redout_226133 = redout_tmp_226148;
            }
            defunc_2_reduce_res_226131 = redout_226133;
            ((double *) mem_226029)[i_226090] = defunc_2_reduce_res_226131;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218481.mem + gtid_226027 * s_n_m_203636 * (int64_t) 8,
                    mem_226029 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_226029);
    free(mem_226031);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235791_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235791_end -
                 futhark_mc_segmap_parloop_235791_start;
        
        ctx->futhark_mc_segmap_parloop_235791_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235791_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235791_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235789(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226026 = tid;
    int num_tasks_226088 = info.nsubtasks;
    struct futhark_mc_task_235788 *futhark_mc_task_235788 =
                                  (struct futhark_mc_task_235788 *) args;
    struct futhark_context *ctx = futhark_mc_task_235788->ctx;
    uint64_t futhark_mc_segmap_task_235789_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235789_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235788->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235788->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235788->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235788->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235788->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235788->free_s_n_m_203636;
    int64_t gtid_210069 = futhark_mc_task_235788->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235788->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235788->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235788->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235788->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235788->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235788->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235788->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 = futhark_mc_task_235788->free_bytes_218428;
    struct memblock mem_218481 = {.desc ="mem_218481", .mem =
                                  futhark_mc_task_235788->free_mem_218481,
                                  .size =0, .references =NULL};
    int64_t iter_226089;
    struct futhark_mc_segmap_parloop_struct_235790
    futhark_mc_segmap_parloop_struct_235790;
    
    futhark_mc_segmap_parloop_struct_235790.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235790.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235790.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235790.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235790.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235790.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235790.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235790.free_gtid_210069 = gtid_210069;
    futhark_mc_segmap_parloop_struct_235790.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235790.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235790.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235790.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235790.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235790.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235790.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235790.free_bytes_218428 = bytes_218428;
    futhark_mc_segmap_parloop_struct_235790.free_mem_218481 = mem_218481.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235791_task;
    
    futhark_mc_segmap_parloop_235791_task.name =
        "futhark_mc_segmap_parloop_235791";
    futhark_mc_segmap_parloop_235791_task.fn = futhark_mc_segmap_parloop_235791;
    futhark_mc_segmap_parloop_235791_task.args =
        &futhark_mc_segmap_parloop_struct_235790;
    futhark_mc_segmap_parloop_235791_task.iterations = iterations;
    futhark_mc_segmap_parloop_235791_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235791_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235791_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235791_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235791_task);
    
    if (futhark_mc_segmap_parloop_235791_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235791_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235791_total_end -
                 futhark_mc_segmap_parloop_235791_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235791_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235791_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235791_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235789_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235789_end -
                 futhark_mc_segmap_task_235789_start;
        
        ctx->futhark_mc_segmap_task_235789_runs[tid]++;
        ctx->futhark_mc_segmap_task_235789_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235789_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235795 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    unsigned char *free_mem_218481;
};
struct futhark_mc_task_235798 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    int64_t free_gtid_225915;
    int64_t free_x_225916;
    unsigned char *free_mem_225917;
};
struct futhark_mc_segmap_parloop_struct_235800 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    int64_t free_gtid_225915;
    int64_t free_x_225916;
    unsigned char *free_mem_225917;
};
static int futhark_mc_segmap_parloop_235801(void *args, int64_t start,
                                            int64_t end, int flat_tid_226204,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235800
    *futhark_mc_segmap_parloop_struct_235800 =
    (struct futhark_mc_segmap_parloop_struct_235800 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235800->ctx;
    uint64_t futhark_mc_segmap_parloop_235801_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235801_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235800->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235800->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235800->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235800->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235800->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235800->free_s_n_m_203636;
    int64_t gtid_210069 =
            futhark_mc_segmap_parloop_struct_235800->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235800->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235800->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235800->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235800->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235800->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 =
            futhark_mc_segmap_parloop_struct_235800->free_bytes_218428;
    int64_t gtid_225915 =
            futhark_mc_segmap_parloop_struct_235800->free_gtid_225915;
    int64_t x_225916 = futhark_mc_segmap_parloop_struct_235800->free_x_225916;
    struct memblock mem_225917 = {.desc ="mem_225917", .mem =
                                  futhark_mc_segmap_parloop_struct_235800->free_mem_225917,
                                  .size =0, .references =NULL};
    size_t mem_226218_cached_sizze_235802 = 0;
    unsigned char *mem_226218 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226260 = start;
    
    if (mem_226218_cached_sizze_235802 < (size_t) bytes_218428) {
        mem_226218 = realloc(mem_226218, bytes_218428);
        mem_226218_cached_sizze_235802 = bytes_218428;
    }
    for (; iter_226260 < end; iter_226260++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226302 = s_n_m_203636;
        int64_t gtid_226205 = iter_226260;
        int64_t remnant_226303 = iter_226260 - gtid_226205;
        int64_t x_226206;
        
        x_226206 = ((int64_t *) mem_217710.mem)[gtid_210069 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_225915 * s_n_m_203636 +
                                                gtid_226205];
        
        double x_226207;
        
        x_226207 = ((double *) mem_217715.mem)[gtid_210069 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_225915 * s_n_m_203636 +
                                               gtid_226205];
        
        bool cond_226208 = gtid_226205 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_226209;
        
        if (cond_226208) {
            defunc_0_m_fun_res_226209 = (int64_t) 0;
        } else {
            int64_t y_226261 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_226262 = gtid_226205 == y_226261;
            int64_t defunc_0_m_fun_res_f_res_226263;
            
            if (cond_226262) {
                int64_t defunc_0_m_fun_res_f_res_t_res_226264 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_226263 =
                    defunc_0_m_fun_res_f_res_t_res_226264;
            } else {
                int64_t x_226265 = sub64(gtid_226205, (int64_t) 1);
                int64_t x_226266 = mul64(jump_s_203499, x_226265);
                int64_t min_arg_226267 = add64((int64_t) 1, x_226266);
                int64_t min_res_226268 = smin64(defunc_0_f_res_203631,
                                                min_arg_226267);
                
                defunc_0_m_fun_res_f_res_226263 = min_res_226268;
            }
            defunc_0_m_fun_res_226209 = defunc_0_m_fun_res_f_res_226263;
        }
        
        double defunc_2_reduce_res_226220;
        double redout_226270 = 0.0;
        
        for (int64_t i_226269 = 0; i_226269 < q_s_203493; i_226269++) {
            bool cond_226272 = sle64(x_225916, i_226269);
            int64_t defunc_0_f_res_226273;
            
            if (cond_226272) {
                defunc_0_f_res_226273 = (int64_t) 0;
            } else {
                int64_t i_226274 = add64(x_226206, i_226269);
                int64_t defunc_0_add_arg_226275;
                
                defunc_0_add_arg_226275 =
                    ((int64_t *) mem_217536.mem)[gtid_210069 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_225915 *
                                                 defunc_0_f_res_203631 +
                                                 i_226274];
                
                int64_t defunc_1_add_res_226276 = add64((int64_t) 1,
                                                        defunc_0_add_arg_226275);
                
                defunc_0_f_res_226273 = defunc_1_add_res_226276;
            }
            
            double defunc_0_f_res_226277;
            
            if (cond_226272) {
                defunc_0_f_res_226277 = 0.0;
            } else {
                int64_t i_226278 = add64(x_226206, i_226269);
                double defunc_0_add_arg_226279;
                
                defunc_0_add_arg_226279 =
                    ((double *) mem_218057.mem)[gtid_210069 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_225915 *
                                                defunc_0_f_res_203631 +
                                                i_226278];
                defunc_0_f_res_226277 = defunc_0_add_arg_226279;
            }
            
            int64_t binop_p_226280 = sub64(defunc_0_f_res_226273,
                                           defunc_0_m_fun_res_226209);
            double defunc_0_f_res_226281 = sitofp_i64_f64(binop_p_226280);
            double abs_res_226282 = fabs(defunc_0_f_res_226281);
            double tmp1_226283 = abs_res_226282 / x_226207;
            double x_226284 = tmp1_226283 * tmp1_226283;
            double y_226285 = tmp1_226283 * x_226284;
            double tmp2_226286 = 1.0 - y_226285;
            double x_226287 = tmp2_226286 * tmp2_226286;
            double tmp3_226288 = tmp2_226286 * x_226287;
            double tmp4_226289 = defunc_0_f_res_226277 * tmp3_226288;
            double defunc_1_op_res_226290 = tmp4_226289 + redout_226270;
            
            ((double *) mem_226218)[i_226269] = tmp4_226289;
            
            double redout_tmp_226304 = defunc_1_op_res_226290;
            
            redout_226270 = redout_tmp_226304;
        }
        defunc_2_reduce_res_226220 = redout_226270;
        
        double a0_226245 = 1.0 / defunc_2_reduce_res_226220;
        double defunc_2_reduce_res_226246;
        double redout_226293 = 0.0;
        
        for (int64_t i_226292 = 0; i_226292 < q_s_203493; i_226292++) {
            double x_226294;
            
            x_226294 = ((double *) mem_226218)[i_226292];
            
            bool cond_226295 = sle64(x_225916, i_226292);
            double defunc_0_f_res_226296;
            
            if (cond_226295) {
                defunc_0_f_res_226296 = 0.0;
            } else {
                int64_t i_226297 = add64(x_226206, i_226292);
                double defunc_0_add_arg_226298;
                
                defunc_0_add_arg_226298 =
                    ((double *) mem_218052.mem)[gtid_210069 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_225915 *
                                                defunc_0_f_res_203631 +
                                                i_226297];
                defunc_0_f_res_226296 = defunc_0_add_arg_226298;
            }
            
            double x_226299 = a0_226245 * x_226294;
            double defunc_9_fit_fun_res_226300 = defunc_0_f_res_226296 *
                   x_226299;
            double defunc_1_op_res_226301 = defunc_9_fit_fun_res_226300 +
                   redout_226293;
            double redout_tmp_226306 = defunc_1_op_res_226301;
            
            redout_226293 = redout_tmp_226306;
        }
        defunc_2_reduce_res_226246 = redout_226293;
        ((double *) mem_225917.mem)[gtid_226205] = defunc_2_reduce_res_226246;
    }
    
  cleanup:
    { }
    free(mem_226218);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235801_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235801_end -
                 futhark_mc_segmap_parloop_235801_start;
        
        ctx->futhark_mc_segmap_parloop_235801_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235801_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235801_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235799(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226204 = tid;
    int num_tasks_226259 = info.nsubtasks;
    struct futhark_mc_task_235798 *futhark_mc_task_235798 =
                                  (struct futhark_mc_task_235798 *) args;
    struct futhark_context *ctx = futhark_mc_task_235798->ctx;
    uint64_t futhark_mc_segmap_task_235799_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235799_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235798->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235798->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235798->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235798->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235798->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235798->free_s_n_m_203636;
    int64_t gtid_210069 = futhark_mc_task_235798->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235798->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235798->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235798->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235798->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235798->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 = futhark_mc_task_235798->free_bytes_218428;
    int64_t gtid_225915 = futhark_mc_task_235798->free_gtid_225915;
    int64_t x_225916 = futhark_mc_task_235798->free_x_225916;
    struct memblock mem_225917 = {.desc ="mem_225917", .mem =
                                  futhark_mc_task_235798->free_mem_225917,
                                  .size =0, .references =NULL};
    int64_t iter_226260;
    struct futhark_mc_segmap_parloop_struct_235800
    futhark_mc_segmap_parloop_struct_235800;
    
    futhark_mc_segmap_parloop_struct_235800.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235800.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235800.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235800.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235800.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235800.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235800.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235800.free_gtid_210069 = gtid_210069;
    futhark_mc_segmap_parloop_struct_235800.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235800.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235800.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235800.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235800.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235800.free_bytes_218428 = bytes_218428;
    futhark_mc_segmap_parloop_struct_235800.free_gtid_225915 = gtid_225915;
    futhark_mc_segmap_parloop_struct_235800.free_x_225916 = x_225916;
    futhark_mc_segmap_parloop_struct_235800.free_mem_225917 = mem_225917.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235801_task;
    
    futhark_mc_segmap_parloop_235801_task.name =
        "futhark_mc_segmap_parloop_235801";
    futhark_mc_segmap_parloop_235801_task.fn = futhark_mc_segmap_parloop_235801;
    futhark_mc_segmap_parloop_235801_task.args =
        &futhark_mc_segmap_parloop_struct_235800;
    futhark_mc_segmap_parloop_235801_task.iterations = iterations;
    futhark_mc_segmap_parloop_235801_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235801_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235801_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235801_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235801_task);
    
    if (futhark_mc_segmap_parloop_235801_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235801_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235801_total_end -
                 futhark_mc_segmap_parloop_235801_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235801_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235801_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235801_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235799_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235799_end -
                 futhark_mc_segmap_task_235799_start;
        
        ctx->futhark_mc_segmap_task_235799_runs[tid]++;
        ctx->futhark_mc_segmap_task_235799_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235799_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235804 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218428;
    int64_t free_gtid_225915;
    int64_t free_x_225916;
    unsigned char *free_mem_225917;
};
struct futhark_mc_task_235807 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_225915;
    int64_t free_x_225916;
    int64_t free_x_226152;
    double free_x_226153;
    int64_t free_defunc_0_m_fun_res_226155;
    double *retval_defunc_2_reduce_res_226165;
    unsigned char *retval_mem_226164;
};
struct futhark_mc_segred_stage_1_parloop_struct_235810 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210069;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_225915;
    int64_t free_x_225916;
    int64_t free_x_226152;
    double free_x_226153;
    int64_t free_defunc_0_m_fun_res_226155;
    unsigned char *free_mem_226164;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_226354;
};
static int futhark_mc_segred_stage_1_parloop_235811(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_226316,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235810
    *futhark_mc_segred_stage_1_parloop_struct_235810 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235810 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235810->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235811_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235811_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235810->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235810->free_defunc_0_f_res_203631;
    int64_t gtid_210069 =
            futhark_mc_segred_stage_1_parloop_struct_235810->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235810->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235810->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_225915 =
            futhark_mc_segred_stage_1_parloop_struct_235810->free_gtid_225915;
    int64_t x_225916 =
            futhark_mc_segred_stage_1_parloop_struct_235810->free_x_225916;
    int64_t x_226152 =
            futhark_mc_segred_stage_1_parloop_struct_235810->free_x_226152;
    double x_226153 =
           futhark_mc_segred_stage_1_parloop_struct_235810->free_x_226153;
    int64_t defunc_0_m_fun_res_226155 =
            futhark_mc_segred_stage_1_parloop_struct_235810->free_defunc_0_m_fun_res_226155;
    struct memblock mem_226164 = {.desc ="mem_226164", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235810->free_mem_226164,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_226354 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_226354",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235810->free_reduce_stage_1_tid_res_arr_mem_226354,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_226356 = start;
    double x_226318;
    double x_226319;
    double local_acc_226357 = 0.0;
    
    for (; iter_226356 < end; iter_226356++) {
        int64_t gtid_226317 = iter_226356;
        bool cond_226321 = sle64(x_225916, gtid_226317);
        int64_t defunc_0_f_res_226322;
        
        if (cond_226321) {
            defunc_0_f_res_226322 = (int64_t) 0;
        } else {
            int64_t i_226323 = add64(x_226152, gtid_226317);
            int64_t defunc_0_add_arg_226324;
            
            defunc_0_add_arg_226324 = ((int64_t *) mem_217536.mem)[gtid_210069 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_225915 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_226323];
            
            int64_t defunc_1_add_res_226325 = add64((int64_t) 1,
                                                    defunc_0_add_arg_226324);
            
            defunc_0_f_res_226322 = defunc_1_add_res_226325;
        }
        
        double defunc_0_f_res_226326;
        
        if (cond_226321) {
            defunc_0_f_res_226326 = 0.0;
        } else {
            int64_t i_226327 = add64(x_226152, gtid_226317);
            double defunc_0_add_arg_226328;
            
            defunc_0_add_arg_226328 = ((double *) mem_218057.mem)[gtid_210069 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_225915 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_226327];
            defunc_0_f_res_226326 = defunc_0_add_arg_226328;
        }
        
        int64_t binop_p_226329 = sub64(defunc_0_f_res_226322,
                                       defunc_0_m_fun_res_226155);
        double defunc_0_f_res_226330 = sitofp_i64_f64(binop_p_226329);
        double abs_res_226331 = fabs(defunc_0_f_res_226330);
        double tmp1_226332 = abs_res_226331 / x_226153;
        double x_226333 = tmp1_226332 * tmp1_226332;
        double y_226334 = tmp1_226332 * x_226333;
        double tmp2_226335 = 1.0 - y_226334;
        double x_226336 = tmp2_226335 * tmp2_226335;
        double tmp3_226337 = tmp2_226335 * x_226336;
        double tmp4_226338 = defunc_0_f_res_226326 * tmp3_226337;
        
        // save map-out results
        {
            ((double *) mem_226164.mem)[gtid_226317] = tmp4_226338;
        }
        // Load accum params
        {
            x_226318 = local_acc_226357;
        }
        // Load next params
        {
            x_226319 = tmp4_226338;
        }
        // Red body
        {
            double defunc_1_op_res_226320 = x_226318 + x_226319;
            
            local_acc_226357 = defunc_1_op_res_226320;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_226354.mem)[flat_tid_226316] =
        local_acc_226357;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235811_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235811_end -
                 futhark_mc_segred_stage_1_parloop_235811_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235811_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235811_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235811_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235808(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226316 = tid;
    int num_tasks_226353 = info.nsubtasks;
    struct futhark_mc_task_235807 *futhark_mc_task_235807 =
                                  (struct futhark_mc_task_235807 *) args;
    struct futhark_context *ctx = futhark_mc_task_235807->ctx;
    uint64_t futhark_mc_segred_task_235808_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235808_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235807->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235807->free_defunc_0_f_res_203631;
    int64_t gtid_210069 = futhark_mc_task_235807->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235807->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235807->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_225915 = futhark_mc_task_235807->free_gtid_225915;
    int64_t x_225916 = futhark_mc_task_235807->free_x_225916;
    int64_t x_226152 = futhark_mc_task_235807->free_x_226152;
    double x_226153 = futhark_mc_task_235807->free_x_226153;
    int64_t defunc_0_m_fun_res_226155 =
            futhark_mc_task_235807->free_defunc_0_m_fun_res_226155;
    double defunc_2_reduce_res_226165 =
           *futhark_mc_task_235807->retval_defunc_2_reduce_res_226165;
    struct memblock mem_226164 = {.desc ="mem_226164", .mem =
                                  futhark_mc_task_235807->retval_mem_226164,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_226354_cached_sizze_235809 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_226354 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_226354_cached_sizze_235809 <
        (size_t) ((int64_t) 8 * num_tasks_226353)) {
        reduce_stage_1_tid_res_arr_mem_226354 =
            realloc(reduce_stage_1_tid_res_arr_mem_226354, (int64_t) 8 *
                    num_tasks_226353);
        reduce_stage_1_tid_res_arr_mem_226354_cached_sizze_235809 =
            (int64_t) 8 * num_tasks_226353;
    }
    
    int64_t iter_226356;
    struct futhark_mc_segred_stage_1_parloop_struct_235810
    futhark_mc_segred_stage_1_parloop_struct_235810;
    
    futhark_mc_segred_stage_1_parloop_struct_235810.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_gtid_210069 =
        gtid_210069;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_gtid_225915 =
        gtid_225915;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_x_225916 = x_225916;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_x_226152 = x_226152;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_x_226153 = x_226153;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_defunc_0_m_fun_res_226155 =
        defunc_0_m_fun_res_226155;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_mem_226164 =
        mem_226164.mem;
    futhark_mc_segred_stage_1_parloop_struct_235810.free_reduce_stage_1_tid_res_arr_mem_226354 =
        reduce_stage_1_tid_res_arr_mem_226354;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235811_task;
    
    futhark_mc_segred_stage_1_parloop_235811_task.name =
        "futhark_mc_segred_stage_1_parloop_235811";
    futhark_mc_segred_stage_1_parloop_235811_task.fn =
        futhark_mc_segred_stage_1_parloop_235811;
    futhark_mc_segred_stage_1_parloop_235811_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235810;
    futhark_mc_segred_stage_1_parloop_235811_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235811_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235811_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235811_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235811_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235811_task);
    
    if (futhark_mc_segred_stage_1_parloop_235811_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235811_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235811_total_end -
                 futhark_mc_segred_stage_1_parloop_235811_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235811_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235811_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235811_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_226165 = 0.0;
    }
    
    double x_226358;
    double x_226359;
    
    for (int32_t i_226361 = 0; i_226361 < num_tasks_226353; i_226361++) {
        flat_tid_226316 = i_226361;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_226358 = defunc_2_reduce_res_226165;
            }
            // load next params
            {
                x_226359 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_226354)[flat_tid_226316];
            }
            // red body
            {
                double defunc_1_op_res_226360 = x_226358 + x_226359;
                
                defunc_2_reduce_res_226165 = defunc_1_op_res_226360;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_226354);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235808_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235808_end -
                 futhark_mc_segred_task_235808_start;
        
        ctx->futhark_mc_segred_task_235808_runs[tid]++;
        ctx->futhark_mc_segred_task_235808_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235808_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235807->retval_defunc_2_reduce_res_226165 =
            defunc_2_reduce_res_226165;
        futhark_mc_task_235807->retval_mem_226164 = mem_226164.mem;
    }
    return err;
}
struct futhark_mc_task_235812 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210069;
    unsigned char *free_mem_218052;
    int64_t free_gtid_225915;
    int64_t free_x_225916;
    int64_t free_x_226152;
    unsigned char *free_mem_226164;
    double free_a0_226190;
    double *retval_defunc_2_reduce_res_226191;
};
struct futhark_mc_segred_stage_1_parloop_struct_235815 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210069;
    unsigned char *free_mem_218052;
    int64_t free_gtid_225915;
    int64_t free_x_225916;
    int64_t free_x_226152;
    unsigned char *free_mem_226164;
    double free_a0_226190;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_226363;
};
static int futhark_mc_segred_stage_1_parloop_235816(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_226339,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235815
    *futhark_mc_segred_stage_1_parloop_struct_235815 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235815 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235815->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235816_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235816_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235815->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235815->free_defunc_0_f_res_203631;
    int64_t gtid_210069 =
            futhark_mc_segred_stage_1_parloop_struct_235815->free_gtid_210069;
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235815->free_mem_218052,
                                  .size =0, .references =NULL};
    int64_t gtid_225915 =
            futhark_mc_segred_stage_1_parloop_struct_235815->free_gtid_225915;
    int64_t x_225916 =
            futhark_mc_segred_stage_1_parloop_struct_235815->free_x_225916;
    int64_t x_226152 =
            futhark_mc_segred_stage_1_parloop_struct_235815->free_x_226152;
    struct memblock mem_226164 = {.desc ="mem_226164", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235815->free_mem_226164,
                                  .size =0, .references =NULL};
    double a0_226190 =
           futhark_mc_segred_stage_1_parloop_struct_235815->free_a0_226190;
    struct memblock reduce_stage_1_tid_res_arr_mem_226363 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_226363",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235815->free_reduce_stage_1_tid_res_arr_mem_226363,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_226365 = start;
    double x_226341;
    double x_226342;
    double local_acc_226366 = 0.0;
    
    for (; iter_226365 < end; iter_226365++) {
        int64_t gtid_226340 = iter_226365;
        double x_226344;
        
        x_226344 = ((double *) mem_226164.mem)[gtid_226340];
        
        bool cond_226345 = sle64(x_225916, gtid_226340);
        double defunc_0_f_res_226346;
        
        if (cond_226345) {
            defunc_0_f_res_226346 = 0.0;
        } else {
            int64_t i_226347 = add64(x_226152, gtid_226340);
            double defunc_0_add_arg_226348;
            
            defunc_0_add_arg_226348 = ((double *) mem_218052.mem)[gtid_210069 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_225915 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_226347];
            defunc_0_f_res_226346 = defunc_0_add_arg_226348;
        }
        
        double x_226349 = a0_226190 * x_226344;
        double defunc_9_fit_fun_res_226350 = defunc_0_f_res_226346 * x_226349;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_226341 = local_acc_226366;
        }
        // Load next params
        {
            x_226342 = defunc_9_fit_fun_res_226350;
        }
        // Red body
        {
            double defunc_1_op_res_226343 = x_226341 + x_226342;
            
            local_acc_226366 = defunc_1_op_res_226343;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_226363.mem)[flat_tid_226339] =
        local_acc_226366;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235816_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235816_end -
                 futhark_mc_segred_stage_1_parloop_235816_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235816_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235816_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235816_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235813(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226339 = tid;
    int num_tasks_226362 = info.nsubtasks;
    struct futhark_mc_task_235812 *futhark_mc_task_235812 =
                                  (struct futhark_mc_task_235812 *) args;
    struct futhark_context *ctx = futhark_mc_task_235812->ctx;
    uint64_t futhark_mc_segred_task_235813_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235813_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235812->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235812->free_defunc_0_f_res_203631;
    int64_t gtid_210069 = futhark_mc_task_235812->free_gtid_210069;
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235812->free_mem_218052,
                                  .size =0, .references =NULL};
    int64_t gtid_225915 = futhark_mc_task_235812->free_gtid_225915;
    int64_t x_225916 = futhark_mc_task_235812->free_x_225916;
    int64_t x_226152 = futhark_mc_task_235812->free_x_226152;
    struct memblock mem_226164 = {.desc ="mem_226164", .mem =
                                  futhark_mc_task_235812->free_mem_226164,
                                  .size =0, .references =NULL};
    double a0_226190 = futhark_mc_task_235812->free_a0_226190;
    double defunc_2_reduce_res_226191 =
           *futhark_mc_task_235812->retval_defunc_2_reduce_res_226191;
    size_t reduce_stage_1_tid_res_arr_mem_226363_cached_sizze_235814 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_226363 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_226363_cached_sizze_235814 <
        (size_t) ((int64_t) 8 * num_tasks_226362)) {
        reduce_stage_1_tid_res_arr_mem_226363 =
            realloc(reduce_stage_1_tid_res_arr_mem_226363, (int64_t) 8 *
                    num_tasks_226362);
        reduce_stage_1_tid_res_arr_mem_226363_cached_sizze_235814 =
            (int64_t) 8 * num_tasks_226362;
    }
    
    int64_t iter_226365;
    struct futhark_mc_segred_stage_1_parloop_struct_235815
    futhark_mc_segred_stage_1_parloop_struct_235815;
    
    futhark_mc_segred_stage_1_parloop_struct_235815.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_gtid_210069 =
        gtid_210069;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_mem_218052 =
        mem_218052.mem;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_gtid_225915 =
        gtid_225915;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_x_225916 = x_225916;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_x_226152 = x_226152;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_mem_226164 =
        mem_226164.mem;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_a0_226190 = a0_226190;
    futhark_mc_segred_stage_1_parloop_struct_235815.free_reduce_stage_1_tid_res_arr_mem_226363 =
        reduce_stage_1_tid_res_arr_mem_226363;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235816_task;
    
    futhark_mc_segred_stage_1_parloop_235816_task.name =
        "futhark_mc_segred_stage_1_parloop_235816";
    futhark_mc_segred_stage_1_parloop_235816_task.fn =
        futhark_mc_segred_stage_1_parloop_235816;
    futhark_mc_segred_stage_1_parloop_235816_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235815;
    futhark_mc_segred_stage_1_parloop_235816_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235816_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235816_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235816_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235816_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235816_task);
    
    if (futhark_mc_segred_stage_1_parloop_235816_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235816_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235816_total_end -
                 futhark_mc_segred_stage_1_parloop_235816_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235816_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235816_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235816_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_226191 = 0.0;
    }
    
    double x_226367;
    double x_226368;
    
    for (int32_t i_226370 = 0; i_226370 < num_tasks_226362; i_226370++) {
        flat_tid_226339 = i_226370;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_226367 = defunc_2_reduce_res_226191;
            }
            // load next params
            {
                x_226368 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_226363)[flat_tid_226339];
            }
            // red body
            {
                double defunc_1_op_res_226369 = x_226367 + x_226368;
                
                defunc_2_reduce_res_226191 = defunc_1_op_res_226369;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_226363);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235813_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235813_end -
                 futhark_mc_segred_task_235813_start;
        
        ctx->futhark_mc_segred_task_235813_runs[tid]++;
        ctx->futhark_mc_segred_task_235813_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235813_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235812->retval_defunc_2_reduce_res_226191 =
            defunc_2_reduce_res_226191;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235805(void *args, int64_t start,
                                            int64_t end, int flat_tid_226150,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235804
    *futhark_mc_segmap_parloop_struct_235804 =
    (struct futhark_mc_segmap_parloop_struct_235804 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235804->ctx;
    uint64_t futhark_mc_segmap_parloop_235805_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235805_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235804->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235804->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235804->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235804->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235804->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235804->free_s_n_m_203636;
    int64_t gtid_210069 =
            futhark_mc_segmap_parloop_struct_235804->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235804->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235804->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235804->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235804->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235804->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 =
            futhark_mc_segmap_parloop_struct_235804->free_bytes_218428;
    int64_t gtid_225915 =
            futhark_mc_segmap_parloop_struct_235804->free_gtid_225915;
    int64_t x_225916 = futhark_mc_segmap_parloop_struct_235804->free_x_225916;
    struct memblock mem_225917 = {.desc ="mem_225917", .mem =
                                  futhark_mc_segmap_parloop_struct_235804->free_mem_225917,
                                  .size =0, .references =NULL};
    size_t mem_226164_cached_sizze_235806 = 0;
    unsigned char *mem_226164 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226307 = start;
    
    if (mem_226164_cached_sizze_235806 < (size_t) bytes_218428) {
        mem_226164 = realloc(mem_226164, bytes_218428);
        mem_226164_cached_sizze_235806 = bytes_218428;
    }
    for (; iter_226307 < end; iter_226307++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226351 = s_n_m_203636;
        int64_t gtid_226151 = iter_226307;
        int64_t remnant_226352 = iter_226307 - gtid_226151;
        int64_t x_226152;
        
        x_226152 = ((int64_t *) mem_217710.mem)[gtid_210069 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_225915 * s_n_m_203636 +
                                                gtid_226151];
        
        double x_226153;
        
        x_226153 = ((double *) mem_217715.mem)[gtid_210069 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_225915 * s_n_m_203636 +
                                               gtid_226151];
        
        bool cond_226154 = gtid_226151 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_226155;
        
        if (cond_226154) {
            defunc_0_m_fun_res_226155 = (int64_t) 0;
        } else {
            int64_t y_226308 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_226309 = gtid_226151 == y_226308;
            int64_t defunc_0_m_fun_res_f_res_226310;
            
            if (cond_226309) {
                int64_t defunc_0_m_fun_res_f_res_t_res_226311 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_226310 =
                    defunc_0_m_fun_res_f_res_t_res_226311;
            } else {
                int64_t x_226312 = sub64(gtid_226151, (int64_t) 1);
                int64_t x_226313 = mul64(jump_s_203499, x_226312);
                int64_t min_arg_226314 = add64((int64_t) 1, x_226313);
                int64_t min_res_226315 = smin64(defunc_0_f_res_203631,
                                                min_arg_226314);
                
                defunc_0_m_fun_res_f_res_226310 = min_res_226315;
            }
            defunc_0_m_fun_res_226155 = defunc_0_m_fun_res_f_res_226310;
        }
        
        double defunc_2_reduce_res_226165;
        int64_t flat_tid_226316 = (int64_t) 0;
        int32_t num_tasks_226353;
        
        defunc_2_reduce_res_226165 = 0.0;
        
        struct futhark_mc_task_235807 futhark_mc_task_235807;
        
        futhark_mc_task_235807.ctx = ctx;
        futhark_mc_task_235807.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235807.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235807.free_gtid_210069 = gtid_210069;
        futhark_mc_task_235807.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235807.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235807.free_gtid_225915 = gtid_225915;
        futhark_mc_task_235807.free_x_225916 = x_225916;
        futhark_mc_task_235807.free_x_226152 = x_226152;
        futhark_mc_task_235807.free_x_226153 = x_226153;
        futhark_mc_task_235807.free_defunc_0_m_fun_res_226155 =
            defunc_0_m_fun_res_226155;
        futhark_mc_task_235807.retval_defunc_2_reduce_res_226165 =
            &defunc_2_reduce_res_226165;
        futhark_mc_task_235807.retval_mem_226164 = mem_226164;
        
        struct scheduler_segop futhark_mc_task_235807_task;
        
        futhark_mc_task_235807_task.args = &futhark_mc_task_235807;
        futhark_mc_task_235807_task.top_level_fn =
            futhark_mc_segred_task_235808;
        futhark_mc_task_235807_task.name = "futhark_mc_segred_task_235808";
        futhark_mc_task_235807_task.iterations = q_s_203493;
        futhark_mc_task_235807_task.task_time =
            &ctx->futhark_mc_segred_task_235808_total_time;
        futhark_mc_task_235807_task.task_iter =
            &ctx->futhark_mc_segred_task_235808_total_iter;
        futhark_mc_task_235807_task.sched = STATIC;
        futhark_mc_task_235807_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235808_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235807_task);
        
        if (futhark_mc_segred_task_235808_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_226190 = 1.0 / defunc_2_reduce_res_226165;
        double defunc_2_reduce_res_226191;
        int64_t flat_tid_226339 = (int64_t) 0;
        int32_t num_tasks_226362;
        
        defunc_2_reduce_res_226191 = 0.0;
        
        struct futhark_mc_task_235812 futhark_mc_task_235812;
        
        futhark_mc_task_235812.ctx = ctx;
        futhark_mc_task_235812.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235812.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235812.free_gtid_210069 = gtid_210069;
        futhark_mc_task_235812.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235812.free_gtid_225915 = gtid_225915;
        futhark_mc_task_235812.free_x_225916 = x_225916;
        futhark_mc_task_235812.free_x_226152 = x_226152;
        futhark_mc_task_235812.free_mem_226164 = mem_226164;
        futhark_mc_task_235812.free_a0_226190 = a0_226190;
        futhark_mc_task_235812.retval_defunc_2_reduce_res_226191 =
            &defunc_2_reduce_res_226191;
        
        struct scheduler_segop futhark_mc_task_235812_task;
        
        futhark_mc_task_235812_task.args = &futhark_mc_task_235812;
        futhark_mc_task_235812_task.top_level_fn =
            futhark_mc_segred_task_235813;
        futhark_mc_task_235812_task.name = "futhark_mc_segred_task_235813";
        futhark_mc_task_235812_task.iterations = q_s_203493;
        futhark_mc_task_235812_task.task_time =
            &ctx->futhark_mc_segred_task_235813_total_time;
        futhark_mc_task_235812_task.task_iter =
            &ctx->futhark_mc_segred_task_235813_total_iter;
        futhark_mc_task_235812_task.sched = STATIC;
        futhark_mc_task_235812_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235813_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235812_task);
        
        if (futhark_mc_segred_task_235813_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_225917.mem)[gtid_226151] = defunc_2_reduce_res_226191;
    }
    
  cleanup:
    { }
    free(mem_226164);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235805_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235805_end -
                 futhark_mc_segmap_parloop_235805_start;
        
        ctx->futhark_mc_segmap_parloop_235805_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235805_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235805_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235803(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226150 = tid;
    int num_tasks_226259 = info.nsubtasks;
    struct futhark_mc_task_235798 *futhark_mc_task_235798 =
                                  (struct futhark_mc_task_235798 *) args;
    struct futhark_context *ctx = futhark_mc_task_235798->ctx;
    uint64_t futhark_mc_segmap_nested_task_235803_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235803_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235798->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235798->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235798->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235798->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235798->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235798->free_s_n_m_203636;
    int64_t gtid_210069 = futhark_mc_task_235798->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235798->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235798->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235798->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235798->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235798->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 = futhark_mc_task_235798->free_bytes_218428;
    int64_t gtid_225915 = futhark_mc_task_235798->free_gtid_225915;
    int64_t x_225916 = futhark_mc_task_235798->free_x_225916;
    struct memblock mem_225917 = {.desc ="mem_225917", .mem =
                                  futhark_mc_task_235798->free_mem_225917,
                                  .size =0, .references =NULL};
    int64_t iter_226307;
    struct futhark_mc_segmap_parloop_struct_235804
    futhark_mc_segmap_parloop_struct_235804;
    
    futhark_mc_segmap_parloop_struct_235804.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235804.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235804.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235804.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235804.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235804.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235804.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235804.free_gtid_210069 = gtid_210069;
    futhark_mc_segmap_parloop_struct_235804.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235804.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235804.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235804.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235804.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235804.free_bytes_218428 = bytes_218428;
    futhark_mc_segmap_parloop_struct_235804.free_gtid_225915 = gtid_225915;
    futhark_mc_segmap_parloop_struct_235804.free_x_225916 = x_225916;
    futhark_mc_segmap_parloop_struct_235804.free_mem_225917 = mem_225917.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235805_task;
    
    futhark_mc_segmap_parloop_235805_task.name =
        "futhark_mc_segmap_parloop_235805";
    futhark_mc_segmap_parloop_235805_task.fn = futhark_mc_segmap_parloop_235805;
    futhark_mc_segmap_parloop_235805_task.args =
        &futhark_mc_segmap_parloop_struct_235804;
    futhark_mc_segmap_parloop_235805_task.iterations = iterations;
    futhark_mc_segmap_parloop_235805_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235805_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235805_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235805_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235805_task);
    
    if (futhark_mc_segmap_parloop_235805_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235805_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235805_total_end -
                 futhark_mc_segmap_parloop_235805_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235805_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235805_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235805_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235803_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235803_end -
                 futhark_mc_segmap_nested_task_235803_start;
        
        ctx->futhark_mc_segmap_nested_task_235803_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235803_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235803_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235796(void *args, int64_t start,
                                            int64_t end, int flat_tid_225914,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235795
    *futhark_mc_segmap_parloop_struct_235795 =
    (struct futhark_mc_segmap_parloop_struct_235795 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235795->ctx;
    uint64_t futhark_mc_segmap_parloop_235796_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235796_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235795->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235795->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235795->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235795->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235795->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235795->free_s_n_m_203636;
    int64_t gtid_210069 =
            futhark_mc_segmap_parloop_struct_235795->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235795->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235795->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235795->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235795->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235795->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235795->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235795->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 =
            futhark_mc_segmap_parloop_struct_235795->free_bytes_218428;
    struct memblock mem_218481 = {.desc ="mem_218481", .mem =
                                  futhark_mc_segmap_parloop_struct_235795->free_mem_218481,
                                  .size =0, .references =NULL};
    size_t mem_225917_cached_sizze_235797 = 0;
    unsigned char *mem_225917 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226149 = start;
    
    if (mem_225917_cached_sizze_235797 < (size_t) bytes_217545) {
        mem_225917 = realloc(mem_225917, bytes_217545);
        mem_225917_cached_sizze_235797 = bytes_217545;
    }
    for (; iter_226149 < end; iter_226149++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226257 = n_p_203492;
        int64_t gtid_225915 = iter_226149;
        int64_t remnant_226258 = iter_226149 - gtid_225915;
        int64_t x_225916;
        
        x_225916 = ((int64_t *) mem_217540.mem)[gtid_210069 * n_p_203492 +
                                                gtid_225915];
        
        int64_t flat_tid_226204 = (int64_t) 0;
        int32_t num_tasks_226259;
        int64_t flat_tid_226150 = (int64_t) 0;
        struct futhark_mc_task_235798 futhark_mc_task_235798;
        
        futhark_mc_task_235798.ctx = ctx;
        futhark_mc_task_235798.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235798.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235798.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235798.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235798.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235798.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235798.free_gtid_210069 = gtid_210069;
        futhark_mc_task_235798.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235798.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235798.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235798.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235798.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235798.free_bytes_218428 = bytes_218428;
        futhark_mc_task_235798.free_gtid_225915 = gtid_225915;
        futhark_mc_task_235798.free_x_225916 = x_225916;
        futhark_mc_task_235798.free_mem_225917 = mem_225917;
        
        struct scheduler_segop futhark_mc_task_235798_task;
        
        futhark_mc_task_235798_task.args = &futhark_mc_task_235798;
        futhark_mc_task_235798_task.top_level_fn =
            futhark_mc_segmap_task_235799;
        futhark_mc_task_235798_task.name = "futhark_mc_segmap_task_235799";
        futhark_mc_task_235798_task.iterations = s_n_m_203636;
        futhark_mc_task_235798_task.task_time =
            &ctx->futhark_mc_segmap_task_235799_total_time;
        futhark_mc_task_235798_task.task_iter =
            &ctx->futhark_mc_segmap_task_235799_total_iter;
        futhark_mc_task_235798_task.sched = STATIC;
        futhark_mc_task_235798_task.nested_fn =
            futhark_mc_segmap_nested_task_235803;
        
        int futhark_mc_segmap_task_235799_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235798_task);
        
        if (futhark_mc_segmap_task_235799_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218481.mem + gtid_225915 * s_n_m_203636 * (int64_t) 8,
                    mem_225917 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_225917);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235796_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235796_end -
                 futhark_mc_segmap_parloop_235796_start;
        
        ctx->futhark_mc_segmap_parloop_235796_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235796_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235796_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235794(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225914 = tid;
    int num_tasks_226088 = info.nsubtasks;
    struct futhark_mc_task_235788 *futhark_mc_task_235788 =
                                  (struct futhark_mc_task_235788 *) args;
    struct futhark_context *ctx = futhark_mc_task_235788->ctx;
    uint64_t futhark_mc_segmap_nested_task_235794_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235794_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235788->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235788->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235788->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235788->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235788->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235788->free_s_n_m_203636;
    int64_t gtid_210069 = futhark_mc_task_235788->free_gtid_210069;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235788->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235788->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235788->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235788->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235788->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235788->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235788->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 = futhark_mc_task_235788->free_bytes_218428;
    struct memblock mem_218481 = {.desc ="mem_218481", .mem =
                                  futhark_mc_task_235788->free_mem_218481,
                                  .size =0, .references =NULL};
    int64_t iter_226149;
    struct futhark_mc_segmap_parloop_struct_235795
    futhark_mc_segmap_parloop_struct_235795;
    
    futhark_mc_segmap_parloop_struct_235795.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235795.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235795.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235795.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235795.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235795.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235795.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235795.free_gtid_210069 = gtid_210069;
    futhark_mc_segmap_parloop_struct_235795.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235795.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235795.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235795.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235795.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235795.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235795.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235795.free_bytes_218428 = bytes_218428;
    futhark_mc_segmap_parloop_struct_235795.free_mem_218481 = mem_218481.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235796_task;
    
    futhark_mc_segmap_parloop_235796_task.name =
        "futhark_mc_segmap_parloop_235796";
    futhark_mc_segmap_parloop_235796_task.fn = futhark_mc_segmap_parloop_235796;
    futhark_mc_segmap_parloop_235796_task.args =
        &futhark_mc_segmap_parloop_struct_235795;
    futhark_mc_segmap_parloop_235796_task.iterations = iterations;
    futhark_mc_segmap_parloop_235796_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235796_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235796_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235796_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235796_task);
    
    if (futhark_mc_segmap_parloop_235796_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235796_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235796_total_end -
                 futhark_mc_segmap_parloop_235796_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235796_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235796_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235796_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235794_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235794_end -
                 futhark_mc_segmap_nested_task_235794_start;
        
        ctx->futhark_mc_segmap_nested_task_235794_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235794_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235794_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235786(void *args, int64_t start,
                                            int64_t end, int flat_tid_210068,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235785
    *futhark_mc_segmap_parloop_struct_235785 =
    (struct futhark_mc_segmap_parloop_struct_235785 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235785->ctx;
    uint64_t futhark_mc_segmap_parloop_235786_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235786_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235785->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235785->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235785->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235785->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235785->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235785->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235785->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235785->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235785->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235785->free_bytes_217545;
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235785->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235785->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235785->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235785->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235785->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 =
            futhark_mc_segmap_parloop_struct_235785->free_bytes_218428;
    struct memblock mem_218545 = {.desc ="mem_218545", .mem =
                                  futhark_mc_segmap_parloop_struct_235785->free_mem_218545,
                                  .size =0, .references =NULL};
    size_t mem_218481_cached_sizze_235787 = 0;
    unsigned char *mem_218481 = NULL;
    int64_t iterations = end - start;
    int64_t iter_225913 = start;
    
    if (mem_218481_cached_sizze_235787 < (size_t) bytes_217597) {
        mem_218481 = realloc(mem_218481, bytes_217597);
        mem_218481_cached_sizze_235787 = bytes_217597;
    }
    for (; iter_225913 < end; iter_225913++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226086 = partition_sizze_203577;
        int64_t gtid_210069 = iter_225913;
        int64_t remnant_226087 = iter_225913 - gtid_210069;
        int64_t flat_tid_226026 = (int64_t) 0;
        int32_t num_tasks_226088;
        int64_t flat_tid_225914 = (int64_t) 0;
        struct futhark_mc_task_235788 futhark_mc_task_235788;
        
        futhark_mc_task_235788.ctx = ctx;
        futhark_mc_task_235788.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235788.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235788.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235788.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235788.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235788.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235788.free_gtid_210069 = gtid_210069;
        futhark_mc_task_235788.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235788.free_mem_217540 = mem_217540.mem;
        futhark_mc_task_235788.free_bytes_217545 = bytes_217545;
        futhark_mc_task_235788.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235788.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235788.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235788.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235788.free_bytes_218428 = bytes_218428;
        futhark_mc_task_235788.free_mem_218481 = mem_218481;
        
        struct scheduler_segop futhark_mc_task_235788_task;
        
        futhark_mc_task_235788_task.args = &futhark_mc_task_235788;
        futhark_mc_task_235788_task.top_level_fn =
            futhark_mc_segmap_task_235789;
        futhark_mc_task_235788_task.name = "futhark_mc_segmap_task_235789";
        futhark_mc_task_235788_task.iterations = n_p_203492;
        futhark_mc_task_235788_task.task_time =
            &ctx->futhark_mc_segmap_task_235789_total_time;
        futhark_mc_task_235788_task.task_iter =
            &ctx->futhark_mc_segmap_task_235789_total_iter;
        futhark_mc_task_235788_task.sched = STATIC;
        futhark_mc_task_235788_task.nested_fn =
            futhark_mc_segmap_nested_task_235794;
        
        int futhark_mc_segmap_task_235789_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235788_task);
        
        if (futhark_mc_segmap_task_235789_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218545.mem + gtid_210069 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218481 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218481);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235786_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235786_end -
                 futhark_mc_segmap_parloop_235786_start;
        
        ctx->futhark_mc_segmap_parloop_235786_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235786_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235786_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235784(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210068 = tid;
    int num_tasks_225847 = info.nsubtasks;
    struct futhark_mc_task_235778 *futhark_mc_task_235778 =
                                  (struct futhark_mc_task_235778 *) args;
    struct futhark_context *ctx = futhark_mc_task_235778->ctx;
    uint64_t futhark_mc_segmap_nested_task_235784_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235784_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235778->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235778->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235778->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235778->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235778->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235778->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235778->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235778->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235778->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235778->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235778->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235778->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235778->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235778->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235778->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218428 = futhark_mc_task_235778->free_bytes_218428;
    struct memblock mem_218545 = {.desc ="mem_218545", .mem =
                                  futhark_mc_task_235778->free_mem_218545,
                                  .size =0, .references =NULL};
    int64_t iter_225913;
    struct futhark_mc_segmap_parloop_struct_235785
    futhark_mc_segmap_parloop_struct_235785;
    
    futhark_mc_segmap_parloop_struct_235785.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235785.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235785.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235785.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235785.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235785.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235785.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235785.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235785.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235785.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235785.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235785.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235785.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235785.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235785.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235785.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235785.free_bytes_218428 = bytes_218428;
    futhark_mc_segmap_parloop_struct_235785.free_mem_218545 = mem_218545.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235786_task;
    
    futhark_mc_segmap_parloop_235786_task.name =
        "futhark_mc_segmap_parloop_235786";
    futhark_mc_segmap_parloop_235786_task.fn = futhark_mc_segmap_parloop_235786;
    futhark_mc_segmap_parloop_235786_task.args =
        &futhark_mc_segmap_parloop_struct_235785;
    futhark_mc_segmap_parloop_235786_task.iterations = iterations;
    futhark_mc_segmap_parloop_235786_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235786_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235786_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235786_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235786_task);
    
    if (futhark_mc_segmap_parloop_235786_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235786_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235786_total_end -
                 futhark_mc_segmap_parloop_235786_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235786_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235786_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235786_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235784_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235784_end -
                 futhark_mc_segmap_nested_task_235784_start;
        
        ctx->futhark_mc_segmap_nested_task_235784_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235784_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235784_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235817 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    unsigned char *free_mem_218778;
    unsigned char *free_mem_218783;
};
struct futhark_mc_segmap_parloop_struct_235819 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    unsigned char *free_mem_218778;
    unsigned char *free_mem_218783;
};
static int futhark_mc_segmap_parloop_235820(void *args, int64_t start,
                                            int64_t end, int flat_tid_210253,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235819
    *futhark_mc_segmap_parloop_struct_235819 =
    (struct futhark_mc_segmap_parloop_struct_235819 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235819->ctx;
    uint64_t futhark_mc_segmap_parloop_235820_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235820_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235819->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235819->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235819->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235819->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235819->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235819->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235819->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235819->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 =
            futhark_mc_segmap_parloop_struct_235819->free_bytes_218547;
    struct memblock mem_218778 = {.desc ="mem_218778", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_218778,
                                  .size =0, .references =NULL};
    struct memblock mem_218783 = {.desc ="mem_218783", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_218783,
                                  .size =0, .references =NULL};
    size_t mem_218659_cached_sizze_235821 = 0;
    unsigned char *mem_218659 = NULL;
    size_t mem_218663_cached_sizze_235822 = 0;
    unsigned char *mem_218663 = NULL;
    size_t mem_218708_cached_sizze_235823 = 0;
    unsigned char *mem_218708 = NULL;
    size_t mem_218711_cached_sizze_235824 = 0;
    unsigned char *mem_218711 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226372 = start;
    
    if (mem_218659_cached_sizze_235821 < (size_t) bytes_217597) {
        mem_218659 = realloc(mem_218659, bytes_217597);
        mem_218659_cached_sizze_235821 = bytes_217597;
    }
    if (mem_218663_cached_sizze_235822 < (size_t) bytes_217597) {
        mem_218663 = realloc(mem_218663, bytes_217597);
        mem_218663_cached_sizze_235822 = bytes_217597;
    }
    if (mem_218708_cached_sizze_235823 < (size_t) bytes_218547) {
        mem_218708 = realloc(mem_218708, bytes_218547);
        mem_218708_cached_sizze_235823 = bytes_218547;
    }
    if (mem_218711_cached_sizze_235824 < (size_t) bytes_218547) {
        mem_218711 = realloc(mem_218711, bytes_218547);
        mem_218711_cached_sizze_235824 = bytes_218547;
    }
    for (; iter_226372 < end; iter_226372++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226463 = partition_sizze_203577;
        int64_t gtid_210254 = iter_226372;
        int64_t remnant_226464 = iter_226372 - gtid_210254;
        
        for (int64_t i_226373 = 0; i_226373 < n_p_203492; i_226373++) {
            int64_t x_226376;
            
            x_226376 = ((int64_t *) mem_217540.mem)[gtid_210254 * n_p_203492 +
                                                    i_226373];
            for (int64_t i_226379 = 0; i_226379 < s_n_m_203636; i_226379++) {
                int64_t x_226382;
                
                x_226382 = ((int64_t *) mem_217710.mem)[gtid_210254 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        i_226373 *
                                                        s_n_m_203636 +
                                                        i_226379];
                
                double x_226383;
                
                x_226383 = ((double *) mem_217715.mem)[gtid_210254 *
                                                       (s_n_m_203636 *
                                                        n_p_203492) + i_226373 *
                                                       s_n_m_203636 + i_226379];
                
                bool cond_226384 = i_226379 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_226385;
                
                if (cond_226384) {
                    defunc_0_m_fun_res_226385 = (int64_t) 0;
                } else {
                    int64_t y_226386 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_226387 = i_226379 == y_226386;
                    int64_t defunc_0_m_fun_res_f_res_226388;
                    
                    if (cond_226387) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_226389 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_226388 =
                            defunc_0_m_fun_res_f_res_t_res_226389;
                    } else {
                        int64_t x_226390 = sub64(i_226379, (int64_t) 1);
                        int64_t x_226391 = mul64(jump_s_203499, x_226390);
                        int64_t min_arg_226392 = add64((int64_t) 1, x_226391);
                        int64_t min_res_226393 = smin64(defunc_0_f_res_203631,
                                                        min_arg_226392);
                        
                        defunc_0_m_fun_res_f_res_226388 = min_res_226393;
                    }
                    defunc_0_m_fun_res_226385 = defunc_0_m_fun_res_f_res_226388;
                }
                
                double defunc_2_reduce_res_226396;
                double defunc_2_reduce_res_226397;
                double defunc_2_reduce_res_226398;
                double redout_226402;
                double redout_226403;
                double redout_226404;
                
                redout_226402 = 0.0;
                redout_226403 = 0.0;
                redout_226404 = 0.0;
                for (int64_t i_226401 = 0; i_226401 < q_s_203493; i_226401++) {
                    bool cond_226407 = sle64(x_226376, i_226401);
                    int64_t defunc_0_f_res_226408;
                    
                    if (cond_226407) {
                        defunc_0_f_res_226408 = (int64_t) 0;
                    } else {
                        int64_t i_226409 = add64(x_226382, i_226401);
                        int64_t defunc_0_add_arg_226410;
                        
                        defunc_0_add_arg_226410 =
                            ((int64_t *) mem_217536.mem)[gtid_210254 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_226373 *
                                                         defunc_0_f_res_203631 +
                                                         i_226409];
                        
                        int64_t defunc_1_add_res_226411 = add64((int64_t) 1,
                                                                defunc_0_add_arg_226410);
                        
                        defunc_0_f_res_226408 = defunc_1_add_res_226411;
                    }
                    
                    double defunc_0_f_res_226412;
                    
                    if (cond_226407) {
                        defunc_0_f_res_226412 = 0.0;
                    } else {
                        int64_t i_226413 = add64(x_226382, i_226401);
                        double defunc_0_add_arg_226414;
                        
                        defunc_0_add_arg_226414 =
                            ((double *) mem_218057.mem)[gtid_210254 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_226373 *
                                                        defunc_0_f_res_203631 +
                                                        i_226413];
                        defunc_0_f_res_226412 = defunc_0_add_arg_226414;
                    }
                    
                    int64_t binop_p_226415 = sub64(defunc_0_f_res_226408,
                                                   defunc_0_m_fun_res_226385);
                    double defunc_0_f_res_226416 =
                           sitofp_i64_f64(binop_p_226415);
                    double abs_res_226417 = fabs(defunc_0_f_res_226416);
                    double tmp1_226418 = abs_res_226417 / x_226383;
                    double x_226419 = tmp1_226418 * tmp1_226418;
                    double y_226420 = tmp1_226418 * x_226419;
                    double tmp2_226421 = 1.0 - y_226420;
                    double x_226422 = tmp2_226421 * tmp2_226421;
                    double tmp3_226423 = tmp2_226421 * x_226422;
                    double tmp4_226424 = defunc_0_f_res_226412 * tmp3_226423;
                    double defunc_1_f_res_226425 = defunc_0_f_res_226416 *
                           tmp4_226424;
                    double defunc_1_f_res_226426 = defunc_0_f_res_226416 *
                           defunc_1_f_res_226425;
                    double defunc_1_op_res_226427 = tmp4_226424 + redout_226402;
                    double defunc_1_op_res_226428 = defunc_1_f_res_226425 +
                           redout_226403;
                    double defunc_1_op_res_226429 = defunc_1_f_res_226426 +
                           redout_226404;
                    
                    ((double *) mem_218708)[i_226401] = defunc_1_f_res_226425;
                    ((double *) mem_218711)[i_226401] = tmp4_226424;
                    
                    double redout_tmp_226469 = defunc_1_op_res_226427;
                    double redout_tmp_226470 = defunc_1_op_res_226428;
                    double redout_tmp_226471 = defunc_1_op_res_226429;
                    
                    redout_226402 = redout_tmp_226469;
                    redout_226403 = redout_tmp_226470;
                    redout_226404 = redout_tmp_226471;
                }
                defunc_2_reduce_res_226396 = redout_226402;
                defunc_2_reduce_res_226397 = redout_226403;
                defunc_2_reduce_res_226398 = redout_226404;
                
                double x_226432 = defunc_2_reduce_res_226396 *
                       defunc_2_reduce_res_226398;
                double y_226433 = defunc_2_reduce_res_226397 *
                       defunc_2_reduce_res_226397;
                double y_226434 = x_226432 - y_226433;
                double det1_226435 = 1.0 / y_226434;
                double a11_226436 = defunc_2_reduce_res_226398 * det1_226435;
                double x_226437 = 0.0 - defunc_2_reduce_res_226397;
                double b11_226438 = det1_226435 * x_226437;
                double c11_226439 = defunc_2_reduce_res_226396 * det1_226435;
                double defunc_2_reduce_res_226440;
                double defunc_2_reduce_res_226441;
                double redout_226443;
                double redout_226444;
                
                redout_226443 = 0.0;
                redout_226444 = 0.0;
                for (int64_t i_226442 = 0; i_226442 < q_s_203493; i_226442++) {
                    double x_226445;
                    
                    x_226445 = ((double *) mem_218711)[i_226442];
                    
                    double x_226446;
                    
                    x_226446 = ((double *) mem_218708)[i_226442];
                    
                    bool cond_226447 = sle64(x_226376, i_226442);
                    double defunc_0_f_res_226448;
                    
                    if (cond_226447) {
                        defunc_0_f_res_226448 = 0.0;
                    } else {
                        int64_t i_226449 = add64(x_226382, i_226442);
                        double defunc_0_add_arg_226450;
                        
                        defunc_0_add_arg_226450 =
                            ((double *) mem_218052.mem)[gtid_210254 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_226373 *
                                                        defunc_0_f_res_203631 +
                                                        i_226449];
                        defunc_0_f_res_226448 = defunc_0_add_arg_226450;
                    }
                    
                    double x_226451 = a11_226436 * x_226445;
                    double y_226452 = b11_226438 * x_226446;
                    double x_226453 = x_226451 + y_226452;
                    double defunc_9_fit_fun_res_226454 = defunc_0_f_res_226448 *
                           x_226453;
                    double x_226455 = b11_226438 * x_226445;
                    double y_226456 = c11_226439 * x_226446;
                    double x_226457 = x_226455 + y_226456;
                    double defunc_9_slope_fun_res_226458 =
                           defunc_0_f_res_226448 * x_226457;
                    double defunc_1_op_res_226459 =
                           defunc_9_fit_fun_res_226454 + redout_226443;
                    double defunc_1_op_res_226460 =
                           defunc_9_slope_fun_res_226458 + redout_226444;
                    double redout_tmp_226474 = defunc_1_op_res_226459;
                    double redout_tmp_226475 = defunc_1_op_res_226460;
                    
                    redout_226443 = redout_tmp_226474;
                    redout_226444 = redout_tmp_226475;
                }
                defunc_2_reduce_res_226440 = redout_226443;
                defunc_2_reduce_res_226441 = redout_226444;
                ((double *) mem_218659)[i_226373 * s_n_m_203636 + i_226379] =
                    defunc_2_reduce_res_226440;
                ((double *) mem_218663)[i_226373 * s_n_m_203636 + i_226379] =
                    defunc_2_reduce_res_226441;
            }
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218778.mem + gtid_210254 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218659 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218783.mem + gtid_210254 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218663 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218659);
    free(mem_218663);
    free(mem_218708);
    free(mem_218711);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235820_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235820_end -
                 futhark_mc_segmap_parloop_235820_start;
        
        ctx->futhark_mc_segmap_parloop_235820_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235820_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235820_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235818(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210253 = tid;
    int num_tasks_226371 = info.nsubtasks;
    struct futhark_mc_task_235817 *futhark_mc_task_235817 =
                                  (struct futhark_mc_task_235817 *) args;
    struct futhark_context *ctx = futhark_mc_task_235817->ctx;
    uint64_t futhark_mc_segmap_task_235818_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235818_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235817->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235817->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235817->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235817->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235817->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235817->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235817->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235817->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235817->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235817->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235817->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235817->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235817->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235817->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235817->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 = futhark_mc_task_235817->free_bytes_218547;
    struct memblock mem_218778 = {.desc ="mem_218778", .mem =
                                  futhark_mc_task_235817->free_mem_218778,
                                  .size =0, .references =NULL};
    struct memblock mem_218783 = {.desc ="mem_218783", .mem =
                                  futhark_mc_task_235817->free_mem_218783,
                                  .size =0, .references =NULL};
    int64_t iter_226372;
    struct futhark_mc_segmap_parloop_struct_235819
    futhark_mc_segmap_parloop_struct_235819;
    
    futhark_mc_segmap_parloop_struct_235819.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235819.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235819.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235819.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235819.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235819.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235819.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235819.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235819.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235819.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235819.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235819.free_bytes_218547 = bytes_218547;
    futhark_mc_segmap_parloop_struct_235819.free_mem_218778 = mem_218778.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_218783 = mem_218783.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235820_task;
    
    futhark_mc_segmap_parloop_235820_task.name =
        "futhark_mc_segmap_parloop_235820";
    futhark_mc_segmap_parloop_235820_task.fn = futhark_mc_segmap_parloop_235820;
    futhark_mc_segmap_parloop_235820_task.args =
        &futhark_mc_segmap_parloop_struct_235819;
    futhark_mc_segmap_parloop_235820_task.iterations = iterations;
    futhark_mc_segmap_parloop_235820_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235820_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235820_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235820_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235820_task);
    
    if (futhark_mc_segmap_parloop_235820_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235820_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235820_total_end -
                 futhark_mc_segmap_parloop_235820_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235820_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235820_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235820_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235818_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235818_end -
                 futhark_mc_segmap_task_235818_start;
        
        ctx->futhark_mc_segmap_task_235818_runs[tid]++;
        ctx->futhark_mc_segmap_task_235818_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235818_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235826 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    unsigned char *free_mem_218778;
    unsigned char *free_mem_218783;
};
struct futhark_mc_task_235830 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    unsigned char *free_mem_218651;
    unsigned char *free_mem_218655;
};
struct futhark_mc_segmap_parloop_struct_235832 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    unsigned char *free_mem_218651;
    unsigned char *free_mem_218655;
};
static int futhark_mc_segmap_parloop_235833(void *args, int64_t start,
                                            int64_t end, int flat_tid_226651,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235832
    *futhark_mc_segmap_parloop_struct_235832 =
    (struct futhark_mc_segmap_parloop_struct_235832 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235832->ctx;
    uint64_t futhark_mc_segmap_parloop_235833_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235833_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235832->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235832->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235832->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235832->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235832->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235832->free_s_n_m_203636;
    int64_t gtid_210531 =
            futhark_mc_segmap_parloop_struct_235832->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235832->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 =
            futhark_mc_segmap_parloop_struct_235832->free_bytes_218547;
    struct memblock mem_218651 = {.desc ="mem_218651", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_218651,
                                  .size =0, .references =NULL};
    struct memblock mem_218655 = {.desc ="mem_218655", .mem =
                                  futhark_mc_segmap_parloop_struct_235832->free_mem_218655,
                                  .size =0, .references =NULL};
    size_t mem_226654_cached_sizze_235834 = 0;
    unsigned char *mem_226654 = NULL;
    size_t mem_226656_cached_sizze_235835 = 0;
    unsigned char *mem_226656 = NULL;
    size_t mem_226658_cached_sizze_235836 = 0;
    unsigned char *mem_226658 = NULL;
    size_t mem_226659_cached_sizze_235837 = 0;
    unsigned char *mem_226659 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226749 = start;
    
    if (mem_226654_cached_sizze_235834 < (size_t) bytes_217545) {
        mem_226654 = realloc(mem_226654, bytes_217545);
        mem_226654_cached_sizze_235834 = bytes_217545;
    }
    if (mem_226656_cached_sizze_235835 < (size_t) bytes_217545) {
        mem_226656 = realloc(mem_226656, bytes_217545);
        mem_226656_cached_sizze_235835 = bytes_217545;
    }
    if (mem_226658_cached_sizze_235836 < (size_t) bytes_218547) {
        mem_226658 = realloc(mem_226658, bytes_218547);
        mem_226658_cached_sizze_235836 = bytes_218547;
    }
    if (mem_226659_cached_sizze_235837 < (size_t) bytes_218547) {
        mem_226659 = realloc(mem_226659, bytes_218547);
        mem_226659_cached_sizze_235837 = bytes_218547;
    }
    for (; iter_226749 < end; iter_226749++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226834 = n_p_203492;
        int64_t gtid_226652 = iter_226749;
        int64_t remnant_226835 = iter_226749 - gtid_226652;
        int64_t x_226653;
        
        x_226653 = ((int64_t *) mem_217540.mem)[gtid_210531 * n_p_203492 +
                                                gtid_226652];
        for (int64_t i_226750 = 0; i_226750 < s_n_m_203636; i_226750++) {
            int64_t x_226753;
            
            x_226753 = ((int64_t *) mem_217710.mem)[gtid_210531 *
                                                    (s_n_m_203636 *
                                                     n_p_203492) + gtid_226652 *
                                                    s_n_m_203636 + i_226750];
            
            double x_226754;
            
            x_226754 = ((double *) mem_217715.mem)[gtid_210531 * (s_n_m_203636 *
                                                                  n_p_203492) +
                                                   gtid_226652 * s_n_m_203636 +
                                                   i_226750];
            
            bool cond_226755 = i_226750 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_226756;
            
            if (cond_226755) {
                defunc_0_m_fun_res_226756 = (int64_t) 0;
            } else {
                int64_t y_226757 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_226758 = i_226750 == y_226757;
                int64_t defunc_0_m_fun_res_f_res_226759;
                
                if (cond_226758) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_226760 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_226759 =
                        defunc_0_m_fun_res_f_res_t_res_226760;
                } else {
                    int64_t x_226761 = sub64(i_226750, (int64_t) 1);
                    int64_t x_226762 = mul64(jump_s_203499, x_226761);
                    int64_t min_arg_226763 = add64((int64_t) 1, x_226762);
                    int64_t min_res_226764 = smin64(defunc_0_f_res_203631,
                                                    min_arg_226763);
                    
                    defunc_0_m_fun_res_f_res_226759 = min_res_226764;
                }
                defunc_0_m_fun_res_226756 = defunc_0_m_fun_res_f_res_226759;
            }
            
            double defunc_2_reduce_res_226767;
            double defunc_2_reduce_res_226768;
            double defunc_2_reduce_res_226769;
            double redout_226773;
            double redout_226774;
            double redout_226775;
            
            redout_226773 = 0.0;
            redout_226774 = 0.0;
            redout_226775 = 0.0;
            for (int64_t i_226772 = 0; i_226772 < q_s_203493; i_226772++) {
                bool cond_226778 = sle64(x_226653, i_226772);
                int64_t defunc_0_f_res_226779;
                
                if (cond_226778) {
                    defunc_0_f_res_226779 = (int64_t) 0;
                } else {
                    int64_t i_226780 = add64(x_226753, i_226772);
                    int64_t defunc_0_add_arg_226781;
                    
                    defunc_0_add_arg_226781 =
                        ((int64_t *) mem_217536.mem)[gtid_210531 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_226652 *
                                                     defunc_0_f_res_203631 +
                                                     i_226780];
                    
                    int64_t defunc_1_add_res_226782 = add64((int64_t) 1,
                                                            defunc_0_add_arg_226781);
                    
                    defunc_0_f_res_226779 = defunc_1_add_res_226782;
                }
                
                double defunc_0_f_res_226783;
                
                if (cond_226778) {
                    defunc_0_f_res_226783 = 0.0;
                } else {
                    int64_t i_226784 = add64(x_226753, i_226772);
                    double defunc_0_add_arg_226785;
                    
                    defunc_0_add_arg_226785 =
                        ((double *) mem_218057.mem)[gtid_210531 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_226652 *
                                                    defunc_0_f_res_203631 +
                                                    i_226784];
                    defunc_0_f_res_226783 = defunc_0_add_arg_226785;
                }
                
                int64_t binop_p_226786 = sub64(defunc_0_f_res_226779,
                                               defunc_0_m_fun_res_226756);
                double defunc_0_f_res_226787 = sitofp_i64_f64(binop_p_226786);
                double abs_res_226788 = fabs(defunc_0_f_res_226787);
                double tmp1_226789 = abs_res_226788 / x_226754;
                double x_226790 = tmp1_226789 * tmp1_226789;
                double y_226791 = tmp1_226789 * x_226790;
                double tmp2_226792 = 1.0 - y_226791;
                double x_226793 = tmp2_226792 * tmp2_226792;
                double tmp3_226794 = tmp2_226792 * x_226793;
                double tmp4_226795 = defunc_0_f_res_226783 * tmp3_226794;
                double defunc_1_f_res_226796 = defunc_0_f_res_226787 *
                       tmp4_226795;
                double defunc_1_f_res_226797 = defunc_0_f_res_226787 *
                       defunc_1_f_res_226796;
                double defunc_1_op_res_226798 = tmp4_226795 + redout_226773;
                double defunc_1_op_res_226799 = defunc_1_f_res_226796 +
                       redout_226774;
                double defunc_1_op_res_226800 = defunc_1_f_res_226797 +
                       redout_226775;
                
                ((double *) mem_226658)[i_226772] = defunc_1_f_res_226796;
                ((double *) mem_226659)[i_226772] = tmp4_226795;
                
                double redout_tmp_226838 = defunc_1_op_res_226798;
                double redout_tmp_226839 = defunc_1_op_res_226799;
                double redout_tmp_226840 = defunc_1_op_res_226800;
                
                redout_226773 = redout_tmp_226838;
                redout_226774 = redout_tmp_226839;
                redout_226775 = redout_tmp_226840;
            }
            defunc_2_reduce_res_226767 = redout_226773;
            defunc_2_reduce_res_226768 = redout_226774;
            defunc_2_reduce_res_226769 = redout_226775;
            
            double x_226803 = defunc_2_reduce_res_226767 *
                   defunc_2_reduce_res_226769;
            double y_226804 = defunc_2_reduce_res_226768 *
                   defunc_2_reduce_res_226768;
            double y_226805 = x_226803 - y_226804;
            double det1_226806 = 1.0 / y_226805;
            double a11_226807 = defunc_2_reduce_res_226769 * det1_226806;
            double x_226808 = 0.0 - defunc_2_reduce_res_226768;
            double b11_226809 = det1_226806 * x_226808;
            double c11_226810 = defunc_2_reduce_res_226767 * det1_226806;
            double defunc_2_reduce_res_226811;
            double defunc_2_reduce_res_226812;
            double redout_226814;
            double redout_226815;
            
            redout_226814 = 0.0;
            redout_226815 = 0.0;
            for (int64_t i_226813 = 0; i_226813 < q_s_203493; i_226813++) {
                double x_226816;
                
                x_226816 = ((double *) mem_226659)[i_226813];
                
                double x_226817;
                
                x_226817 = ((double *) mem_226658)[i_226813];
                
                bool cond_226818 = sle64(x_226653, i_226813);
                double defunc_0_f_res_226819;
                
                if (cond_226818) {
                    defunc_0_f_res_226819 = 0.0;
                } else {
                    int64_t i_226820 = add64(x_226753, i_226813);
                    double defunc_0_add_arg_226821;
                    
                    defunc_0_add_arg_226821 =
                        ((double *) mem_218052.mem)[gtid_210531 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_226652 *
                                                    defunc_0_f_res_203631 +
                                                    i_226820];
                    defunc_0_f_res_226819 = defunc_0_add_arg_226821;
                }
                
                double x_226822 = a11_226807 * x_226816;
                double y_226823 = b11_226809 * x_226817;
                double x_226824 = x_226822 + y_226823;
                double defunc_9_fit_fun_res_226825 = defunc_0_f_res_226819 *
                       x_226824;
                double x_226826 = b11_226809 * x_226816;
                double y_226827 = c11_226810 * x_226817;
                double x_226828 = x_226826 + y_226827;
                double defunc_9_slope_fun_res_226829 = defunc_0_f_res_226819 *
                       x_226828;
                double defunc_1_op_res_226830 = defunc_9_fit_fun_res_226825 +
                       redout_226814;
                double defunc_1_op_res_226831 = defunc_9_slope_fun_res_226829 +
                       redout_226815;
                double redout_tmp_226843 = defunc_1_op_res_226830;
                double redout_tmp_226844 = defunc_1_op_res_226831;
                
                redout_226814 = redout_tmp_226843;
                redout_226815 = redout_tmp_226844;
            }
            defunc_2_reduce_res_226811 = redout_226814;
            defunc_2_reduce_res_226812 = redout_226815;
            ((double *) mem_226654)[i_226750] = defunc_2_reduce_res_226811;
            ((double *) mem_226656)[i_226750] = defunc_2_reduce_res_226812;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218651.mem + gtid_226652 * s_n_m_203636 * (int64_t) 8,
                    mem_226654 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218655.mem + gtid_226652 * s_n_m_203636 * (int64_t) 8,
                    mem_226656 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_226654);
    free(mem_226656);
    free(mem_226658);
    free(mem_226659);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235833_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235833_end -
                 futhark_mc_segmap_parloop_235833_start;
        
        ctx->futhark_mc_segmap_parloop_235833_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235833_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235833_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235831(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226651 = tid;
    int num_tasks_226748 = info.nsubtasks;
    struct futhark_mc_task_235830 *futhark_mc_task_235830 =
                                  (struct futhark_mc_task_235830 *) args;
    struct futhark_context *ctx = futhark_mc_task_235830->ctx;
    uint64_t futhark_mc_segmap_task_235831_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235831_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235830->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235830->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235830->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235830->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235830->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235830->free_s_n_m_203636;
    int64_t gtid_210531 = futhark_mc_task_235830->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235830->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235830->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235830->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235830->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235830->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235830->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235830->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 = futhark_mc_task_235830->free_bytes_218547;
    struct memblock mem_218651 = {.desc ="mem_218651", .mem =
                                  futhark_mc_task_235830->free_mem_218651,
                                  .size =0, .references =NULL};
    struct memblock mem_218655 = {.desc ="mem_218655", .mem =
                                  futhark_mc_task_235830->free_mem_218655,
                                  .size =0, .references =NULL};
    int64_t iter_226749;
    struct futhark_mc_segmap_parloop_struct_235832
    futhark_mc_segmap_parloop_struct_235832;
    
    futhark_mc_segmap_parloop_struct_235832.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235832.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235832.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235832.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235832.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235832.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235832.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235832.free_gtid_210531 = gtid_210531;
    futhark_mc_segmap_parloop_struct_235832.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235832.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235832.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235832.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235832.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235832.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235832.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235832.free_bytes_218547 = bytes_218547;
    futhark_mc_segmap_parloop_struct_235832.free_mem_218651 = mem_218651.mem;
    futhark_mc_segmap_parloop_struct_235832.free_mem_218655 = mem_218655.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235833_task;
    
    futhark_mc_segmap_parloop_235833_task.name =
        "futhark_mc_segmap_parloop_235833";
    futhark_mc_segmap_parloop_235833_task.fn = futhark_mc_segmap_parloop_235833;
    futhark_mc_segmap_parloop_235833_task.args =
        &futhark_mc_segmap_parloop_struct_235832;
    futhark_mc_segmap_parloop_235833_task.iterations = iterations;
    futhark_mc_segmap_parloop_235833_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235833_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235833_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235833_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235833_task);
    
    if (futhark_mc_segmap_parloop_235833_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235833_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235833_total_end -
                 futhark_mc_segmap_parloop_235833_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235833_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235833_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235833_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235831_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235831_end -
                 futhark_mc_segmap_task_235831_start;
        
        ctx->futhark_mc_segmap_task_235831_runs[tid]++;
        ctx->futhark_mc_segmap_task_235831_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235831_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235839 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    unsigned char *free_mem_218651;
    unsigned char *free_mem_218655;
};
struct futhark_mc_task_235843 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    int64_t free_gtid_226478;
    int64_t free_x_226479;
    unsigned char *free_mem_226480;
    unsigned char *free_mem_226481;
};
struct futhark_mc_segmap_parloop_struct_235845 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    int64_t free_gtid_226478;
    int64_t free_x_226479;
    unsigned char *free_mem_226480;
    unsigned char *free_mem_226481;
};
static int futhark_mc_segmap_parloop_235846(void *args, int64_t start,
                                            int64_t end, int flat_tid_226930,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235845
    *futhark_mc_segmap_parloop_struct_235845 =
    (struct futhark_mc_segmap_parloop_struct_235845 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235845->ctx;
    uint64_t futhark_mc_segmap_parloop_235846_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235846_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235845->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235845->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235845->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235845->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235845->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235845->free_s_n_m_203636;
    int64_t gtid_210531 =
            futhark_mc_segmap_parloop_struct_235845->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235845->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235845->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235845->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235845->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235845->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 =
            futhark_mc_segmap_parloop_struct_235845->free_bytes_218547;
    int64_t gtid_226478 =
            futhark_mc_segmap_parloop_struct_235845->free_gtid_226478;
    int64_t x_226479 = futhark_mc_segmap_parloop_struct_235845->free_x_226479;
    struct memblock mem_226480 = {.desc ="mem_226480", .mem =
                                  futhark_mc_segmap_parloop_struct_235845->free_mem_226480,
                                  .size =0, .references =NULL};
    struct memblock mem_226481 = {.desc ="mem_226481", .mem =
                                  futhark_mc_segmap_parloop_struct_235845->free_mem_226481,
                                  .size =0, .references =NULL};
    size_t mem_226944_cached_sizze_235847 = 0;
    unsigned char *mem_226944 = NULL;
    size_t mem_226946_cached_sizze_235848 = 0;
    unsigned char *mem_226946 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227016 = start;
    
    if (mem_226944_cached_sizze_235847 < (size_t) bytes_218547) {
        mem_226944 = realloc(mem_226944, bytes_218547);
        mem_226944_cached_sizze_235847 = bytes_218547;
    }
    if (mem_226946_cached_sizze_235848 < (size_t) bytes_218547) {
        mem_226946 = realloc(mem_226946, bytes_218547);
        mem_226946_cached_sizze_235848 = bytes_218547;
    }
    for (; iter_227016 < end; iter_227016++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227075 = s_n_m_203636;
        int64_t gtid_226931 = iter_227016;
        int64_t remnant_227076 = iter_227016 - gtid_226931;
        int64_t x_226932;
        
        x_226932 = ((int64_t *) mem_217710.mem)[gtid_210531 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_226478 * s_n_m_203636 +
                                                gtid_226931];
        
        double x_226933;
        
        x_226933 = ((double *) mem_217715.mem)[gtid_210531 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_226478 * s_n_m_203636 +
                                               gtid_226931];
        
        bool cond_226934 = gtid_226931 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_226935;
        
        if (cond_226934) {
            defunc_0_m_fun_res_226935 = (int64_t) 0;
        } else {
            int64_t y_227017 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_227018 = gtid_226931 == y_227017;
            int64_t defunc_0_m_fun_res_f_res_227019;
            
            if (cond_227018) {
                int64_t defunc_0_m_fun_res_f_res_t_res_227020 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_227019 =
                    defunc_0_m_fun_res_f_res_t_res_227020;
            } else {
                int64_t x_227021 = sub64(gtid_226931, (int64_t) 1);
                int64_t x_227022 = mul64(jump_s_203499, x_227021);
                int64_t min_arg_227023 = add64((int64_t) 1, x_227022);
                int64_t min_res_227024 = smin64(defunc_0_f_res_203631,
                                                min_arg_227023);
                
                defunc_0_m_fun_res_f_res_227019 = min_res_227024;
            }
            defunc_0_m_fun_res_226935 = defunc_0_m_fun_res_f_res_227019;
        }
        
        double defunc_2_reduce_res_226948;
        double defunc_2_reduce_res_226949;
        double defunc_2_reduce_res_226950;
        double redout_227026;
        double redout_227027;
        double redout_227028;
        
        redout_227026 = 0.0;
        redout_227027 = 0.0;
        redout_227028 = 0.0;
        for (int64_t i_227025 = 0; i_227025 < q_s_203493; i_227025++) {
            bool cond_227031 = sle64(x_226479, i_227025);
            int64_t defunc_0_f_res_227032;
            
            if (cond_227031) {
                defunc_0_f_res_227032 = (int64_t) 0;
            } else {
                int64_t i_227033 = add64(x_226932, i_227025);
                int64_t defunc_0_add_arg_227034;
                
                defunc_0_add_arg_227034 =
                    ((int64_t *) mem_217536.mem)[gtid_210531 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_226478 *
                                                 defunc_0_f_res_203631 +
                                                 i_227033];
                
                int64_t defunc_1_add_res_227035 = add64((int64_t) 1,
                                                        defunc_0_add_arg_227034);
                
                defunc_0_f_res_227032 = defunc_1_add_res_227035;
            }
            
            double defunc_0_f_res_227036;
            
            if (cond_227031) {
                defunc_0_f_res_227036 = 0.0;
            } else {
                int64_t i_227037 = add64(x_226932, i_227025);
                double defunc_0_add_arg_227038;
                
                defunc_0_add_arg_227038 =
                    ((double *) mem_218057.mem)[gtid_210531 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_226478 *
                                                defunc_0_f_res_203631 +
                                                i_227037];
                defunc_0_f_res_227036 = defunc_0_add_arg_227038;
            }
            
            int64_t binop_p_227039 = sub64(defunc_0_f_res_227032,
                                           defunc_0_m_fun_res_226935);
            double defunc_0_f_res_227040 = sitofp_i64_f64(binop_p_227039);
            double abs_res_227041 = fabs(defunc_0_f_res_227040);
            double tmp1_227042 = abs_res_227041 / x_226933;
            double x_227043 = tmp1_227042 * tmp1_227042;
            double y_227044 = tmp1_227042 * x_227043;
            double tmp2_227045 = 1.0 - y_227044;
            double x_227046 = tmp2_227045 * tmp2_227045;
            double tmp3_227047 = tmp2_227045 * x_227046;
            double tmp4_227048 = defunc_0_f_res_227036 * tmp3_227047;
            double defunc_1_f_res_227049 = defunc_0_f_res_227040 * tmp4_227048;
            double defunc_1_f_res_227050 = defunc_0_f_res_227040 *
                   defunc_1_f_res_227049;
            double defunc_1_op_res_227051 = tmp4_227048 + redout_227026;
            double defunc_1_op_res_227052 = defunc_1_f_res_227049 +
                   redout_227027;
            double defunc_1_op_res_227053 = defunc_1_f_res_227050 +
                   redout_227028;
            
            ((double *) mem_226944)[i_227025] = defunc_1_f_res_227049;
            ((double *) mem_226946)[i_227025] = tmp4_227048;
            
            double redout_tmp_227077 = defunc_1_op_res_227051;
            double redout_tmp_227078 = defunc_1_op_res_227052;
            double redout_tmp_227079 = defunc_1_op_res_227053;
            
            redout_227026 = redout_tmp_227077;
            redout_227027 = redout_tmp_227078;
            redout_227028 = redout_tmp_227079;
        }
        defunc_2_reduce_res_226948 = redout_227026;
        defunc_2_reduce_res_226949 = redout_227027;
        defunc_2_reduce_res_226950 = redout_227028;
        
        double x_226984 = defunc_2_reduce_res_226948 *
               defunc_2_reduce_res_226950;
        double y_226985 = defunc_2_reduce_res_226949 *
               defunc_2_reduce_res_226949;
        double y_226986 = x_226984 - y_226985;
        double det1_226987 = 1.0 / y_226986;
        double a11_226988 = defunc_2_reduce_res_226950 * det1_226987;
        double x_226989 = 0.0 - defunc_2_reduce_res_226949;
        double b11_226990 = det1_226987 * x_226989;
        double c11_226991 = defunc_2_reduce_res_226948 * det1_226987;
        double defunc_2_reduce_res_226992;
        double defunc_2_reduce_res_226993;
        double redout_227057;
        double redout_227058;
        
        redout_227057 = 0.0;
        redout_227058 = 0.0;
        for (int64_t i_227056 = 0; i_227056 < q_s_203493; i_227056++) {
            double x_227059;
            
            x_227059 = ((double *) mem_226946)[i_227056];
            
            double x_227060;
            
            x_227060 = ((double *) mem_226944)[i_227056];
            
            bool cond_227061 = sle64(x_226479, i_227056);
            double defunc_0_f_res_227062;
            
            if (cond_227061) {
                defunc_0_f_res_227062 = 0.0;
            } else {
                int64_t i_227063 = add64(x_226932, i_227056);
                double defunc_0_add_arg_227064;
                
                defunc_0_add_arg_227064 =
                    ((double *) mem_218052.mem)[gtid_210531 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_226478 *
                                                defunc_0_f_res_203631 +
                                                i_227063];
                defunc_0_f_res_227062 = defunc_0_add_arg_227064;
            }
            
            double x_227065 = a11_226988 * x_227059;
            double y_227066 = b11_226990 * x_227060;
            double x_227067 = x_227065 + y_227066;
            double defunc_9_fit_fun_res_227068 = defunc_0_f_res_227062 *
                   x_227067;
            double x_227069 = b11_226990 * x_227059;
            double y_227070 = c11_226991 * x_227060;
            double x_227071 = x_227069 + y_227070;
            double defunc_9_slope_fun_res_227072 = defunc_0_f_res_227062 *
                   x_227071;
            double defunc_1_op_res_227073 = defunc_9_fit_fun_res_227068 +
                   redout_227057;
            double defunc_1_op_res_227074 = defunc_9_slope_fun_res_227072 +
                   redout_227058;
            double redout_tmp_227082 = defunc_1_op_res_227073;
            double redout_tmp_227083 = defunc_1_op_res_227074;
            
            redout_227057 = redout_tmp_227082;
            redout_227058 = redout_tmp_227083;
        }
        defunc_2_reduce_res_226992 = redout_227057;
        defunc_2_reduce_res_226993 = redout_227058;
        ((double *) mem_226480.mem)[gtid_226931] = defunc_2_reduce_res_226992;
        ((double *) mem_226481.mem)[gtid_226931] = defunc_2_reduce_res_226993;
    }
    
  cleanup:
    { }
    free(mem_226944);
    free(mem_226946);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235846_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235846_end -
                 futhark_mc_segmap_parloop_235846_start;
        
        ctx->futhark_mc_segmap_parloop_235846_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235846_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235846_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235844(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226930 = tid;
    int num_tasks_227015 = info.nsubtasks;
    struct futhark_mc_task_235843 *futhark_mc_task_235843 =
                                  (struct futhark_mc_task_235843 *) args;
    struct futhark_context *ctx = futhark_mc_task_235843->ctx;
    uint64_t futhark_mc_segmap_task_235844_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235844_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235843->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235843->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235843->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235843->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235843->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235843->free_s_n_m_203636;
    int64_t gtid_210531 = futhark_mc_task_235843->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235843->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235843->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235843->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235843->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235843->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 = futhark_mc_task_235843->free_bytes_218547;
    int64_t gtid_226478 = futhark_mc_task_235843->free_gtid_226478;
    int64_t x_226479 = futhark_mc_task_235843->free_x_226479;
    struct memblock mem_226480 = {.desc ="mem_226480", .mem =
                                  futhark_mc_task_235843->free_mem_226480,
                                  .size =0, .references =NULL};
    struct memblock mem_226481 = {.desc ="mem_226481", .mem =
                                  futhark_mc_task_235843->free_mem_226481,
                                  .size =0, .references =NULL};
    int64_t iter_227016;
    struct futhark_mc_segmap_parloop_struct_235845
    futhark_mc_segmap_parloop_struct_235845;
    
    futhark_mc_segmap_parloop_struct_235845.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235845.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235845.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235845.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235845.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235845.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235845.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235845.free_gtid_210531 = gtid_210531;
    futhark_mc_segmap_parloop_struct_235845.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235845.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235845.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235845.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235845.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235845.free_bytes_218547 = bytes_218547;
    futhark_mc_segmap_parloop_struct_235845.free_gtid_226478 = gtid_226478;
    futhark_mc_segmap_parloop_struct_235845.free_x_226479 = x_226479;
    futhark_mc_segmap_parloop_struct_235845.free_mem_226480 = mem_226480.mem;
    futhark_mc_segmap_parloop_struct_235845.free_mem_226481 = mem_226481.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235846_task;
    
    futhark_mc_segmap_parloop_235846_task.name =
        "futhark_mc_segmap_parloop_235846";
    futhark_mc_segmap_parloop_235846_task.fn = futhark_mc_segmap_parloop_235846;
    futhark_mc_segmap_parloop_235846_task.args =
        &futhark_mc_segmap_parloop_struct_235845;
    futhark_mc_segmap_parloop_235846_task.iterations = iterations;
    futhark_mc_segmap_parloop_235846_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235846_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235846_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235846_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235846_task);
    
    if (futhark_mc_segmap_parloop_235846_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235846_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235846_total_end -
                 futhark_mc_segmap_parloop_235846_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235846_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235846_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235846_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235844_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235844_end -
                 futhark_mc_segmap_task_235844_start;
        
        ctx->futhark_mc_segmap_task_235844_runs[tid]++;
        ctx->futhark_mc_segmap_task_235844_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235844_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235850 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218547;
    int64_t free_gtid_226478;
    int64_t free_x_226479;
    unsigned char *free_mem_226480;
    unsigned char *free_mem_226481;
};
struct futhark_mc_task_235854 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_226478;
    int64_t free_x_226479;
    int64_t free_x_226848;
    double free_x_226849;
    int64_t free_defunc_0_m_fun_res_226851;
    double *retval_defunc_2_reduce_res_226862;
    double *retval_defunc_2_reduce_res_226863;
    double *retval_defunc_2_reduce_res_226864;
    unsigned char *retval_mem_226860;
    unsigned char *retval_mem_226861;
};
struct futhark_mc_segred_stage_1_parloop_struct_235859 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210531;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_226478;
    int64_t free_x_226479;
    int64_t free_x_226848;
    double free_x_226849;
    int64_t free_defunc_0_m_fun_res_226851;
    unsigned char *free_mem_226860;
    unsigned char *free_mem_226861;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227149;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227151;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227153;
};
static int futhark_mc_segred_stage_1_parloop_235860(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_227093,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235859
    *futhark_mc_segred_stage_1_parloop_struct_235859 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235859 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235859->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235860_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235860_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235859->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235859->free_defunc_0_f_res_203631;
    int64_t gtid_210531 =
            futhark_mc_segred_stage_1_parloop_struct_235859->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235859->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235859->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_226478 =
            futhark_mc_segred_stage_1_parloop_struct_235859->free_gtid_226478;
    int64_t x_226479 =
            futhark_mc_segred_stage_1_parloop_struct_235859->free_x_226479;
    int64_t x_226848 =
            futhark_mc_segred_stage_1_parloop_struct_235859->free_x_226848;
    double x_226849 =
           futhark_mc_segred_stage_1_parloop_struct_235859->free_x_226849;
    int64_t defunc_0_m_fun_res_226851 =
            futhark_mc_segred_stage_1_parloop_struct_235859->free_defunc_0_m_fun_res_226851;
    struct memblock mem_226860 = {.desc ="mem_226860", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235859->free_mem_226860,
                                  .size =0, .references =NULL};
    struct memblock mem_226861 = {.desc ="mem_226861", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235859->free_mem_226861,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227149 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227149",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235859->free_reduce_stage_1_tid_res_arr_mem_227149,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227151 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227151",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235859->free_reduce_stage_1_tid_res_arr_mem_227151,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227153 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227153",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235859->free_reduce_stage_1_tid_res_arr_mem_227153,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_227155 = start;
    double x_227095;
    double x_227096;
    double x_227098;
    double x_227099;
    double x_227101;
    double x_227102;
    double local_acc_227156 = 0.0;
    double local_acc_227157 = 0.0;
    double local_acc_227158 = 0.0;
    
    for (; iter_227155 < end; iter_227155++) {
        int64_t gtid_227094 = iter_227155;
        bool cond_227104 = sle64(x_226479, gtid_227094);
        int64_t defunc_0_f_res_227105;
        
        if (cond_227104) {
            defunc_0_f_res_227105 = (int64_t) 0;
        } else {
            int64_t i_227106 = add64(x_226848, gtid_227094);
            int64_t defunc_0_add_arg_227107;
            
            defunc_0_add_arg_227107 = ((int64_t *) mem_217536.mem)[gtid_210531 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_226478 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_227106];
            
            int64_t defunc_1_add_res_227108 = add64((int64_t) 1,
                                                    defunc_0_add_arg_227107);
            
            defunc_0_f_res_227105 = defunc_1_add_res_227108;
        }
        
        double defunc_0_f_res_227109;
        
        if (cond_227104) {
            defunc_0_f_res_227109 = 0.0;
        } else {
            int64_t i_227110 = add64(x_226848, gtid_227094);
            double defunc_0_add_arg_227111;
            
            defunc_0_add_arg_227111 = ((double *) mem_218057.mem)[gtid_210531 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_226478 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_227110];
            defunc_0_f_res_227109 = defunc_0_add_arg_227111;
        }
        
        int64_t binop_p_227112 = sub64(defunc_0_f_res_227105,
                                       defunc_0_m_fun_res_226851);
        double defunc_0_f_res_227113 = sitofp_i64_f64(binop_p_227112);
        double abs_res_227114 = fabs(defunc_0_f_res_227113);
        double tmp1_227115 = abs_res_227114 / x_226849;
        double x_227116 = tmp1_227115 * tmp1_227115;
        double y_227117 = tmp1_227115 * x_227116;
        double tmp2_227118 = 1.0 - y_227117;
        double x_227119 = tmp2_227118 * tmp2_227118;
        double tmp3_227120 = tmp2_227118 * x_227119;
        double tmp4_227121 = defunc_0_f_res_227109 * tmp3_227120;
        double defunc_1_f_res_227122 = defunc_0_f_res_227113 * tmp4_227121;
        double defunc_1_f_res_227123 = defunc_0_f_res_227113 *
               defunc_1_f_res_227122;
        
        // save map-out results
        {
            ((double *) mem_226860.mem)[gtid_227094] = defunc_1_f_res_227122;
            ((double *) mem_226861.mem)[gtid_227094] = tmp4_227121;
        }
        // Load accum params
        {
            x_227095 = local_acc_227156;
        }
        // Load next params
        {
            x_227096 = tmp4_227121;
        }
        // Red body
        {
            double defunc_1_op_res_227097 = x_227095 + x_227096;
            
            local_acc_227156 = defunc_1_op_res_227097;
        }
        // Load accum params
        {
            x_227098 = local_acc_227157;
        }
        // Load next params
        {
            x_227099 = defunc_1_f_res_227122;
        }
        // Red body
        {
            double defunc_1_op_res_227100 = x_227098 + x_227099;
            
            local_acc_227157 = defunc_1_op_res_227100;
        }
        // Load accum params
        {
            x_227101 = local_acc_227158;
        }
        // Load next params
        {
            x_227102 = defunc_1_f_res_227123;
        }
        // Red body
        {
            double defunc_1_op_res_227103 = x_227101 + x_227102;
            
            local_acc_227158 = defunc_1_op_res_227103;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_227149.mem)[flat_tid_227093] =
        local_acc_227156;
    ((double *) reduce_stage_1_tid_res_arr_mem_227151.mem)[flat_tid_227093] =
        local_acc_227157;
    ((double *) reduce_stage_1_tid_res_arr_mem_227153.mem)[flat_tid_227093] =
        local_acc_227158;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235860_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235860_end -
                 futhark_mc_segred_stage_1_parloop_235860_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235860_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235860_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235860_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235855(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227093 = tid;
    int num_tasks_227148 = info.nsubtasks;
    struct futhark_mc_task_235854 *futhark_mc_task_235854 =
                                  (struct futhark_mc_task_235854 *) args;
    struct futhark_context *ctx = futhark_mc_task_235854->ctx;
    uint64_t futhark_mc_segred_task_235855_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235855_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235854->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235854->free_defunc_0_f_res_203631;
    int64_t gtid_210531 = futhark_mc_task_235854->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235854->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235854->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_226478 = futhark_mc_task_235854->free_gtid_226478;
    int64_t x_226479 = futhark_mc_task_235854->free_x_226479;
    int64_t x_226848 = futhark_mc_task_235854->free_x_226848;
    double x_226849 = futhark_mc_task_235854->free_x_226849;
    int64_t defunc_0_m_fun_res_226851 =
            futhark_mc_task_235854->free_defunc_0_m_fun_res_226851;
    double defunc_2_reduce_res_226862 =
           *futhark_mc_task_235854->retval_defunc_2_reduce_res_226862;
    double defunc_2_reduce_res_226863 =
           *futhark_mc_task_235854->retval_defunc_2_reduce_res_226863;
    double defunc_2_reduce_res_226864 =
           *futhark_mc_task_235854->retval_defunc_2_reduce_res_226864;
    struct memblock mem_226860 = {.desc ="mem_226860", .mem =
                                  futhark_mc_task_235854->retval_mem_226860,
                                  .size =0, .references =NULL};
    struct memblock mem_226861 = {.desc ="mem_226861", .mem =
                                  futhark_mc_task_235854->retval_mem_226861,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_227149_cached_sizze_235856 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227149 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_227151_cached_sizze_235857 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227151 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_227153_cached_sizze_235858 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227153 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_227149_cached_sizze_235856 <
        (size_t) ((int64_t) 8 * num_tasks_227148)) {
        reduce_stage_1_tid_res_arr_mem_227149 =
            realloc(reduce_stage_1_tid_res_arr_mem_227149, (int64_t) 8 *
                    num_tasks_227148);
        reduce_stage_1_tid_res_arr_mem_227149_cached_sizze_235856 =
            (int64_t) 8 * num_tasks_227148;
    }
    if (reduce_stage_1_tid_res_arr_mem_227151_cached_sizze_235857 <
        (size_t) ((int64_t) 8 * num_tasks_227148)) {
        reduce_stage_1_tid_res_arr_mem_227151 =
            realloc(reduce_stage_1_tid_res_arr_mem_227151, (int64_t) 8 *
                    num_tasks_227148);
        reduce_stage_1_tid_res_arr_mem_227151_cached_sizze_235857 =
            (int64_t) 8 * num_tasks_227148;
    }
    if (reduce_stage_1_tid_res_arr_mem_227153_cached_sizze_235858 <
        (size_t) ((int64_t) 8 * num_tasks_227148)) {
        reduce_stage_1_tid_res_arr_mem_227153 =
            realloc(reduce_stage_1_tid_res_arr_mem_227153, (int64_t) 8 *
                    num_tasks_227148);
        reduce_stage_1_tid_res_arr_mem_227153_cached_sizze_235858 =
            (int64_t) 8 * num_tasks_227148;
    }
    
    int64_t iter_227155;
    struct futhark_mc_segred_stage_1_parloop_struct_235859
    futhark_mc_segred_stage_1_parloop_struct_235859;
    
    futhark_mc_segred_stage_1_parloop_struct_235859.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_gtid_210531 =
        gtid_210531;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_mem_217536 =
        mem_217536.mem;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_mem_218057 =
        mem_218057.mem;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_gtid_226478 =
        gtid_226478;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_x_226479 = x_226479;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_x_226848 = x_226848;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_x_226849 = x_226849;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_defunc_0_m_fun_res_226851 =
        defunc_0_m_fun_res_226851;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_mem_226860 =
        mem_226860.mem;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_mem_226861 =
        mem_226861.mem;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_reduce_stage_1_tid_res_arr_mem_227149 =
        reduce_stage_1_tid_res_arr_mem_227149;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_reduce_stage_1_tid_res_arr_mem_227151 =
        reduce_stage_1_tid_res_arr_mem_227151;
    futhark_mc_segred_stage_1_parloop_struct_235859.free_reduce_stage_1_tid_res_arr_mem_227153 =
        reduce_stage_1_tid_res_arr_mem_227153;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235860_task;
    
    futhark_mc_segred_stage_1_parloop_235860_task.name =
        "futhark_mc_segred_stage_1_parloop_235860";
    futhark_mc_segred_stage_1_parloop_235860_task.fn =
        futhark_mc_segred_stage_1_parloop_235860;
    futhark_mc_segred_stage_1_parloop_235860_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235859;
    futhark_mc_segred_stage_1_parloop_235860_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235860_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235860_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235860_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235860_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235860_task);
    
    if (futhark_mc_segred_stage_1_parloop_235860_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235860_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235860_total_end -
                 futhark_mc_segred_stage_1_parloop_235860_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235860_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235860_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235860_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_226862 = 0.0;
        defunc_2_reduce_res_226863 = 0.0;
        defunc_2_reduce_res_226864 = 0.0;
    }
    
    double x_227159;
    double x_227160;
    double x_227162;
    double x_227163;
    double x_227165;
    double x_227166;
    
    for (int32_t i_227168 = 0; i_227168 < num_tasks_227148; i_227168++) {
        flat_tid_227093 = i_227168;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_227159 = defunc_2_reduce_res_226862;
            }
            // load next params
            {
                x_227160 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227149)[flat_tid_227093];
            }
            // red body
            {
                double defunc_1_op_res_227161 = x_227159 + x_227160;
                
                defunc_2_reduce_res_226862 = defunc_1_op_res_227161;
            }
            // load acc params
            {
                x_227162 = defunc_2_reduce_res_226863;
            }
            // load next params
            {
                x_227163 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227151)[flat_tid_227093];
            }
            // red body
            {
                double defunc_1_op_res_227164 = x_227162 + x_227163;
                
                defunc_2_reduce_res_226863 = defunc_1_op_res_227164;
            }
            // load acc params
            {
                x_227165 = defunc_2_reduce_res_226864;
            }
            // load next params
            {
                x_227166 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227153)[flat_tid_227093];
            }
            // red body
            {
                double defunc_1_op_res_227167 = x_227165 + x_227166;
                
                defunc_2_reduce_res_226864 = defunc_1_op_res_227167;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_227149);
        free(reduce_stage_1_tid_res_arr_mem_227151);
        free(reduce_stage_1_tid_res_arr_mem_227153);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235855_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235855_end -
                 futhark_mc_segred_task_235855_start;
        
        ctx->futhark_mc_segred_task_235855_runs[tid]++;
        ctx->futhark_mc_segred_task_235855_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235855_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235854->retval_defunc_2_reduce_res_226862 =
            defunc_2_reduce_res_226862;
        *futhark_mc_task_235854->retval_defunc_2_reduce_res_226863 =
            defunc_2_reduce_res_226863;
        *futhark_mc_task_235854->retval_defunc_2_reduce_res_226864 =
            defunc_2_reduce_res_226864;
        futhark_mc_task_235854->retval_mem_226860 = mem_226860.mem;
        futhark_mc_task_235854->retval_mem_226861 = mem_226861.mem;
    }
    return err;
}
struct futhark_mc_task_235861 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210531;
    unsigned char *free_mem_218052;
    int64_t free_gtid_226478;
    int64_t free_x_226479;
    int64_t free_x_226848;
    unsigned char *free_mem_226860;
    unsigned char *free_mem_226861;
    double free_a11_226902;
    double free_b11_226904;
    double free_c11_226905;
    double *retval_defunc_2_reduce_res_226906;
    double *retval_defunc_2_reduce_res_226907;
};
struct futhark_mc_segred_stage_1_parloop_struct_235865 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_210531;
    unsigned char *free_mem_218052;
    int64_t free_gtid_226478;
    int64_t free_x_226479;
    int64_t free_x_226848;
    unsigned char *free_mem_226860;
    unsigned char *free_mem_226861;
    double free_a11_226902;
    double free_b11_226904;
    double free_c11_226905;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227170;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227172;
};
static int futhark_mc_segred_stage_1_parloop_235866(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_227124,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235865
    *futhark_mc_segred_stage_1_parloop_struct_235865 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235865 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235865->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235866_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235866_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235865->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235865->free_defunc_0_f_res_203631;
    int64_t gtid_210531 =
            futhark_mc_segred_stage_1_parloop_struct_235865->free_gtid_210531;
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235865->free_mem_218052,
                                  .size =0, .references =NULL};
    int64_t gtid_226478 =
            futhark_mc_segred_stage_1_parloop_struct_235865->free_gtid_226478;
    int64_t x_226479 =
            futhark_mc_segred_stage_1_parloop_struct_235865->free_x_226479;
    int64_t x_226848 =
            futhark_mc_segred_stage_1_parloop_struct_235865->free_x_226848;
    struct memblock mem_226860 = {.desc ="mem_226860", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235865->free_mem_226860,
                                  .size =0, .references =NULL};
    struct memblock mem_226861 = {.desc ="mem_226861", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235865->free_mem_226861,
                                  .size =0, .references =NULL};
    double a11_226902 =
           futhark_mc_segred_stage_1_parloop_struct_235865->free_a11_226902;
    double b11_226904 =
           futhark_mc_segred_stage_1_parloop_struct_235865->free_b11_226904;
    double c11_226905 =
           futhark_mc_segred_stage_1_parloop_struct_235865->free_c11_226905;
    struct memblock reduce_stage_1_tid_res_arr_mem_227170 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227170",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235865->free_reduce_stage_1_tid_res_arr_mem_227170,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227172 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227172",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235865->free_reduce_stage_1_tid_res_arr_mem_227172,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_227174 = start;
    double x_227126;
    double x_227127;
    double x_227129;
    double x_227130;
    double local_acc_227175 = 0.0;
    double local_acc_227176 = 0.0;
    
    for (; iter_227174 < end; iter_227174++) {
        int64_t gtid_227125 = iter_227174;
        double x_227132;
        
        x_227132 = ((double *) mem_226861.mem)[gtid_227125];
        
        double x_227133;
        
        x_227133 = ((double *) mem_226860.mem)[gtid_227125];
        
        bool cond_227134 = sle64(x_226479, gtid_227125);
        double defunc_0_f_res_227135;
        
        if (cond_227134) {
            defunc_0_f_res_227135 = 0.0;
        } else {
            int64_t i_227136 = add64(x_226848, gtid_227125);
            double defunc_0_add_arg_227137;
            
            defunc_0_add_arg_227137 = ((double *) mem_218052.mem)[gtid_210531 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_226478 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_227136];
            defunc_0_f_res_227135 = defunc_0_add_arg_227137;
        }
        
        double x_227138 = a11_226902 * x_227132;
        double y_227139 = b11_226904 * x_227133;
        double x_227140 = x_227138 + y_227139;
        double defunc_9_fit_fun_res_227141 = defunc_0_f_res_227135 * x_227140;
        double x_227142 = b11_226904 * x_227132;
        double y_227143 = c11_226905 * x_227133;
        double x_227144 = x_227142 + y_227143;
        double defunc_9_slope_fun_res_227145 = defunc_0_f_res_227135 * x_227144;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_227126 = local_acc_227175;
        }
        // Load next params
        {
            x_227127 = defunc_9_fit_fun_res_227141;
        }
        // Red body
        {
            double defunc_1_op_res_227128 = x_227126 + x_227127;
            
            local_acc_227175 = defunc_1_op_res_227128;
        }
        // Load accum params
        {
            x_227129 = local_acc_227176;
        }
        // Load next params
        {
            x_227130 = defunc_9_slope_fun_res_227145;
        }
        // Red body
        {
            double defunc_1_op_res_227131 = x_227129 + x_227130;
            
            local_acc_227176 = defunc_1_op_res_227131;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_227170.mem)[flat_tid_227124] =
        local_acc_227175;
    ((double *) reduce_stage_1_tid_res_arr_mem_227172.mem)[flat_tid_227124] =
        local_acc_227176;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235866_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235866_end -
                 futhark_mc_segred_stage_1_parloop_235866_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235866_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235866_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235866_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235862(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227124 = tid;
    int num_tasks_227169 = info.nsubtasks;
    struct futhark_mc_task_235861 *futhark_mc_task_235861 =
                                  (struct futhark_mc_task_235861 *) args;
    struct futhark_context *ctx = futhark_mc_task_235861->ctx;
    uint64_t futhark_mc_segred_task_235862_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235862_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235861->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235861->free_defunc_0_f_res_203631;
    int64_t gtid_210531 = futhark_mc_task_235861->free_gtid_210531;
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235861->free_mem_218052,
                                  .size =0, .references =NULL};
    int64_t gtid_226478 = futhark_mc_task_235861->free_gtid_226478;
    int64_t x_226479 = futhark_mc_task_235861->free_x_226479;
    int64_t x_226848 = futhark_mc_task_235861->free_x_226848;
    struct memblock mem_226860 = {.desc ="mem_226860", .mem =
                                  futhark_mc_task_235861->free_mem_226860,
                                  .size =0, .references =NULL};
    struct memblock mem_226861 = {.desc ="mem_226861", .mem =
                                  futhark_mc_task_235861->free_mem_226861,
                                  .size =0, .references =NULL};
    double a11_226902 = futhark_mc_task_235861->free_a11_226902;
    double b11_226904 = futhark_mc_task_235861->free_b11_226904;
    double c11_226905 = futhark_mc_task_235861->free_c11_226905;
    double defunc_2_reduce_res_226906 =
           *futhark_mc_task_235861->retval_defunc_2_reduce_res_226906;
    double defunc_2_reduce_res_226907 =
           *futhark_mc_task_235861->retval_defunc_2_reduce_res_226907;
    size_t reduce_stage_1_tid_res_arr_mem_227170_cached_sizze_235863 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227170 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_227172_cached_sizze_235864 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227172 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_227170_cached_sizze_235863 <
        (size_t) ((int64_t) 8 * num_tasks_227169)) {
        reduce_stage_1_tid_res_arr_mem_227170 =
            realloc(reduce_stage_1_tid_res_arr_mem_227170, (int64_t) 8 *
                    num_tasks_227169);
        reduce_stage_1_tid_res_arr_mem_227170_cached_sizze_235863 =
            (int64_t) 8 * num_tasks_227169;
    }
    if (reduce_stage_1_tid_res_arr_mem_227172_cached_sizze_235864 <
        (size_t) ((int64_t) 8 * num_tasks_227169)) {
        reduce_stage_1_tid_res_arr_mem_227172 =
            realloc(reduce_stage_1_tid_res_arr_mem_227172, (int64_t) 8 *
                    num_tasks_227169);
        reduce_stage_1_tid_res_arr_mem_227172_cached_sizze_235864 =
            (int64_t) 8 * num_tasks_227169;
    }
    
    int64_t iter_227174;
    struct futhark_mc_segred_stage_1_parloop_struct_235865
    futhark_mc_segred_stage_1_parloop_struct_235865;
    
    futhark_mc_segred_stage_1_parloop_struct_235865.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_gtid_210531 =
        gtid_210531;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_mem_218052 =
        mem_218052.mem;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_gtid_226478 =
        gtid_226478;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_x_226479 = x_226479;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_x_226848 = x_226848;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_mem_226860 =
        mem_226860.mem;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_mem_226861 =
        mem_226861.mem;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_a11_226902 =
        a11_226902;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_b11_226904 =
        b11_226904;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_c11_226905 =
        c11_226905;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_reduce_stage_1_tid_res_arr_mem_227170 =
        reduce_stage_1_tid_res_arr_mem_227170;
    futhark_mc_segred_stage_1_parloop_struct_235865.free_reduce_stage_1_tid_res_arr_mem_227172 =
        reduce_stage_1_tid_res_arr_mem_227172;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235866_task;
    
    futhark_mc_segred_stage_1_parloop_235866_task.name =
        "futhark_mc_segred_stage_1_parloop_235866";
    futhark_mc_segred_stage_1_parloop_235866_task.fn =
        futhark_mc_segred_stage_1_parloop_235866;
    futhark_mc_segred_stage_1_parloop_235866_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235865;
    futhark_mc_segred_stage_1_parloop_235866_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235866_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235866_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235866_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235866_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235866_task);
    
    if (futhark_mc_segred_stage_1_parloop_235866_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235866_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235866_total_end -
                 futhark_mc_segred_stage_1_parloop_235866_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235866_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235866_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235866_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_226906 = 0.0;
        defunc_2_reduce_res_226907 = 0.0;
    }
    
    double x_227177;
    double x_227178;
    double x_227180;
    double x_227181;
    
    for (int32_t i_227183 = 0; i_227183 < num_tasks_227169; i_227183++) {
        flat_tid_227124 = i_227183;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_227177 = defunc_2_reduce_res_226906;
            }
            // load next params
            {
                x_227178 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227170)[flat_tid_227124];
            }
            // red body
            {
                double defunc_1_op_res_227179 = x_227177 + x_227178;
                
                defunc_2_reduce_res_226906 = defunc_1_op_res_227179;
            }
            // load acc params
            {
                x_227180 = defunc_2_reduce_res_226907;
            }
            // load next params
            {
                x_227181 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227172)[flat_tid_227124];
            }
            // red body
            {
                double defunc_1_op_res_227182 = x_227180 + x_227181;
                
                defunc_2_reduce_res_226907 = defunc_1_op_res_227182;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_227170);
        free(reduce_stage_1_tid_res_arr_mem_227172);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235862_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235862_end -
                 futhark_mc_segred_task_235862_start;
        
        ctx->futhark_mc_segred_task_235862_runs[tid]++;
        ctx->futhark_mc_segred_task_235862_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235862_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235861->retval_defunc_2_reduce_res_226906 =
            defunc_2_reduce_res_226906;
        *futhark_mc_task_235861->retval_defunc_2_reduce_res_226907 =
            defunc_2_reduce_res_226907;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235851(void *args, int64_t start,
                                            int64_t end, int flat_tid_226846,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235850
    *futhark_mc_segmap_parloop_struct_235850 =
    (struct futhark_mc_segmap_parloop_struct_235850 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235850->ctx;
    uint64_t futhark_mc_segmap_parloop_235851_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235851_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235850->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235850->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235850->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235850->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235850->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235850->free_s_n_m_203636;
    int64_t gtid_210531 =
            futhark_mc_segmap_parloop_struct_235850->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235850->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235850->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235850->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235850->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235850->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 =
            futhark_mc_segmap_parloop_struct_235850->free_bytes_218547;
    int64_t gtid_226478 =
            futhark_mc_segmap_parloop_struct_235850->free_gtid_226478;
    int64_t x_226479 = futhark_mc_segmap_parloop_struct_235850->free_x_226479;
    struct memblock mem_226480 = {.desc ="mem_226480", .mem =
                                  futhark_mc_segmap_parloop_struct_235850->free_mem_226480,
                                  .size =0, .references =NULL};
    struct memblock mem_226481 = {.desc ="mem_226481", .mem =
                                  futhark_mc_segmap_parloop_struct_235850->free_mem_226481,
                                  .size =0, .references =NULL};
    size_t mem_226860_cached_sizze_235852 = 0;
    unsigned char *mem_226860 = NULL;
    size_t mem_226861_cached_sizze_235853 = 0;
    unsigned char *mem_226861 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227084 = start;
    
    if (mem_226860_cached_sizze_235852 < (size_t) bytes_218547) {
        mem_226860 = realloc(mem_226860, bytes_218547);
        mem_226860_cached_sizze_235852 = bytes_218547;
    }
    if (mem_226861_cached_sizze_235853 < (size_t) bytes_218547) {
        mem_226861 = realloc(mem_226861, bytes_218547);
        mem_226861_cached_sizze_235853 = bytes_218547;
    }
    for (; iter_227084 < end; iter_227084++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227146 = s_n_m_203636;
        int64_t gtid_226847 = iter_227084;
        int64_t remnant_227147 = iter_227084 - gtid_226847;
        int64_t x_226848;
        
        x_226848 = ((int64_t *) mem_217710.mem)[gtid_210531 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_226478 * s_n_m_203636 +
                                                gtid_226847];
        
        double x_226849;
        
        x_226849 = ((double *) mem_217715.mem)[gtid_210531 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_226478 * s_n_m_203636 +
                                               gtid_226847];
        
        bool cond_226850 = gtid_226847 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_226851;
        
        if (cond_226850) {
            defunc_0_m_fun_res_226851 = (int64_t) 0;
        } else {
            int64_t y_227085 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_227086 = gtid_226847 == y_227085;
            int64_t defunc_0_m_fun_res_f_res_227087;
            
            if (cond_227086) {
                int64_t defunc_0_m_fun_res_f_res_t_res_227088 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_227087 =
                    defunc_0_m_fun_res_f_res_t_res_227088;
            } else {
                int64_t x_227089 = sub64(gtid_226847, (int64_t) 1);
                int64_t x_227090 = mul64(jump_s_203499, x_227089);
                int64_t min_arg_227091 = add64((int64_t) 1, x_227090);
                int64_t min_res_227092 = smin64(defunc_0_f_res_203631,
                                                min_arg_227091);
                
                defunc_0_m_fun_res_f_res_227087 = min_res_227092;
            }
            defunc_0_m_fun_res_226851 = defunc_0_m_fun_res_f_res_227087;
        }
        
        double defunc_2_reduce_res_226862;
        double defunc_2_reduce_res_226863;
        double defunc_2_reduce_res_226864;
        int64_t flat_tid_227093 = (int64_t) 0;
        int32_t num_tasks_227148;
        
        defunc_2_reduce_res_226862 = 0.0;
        defunc_2_reduce_res_226863 = 0.0;
        defunc_2_reduce_res_226864 = 0.0;
        
        struct futhark_mc_task_235854 futhark_mc_task_235854;
        
        futhark_mc_task_235854.ctx = ctx;
        futhark_mc_task_235854.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235854.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235854.free_gtid_210531 = gtid_210531;
        futhark_mc_task_235854.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235854.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235854.free_gtid_226478 = gtid_226478;
        futhark_mc_task_235854.free_x_226479 = x_226479;
        futhark_mc_task_235854.free_x_226848 = x_226848;
        futhark_mc_task_235854.free_x_226849 = x_226849;
        futhark_mc_task_235854.free_defunc_0_m_fun_res_226851 =
            defunc_0_m_fun_res_226851;
        futhark_mc_task_235854.retval_defunc_2_reduce_res_226862 =
            &defunc_2_reduce_res_226862;
        futhark_mc_task_235854.retval_defunc_2_reduce_res_226863 =
            &defunc_2_reduce_res_226863;
        futhark_mc_task_235854.retval_defunc_2_reduce_res_226864 =
            &defunc_2_reduce_res_226864;
        futhark_mc_task_235854.retval_mem_226860 = mem_226860;
        futhark_mc_task_235854.retval_mem_226861 = mem_226861;
        
        struct scheduler_segop futhark_mc_task_235854_task;
        
        futhark_mc_task_235854_task.args = &futhark_mc_task_235854;
        futhark_mc_task_235854_task.top_level_fn =
            futhark_mc_segred_task_235855;
        futhark_mc_task_235854_task.name = "futhark_mc_segred_task_235855";
        futhark_mc_task_235854_task.iterations = q_s_203493;
        futhark_mc_task_235854_task.task_time =
            &ctx->futhark_mc_segred_task_235855_total_time;
        futhark_mc_task_235854_task.task_iter =
            &ctx->futhark_mc_segred_task_235855_total_iter;
        futhark_mc_task_235854_task.sched = STATIC;
        futhark_mc_task_235854_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235855_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235854_task);
        
        if (futhark_mc_segred_task_235855_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_226898 = defunc_2_reduce_res_226862 *
               defunc_2_reduce_res_226864;
        double y_226899 = defunc_2_reduce_res_226863 *
               defunc_2_reduce_res_226863;
        double y_226900 = x_226898 - y_226899;
        double det1_226901 = 1.0 / y_226900;
        double a11_226902 = defunc_2_reduce_res_226864 * det1_226901;
        double x_226903 = 0.0 - defunc_2_reduce_res_226863;
        double b11_226904 = det1_226901 * x_226903;
        double c11_226905 = defunc_2_reduce_res_226862 * det1_226901;
        double defunc_2_reduce_res_226906;
        double defunc_2_reduce_res_226907;
        int64_t flat_tid_227124 = (int64_t) 0;
        int32_t num_tasks_227169;
        
        defunc_2_reduce_res_226906 = 0.0;
        defunc_2_reduce_res_226907 = 0.0;
        
        struct futhark_mc_task_235861 futhark_mc_task_235861;
        
        futhark_mc_task_235861.ctx = ctx;
        futhark_mc_task_235861.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235861.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235861.free_gtid_210531 = gtid_210531;
        futhark_mc_task_235861.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235861.free_gtid_226478 = gtid_226478;
        futhark_mc_task_235861.free_x_226479 = x_226479;
        futhark_mc_task_235861.free_x_226848 = x_226848;
        futhark_mc_task_235861.free_mem_226860 = mem_226860;
        futhark_mc_task_235861.free_mem_226861 = mem_226861;
        futhark_mc_task_235861.free_a11_226902 = a11_226902;
        futhark_mc_task_235861.free_b11_226904 = b11_226904;
        futhark_mc_task_235861.free_c11_226905 = c11_226905;
        futhark_mc_task_235861.retval_defunc_2_reduce_res_226906 =
            &defunc_2_reduce_res_226906;
        futhark_mc_task_235861.retval_defunc_2_reduce_res_226907 =
            &defunc_2_reduce_res_226907;
        
        struct scheduler_segop futhark_mc_task_235861_task;
        
        futhark_mc_task_235861_task.args = &futhark_mc_task_235861;
        futhark_mc_task_235861_task.top_level_fn =
            futhark_mc_segred_task_235862;
        futhark_mc_task_235861_task.name = "futhark_mc_segred_task_235862";
        futhark_mc_task_235861_task.iterations = q_s_203493;
        futhark_mc_task_235861_task.task_time =
            &ctx->futhark_mc_segred_task_235862_total_time;
        futhark_mc_task_235861_task.task_iter =
            &ctx->futhark_mc_segred_task_235862_total_iter;
        futhark_mc_task_235861_task.sched = STATIC;
        futhark_mc_task_235861_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235862_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235861_task);
        
        if (futhark_mc_segred_task_235862_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_226480.mem)[gtid_226847] = defunc_2_reduce_res_226906;
        ((double *) mem_226481.mem)[gtid_226847] = defunc_2_reduce_res_226907;
    }
    
  cleanup:
    { }
    free(mem_226860);
    free(mem_226861);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235851_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235851_end -
                 futhark_mc_segmap_parloop_235851_start;
        
        ctx->futhark_mc_segmap_parloop_235851_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235851_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235851_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235849(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226846 = tid;
    int num_tasks_227015 = info.nsubtasks;
    struct futhark_mc_task_235843 *futhark_mc_task_235843 =
                                  (struct futhark_mc_task_235843 *) args;
    struct futhark_context *ctx = futhark_mc_task_235843->ctx;
    uint64_t futhark_mc_segmap_nested_task_235849_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235849_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235843->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235843->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235843->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235843->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235843->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235843->free_s_n_m_203636;
    int64_t gtid_210531 = futhark_mc_task_235843->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235843->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235843->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235843->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235843->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235843->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 = futhark_mc_task_235843->free_bytes_218547;
    int64_t gtid_226478 = futhark_mc_task_235843->free_gtid_226478;
    int64_t x_226479 = futhark_mc_task_235843->free_x_226479;
    struct memblock mem_226480 = {.desc ="mem_226480", .mem =
                                  futhark_mc_task_235843->free_mem_226480,
                                  .size =0, .references =NULL};
    struct memblock mem_226481 = {.desc ="mem_226481", .mem =
                                  futhark_mc_task_235843->free_mem_226481,
                                  .size =0, .references =NULL};
    int64_t iter_227084;
    struct futhark_mc_segmap_parloop_struct_235850
    futhark_mc_segmap_parloop_struct_235850;
    
    futhark_mc_segmap_parloop_struct_235850.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235850.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235850.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235850.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235850.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235850.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235850.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235850.free_gtid_210531 = gtid_210531;
    futhark_mc_segmap_parloop_struct_235850.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235850.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235850.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235850.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235850.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235850.free_bytes_218547 = bytes_218547;
    futhark_mc_segmap_parloop_struct_235850.free_gtid_226478 = gtid_226478;
    futhark_mc_segmap_parloop_struct_235850.free_x_226479 = x_226479;
    futhark_mc_segmap_parloop_struct_235850.free_mem_226480 = mem_226480.mem;
    futhark_mc_segmap_parloop_struct_235850.free_mem_226481 = mem_226481.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235851_task;
    
    futhark_mc_segmap_parloop_235851_task.name =
        "futhark_mc_segmap_parloop_235851";
    futhark_mc_segmap_parloop_235851_task.fn = futhark_mc_segmap_parloop_235851;
    futhark_mc_segmap_parloop_235851_task.args =
        &futhark_mc_segmap_parloop_struct_235850;
    futhark_mc_segmap_parloop_235851_task.iterations = iterations;
    futhark_mc_segmap_parloop_235851_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235851_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235851_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235851_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235851_task);
    
    if (futhark_mc_segmap_parloop_235851_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235851_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235851_total_end -
                 futhark_mc_segmap_parloop_235851_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235851_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235851_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235851_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235849_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235849_end -
                 futhark_mc_segmap_nested_task_235849_start;
        
        ctx->futhark_mc_segmap_nested_task_235849_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235849_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235849_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235840(void *args, int64_t start,
                                            int64_t end, int flat_tid_226477,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235839
    *futhark_mc_segmap_parloop_struct_235839 =
    (struct futhark_mc_segmap_parloop_struct_235839 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235839->ctx;
    uint64_t futhark_mc_segmap_parloop_235840_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235840_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235839->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235839->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235839->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235839->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235839->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235839->free_s_n_m_203636;
    int64_t gtid_210531 =
            futhark_mc_segmap_parloop_struct_235839->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235839->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 =
            futhark_mc_segmap_parloop_struct_235839->free_bytes_218547;
    struct memblock mem_218651 = {.desc ="mem_218651", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_218651,
                                  .size =0, .references =NULL};
    struct memblock mem_218655 = {.desc ="mem_218655", .mem =
                                  futhark_mc_segmap_parloop_struct_235839->free_mem_218655,
                                  .size =0, .references =NULL};
    size_t mem_226480_cached_sizze_235841 = 0;
    unsigned char *mem_226480 = NULL;
    size_t mem_226481_cached_sizze_235842 = 0;
    unsigned char *mem_226481 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226845 = start;
    
    if (mem_226480_cached_sizze_235841 < (size_t) bytes_217545) {
        mem_226480 = realloc(mem_226480, bytes_217545);
        mem_226480_cached_sizze_235841 = bytes_217545;
    }
    if (mem_226481_cached_sizze_235842 < (size_t) bytes_217545) {
        mem_226481 = realloc(mem_226481, bytes_217545);
        mem_226481_cached_sizze_235842 = bytes_217545;
    }
    for (; iter_226845 < end; iter_226845++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227013 = n_p_203492;
        int64_t gtid_226478 = iter_226845;
        int64_t remnant_227014 = iter_226845 - gtid_226478;
        int64_t x_226479;
        
        x_226479 = ((int64_t *) mem_217540.mem)[gtid_210531 * n_p_203492 +
                                                gtid_226478];
        
        int64_t flat_tid_226930 = (int64_t) 0;
        int32_t num_tasks_227015;
        int64_t flat_tid_226846 = (int64_t) 0;
        struct futhark_mc_task_235843 futhark_mc_task_235843;
        
        futhark_mc_task_235843.ctx = ctx;
        futhark_mc_task_235843.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235843.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235843.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235843.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235843.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235843.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235843.free_gtid_210531 = gtid_210531;
        futhark_mc_task_235843.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235843.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235843.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235843.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235843.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235843.free_bytes_218547 = bytes_218547;
        futhark_mc_task_235843.free_gtid_226478 = gtid_226478;
        futhark_mc_task_235843.free_x_226479 = x_226479;
        futhark_mc_task_235843.free_mem_226480 = mem_226480;
        futhark_mc_task_235843.free_mem_226481 = mem_226481;
        
        struct scheduler_segop futhark_mc_task_235843_task;
        
        futhark_mc_task_235843_task.args = &futhark_mc_task_235843;
        futhark_mc_task_235843_task.top_level_fn =
            futhark_mc_segmap_task_235844;
        futhark_mc_task_235843_task.name = "futhark_mc_segmap_task_235844";
        futhark_mc_task_235843_task.iterations = s_n_m_203636;
        futhark_mc_task_235843_task.task_time =
            &ctx->futhark_mc_segmap_task_235844_total_time;
        futhark_mc_task_235843_task.task_iter =
            &ctx->futhark_mc_segmap_task_235844_total_iter;
        futhark_mc_task_235843_task.sched = STATIC;
        futhark_mc_task_235843_task.nested_fn =
            futhark_mc_segmap_nested_task_235849;
        
        int futhark_mc_segmap_task_235844_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235843_task);
        
        if (futhark_mc_segmap_task_235844_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218651.mem + gtid_226478 * s_n_m_203636 * (int64_t) 8,
                    mem_226480 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218655.mem + gtid_226478 * s_n_m_203636 * (int64_t) 8,
                    mem_226481 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_226480);
    free(mem_226481);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235840_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235840_end -
                 futhark_mc_segmap_parloop_235840_start;
        
        ctx->futhark_mc_segmap_parloop_235840_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235840_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235840_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235838(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226477 = tid;
    int num_tasks_226748 = info.nsubtasks;
    struct futhark_mc_task_235830 *futhark_mc_task_235830 =
                                  (struct futhark_mc_task_235830 *) args;
    struct futhark_context *ctx = futhark_mc_task_235830->ctx;
    uint64_t futhark_mc_segmap_nested_task_235838_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235838_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235830->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235830->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235830->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235830->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235830->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235830->free_s_n_m_203636;
    int64_t gtid_210531 = futhark_mc_task_235830->free_gtid_210531;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235830->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235830->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235830->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235830->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235830->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235830->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235830->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 = futhark_mc_task_235830->free_bytes_218547;
    struct memblock mem_218651 = {.desc ="mem_218651", .mem =
                                  futhark_mc_task_235830->free_mem_218651,
                                  .size =0, .references =NULL};
    struct memblock mem_218655 = {.desc ="mem_218655", .mem =
                                  futhark_mc_task_235830->free_mem_218655,
                                  .size =0, .references =NULL};
    int64_t iter_226845;
    struct futhark_mc_segmap_parloop_struct_235839
    futhark_mc_segmap_parloop_struct_235839;
    
    futhark_mc_segmap_parloop_struct_235839.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235839.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235839.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235839.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235839.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235839.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235839.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235839.free_gtid_210531 = gtid_210531;
    futhark_mc_segmap_parloop_struct_235839.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235839.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235839.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235839.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235839.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235839.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235839.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235839.free_bytes_218547 = bytes_218547;
    futhark_mc_segmap_parloop_struct_235839.free_mem_218651 = mem_218651.mem;
    futhark_mc_segmap_parloop_struct_235839.free_mem_218655 = mem_218655.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235840_task;
    
    futhark_mc_segmap_parloop_235840_task.name =
        "futhark_mc_segmap_parloop_235840";
    futhark_mc_segmap_parloop_235840_task.fn = futhark_mc_segmap_parloop_235840;
    futhark_mc_segmap_parloop_235840_task.args =
        &futhark_mc_segmap_parloop_struct_235839;
    futhark_mc_segmap_parloop_235840_task.iterations = iterations;
    futhark_mc_segmap_parloop_235840_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235840_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235840_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235840_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235840_task);
    
    if (futhark_mc_segmap_parloop_235840_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235840_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235840_total_end -
                 futhark_mc_segmap_parloop_235840_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235840_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235840_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235840_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235838_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235838_end -
                 futhark_mc_segmap_nested_task_235838_start;
        
        ctx->futhark_mc_segmap_nested_task_235838_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235838_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235838_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235827(void *args, int64_t start,
                                            int64_t end, int flat_tid_210530,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235826
    *futhark_mc_segmap_parloop_struct_235826 =
    (struct futhark_mc_segmap_parloop_struct_235826 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235826->ctx;
    uint64_t futhark_mc_segmap_parloop_235827_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235827_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235826->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235826->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235826->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235826->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235826->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235826->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235826->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235826->free_bytes_217545;
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235826->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 =
            futhark_mc_segmap_parloop_struct_235826->free_bytes_218547;
    struct memblock mem_218778 = {.desc ="mem_218778", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_218778,
                                  .size =0, .references =NULL};
    struct memblock mem_218783 = {.desc ="mem_218783", .mem =
                                  futhark_mc_segmap_parloop_struct_235826->free_mem_218783,
                                  .size =0, .references =NULL};
    size_t mem_218651_cached_sizze_235828 = 0;
    unsigned char *mem_218651 = NULL;
    size_t mem_218655_cached_sizze_235829 = 0;
    unsigned char *mem_218655 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226476 = start;
    
    if (mem_218651_cached_sizze_235828 < (size_t) bytes_217597) {
        mem_218651 = realloc(mem_218651, bytes_217597);
        mem_218651_cached_sizze_235828 = bytes_217597;
    }
    if (mem_218655_cached_sizze_235829 < (size_t) bytes_217597) {
        mem_218655 = realloc(mem_218655, bytes_217597);
        mem_218655_cached_sizze_235829 = bytes_217597;
    }
    for (; iter_226476 < end; iter_226476++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226746 = partition_sizze_203577;
        int64_t gtid_210531 = iter_226476;
        int64_t remnant_226747 = iter_226476 - gtid_210531;
        int64_t flat_tid_226651 = (int64_t) 0;
        int32_t num_tasks_226748;
        int64_t flat_tid_226477 = (int64_t) 0;
        struct futhark_mc_task_235830 futhark_mc_task_235830;
        
        futhark_mc_task_235830.ctx = ctx;
        futhark_mc_task_235830.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235830.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235830.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235830.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235830.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235830.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235830.free_gtid_210531 = gtid_210531;
        futhark_mc_task_235830.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235830.free_mem_217540 = mem_217540.mem;
        futhark_mc_task_235830.free_bytes_217545 = bytes_217545;
        futhark_mc_task_235830.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235830.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235830.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235830.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235830.free_bytes_218547 = bytes_218547;
        futhark_mc_task_235830.free_mem_218651 = mem_218651;
        futhark_mc_task_235830.free_mem_218655 = mem_218655;
        
        struct scheduler_segop futhark_mc_task_235830_task;
        
        futhark_mc_task_235830_task.args = &futhark_mc_task_235830;
        futhark_mc_task_235830_task.top_level_fn =
            futhark_mc_segmap_task_235831;
        futhark_mc_task_235830_task.name = "futhark_mc_segmap_task_235831";
        futhark_mc_task_235830_task.iterations = n_p_203492;
        futhark_mc_task_235830_task.task_time =
            &ctx->futhark_mc_segmap_task_235831_total_time;
        futhark_mc_task_235830_task.task_iter =
            &ctx->futhark_mc_segmap_task_235831_total_iter;
        futhark_mc_task_235830_task.sched = STATIC;
        futhark_mc_task_235830_task.nested_fn =
            futhark_mc_segmap_nested_task_235838;
        
        int futhark_mc_segmap_task_235831_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235830_task);
        
        if (futhark_mc_segmap_task_235831_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218778.mem + gtid_210531 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218651 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218783.mem + gtid_210531 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218655 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218651);
    free(mem_218655);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235827_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235827_end -
                 futhark_mc_segmap_parloop_235827_start;
        
        ctx->futhark_mc_segmap_parloop_235827_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235827_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235827_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235825(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210530 = tid;
    int num_tasks_226371 = info.nsubtasks;
    struct futhark_mc_task_235817 *futhark_mc_task_235817 =
                                  (struct futhark_mc_task_235817 *) args;
    struct futhark_context *ctx = futhark_mc_task_235817->ctx;
    uint64_t futhark_mc_segmap_nested_task_235825_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235825_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235817->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235817->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235817->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235817->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235817->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235817->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235817->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235817->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235817->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235817->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235817->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235817->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235817->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235817->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235817->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218547 = futhark_mc_task_235817->free_bytes_218547;
    struct memblock mem_218778 = {.desc ="mem_218778", .mem =
                                  futhark_mc_task_235817->free_mem_218778,
                                  .size =0, .references =NULL};
    struct memblock mem_218783 = {.desc ="mem_218783", .mem =
                                  futhark_mc_task_235817->free_mem_218783,
                                  .size =0, .references =NULL};
    int64_t iter_226476;
    struct futhark_mc_segmap_parloop_struct_235826
    futhark_mc_segmap_parloop_struct_235826;
    
    futhark_mc_segmap_parloop_struct_235826.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235826.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235826.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235826.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235826.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235826.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235826.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235826.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235826.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235826.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235826.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235826.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235826.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235826.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235826.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235826.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235826.free_bytes_218547 = bytes_218547;
    futhark_mc_segmap_parloop_struct_235826.free_mem_218778 = mem_218778.mem;
    futhark_mc_segmap_parloop_struct_235826.free_mem_218783 = mem_218783.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235827_task;
    
    futhark_mc_segmap_parloop_235827_task.name =
        "futhark_mc_segmap_parloop_235827";
    futhark_mc_segmap_parloop_235827_task.fn = futhark_mc_segmap_parloop_235827;
    futhark_mc_segmap_parloop_235827_task.args =
        &futhark_mc_segmap_parloop_struct_235826;
    futhark_mc_segmap_parloop_235827_task.iterations = iterations;
    futhark_mc_segmap_parloop_235827_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235827_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235827_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235827_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235827_task);
    
    if (futhark_mc_segmap_parloop_235827_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235827_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235827_total_end -
                 futhark_mc_segmap_parloop_235827_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235827_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235827_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235827_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235825_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235825_end -
                 futhark_mc_segmap_nested_task_235825_start;
        
        ctx->futhark_mc_segmap_nested_task_235825_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235825_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235825_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235867 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    unsigned char *free_mem_219112;
    unsigned char *free_mem_219117;
};
struct futhark_mc_segmap_parloop_struct_235869 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    unsigned char *free_mem_219112;
    unsigned char *free_mem_219117;
};
static int futhark_mc_segmap_parloop_235870(void *args, int64_t start,
                                            int64_t end, int flat_tid_210805,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235869
    *futhark_mc_segmap_parloop_struct_235869 =
    (struct futhark_mc_segmap_parloop_struct_235869 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235869->ctx;
    uint64_t futhark_mc_segmap_parloop_235870_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235870_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235869->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235869->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235869->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235869->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235869->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235869->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235869->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235869->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 =
            futhark_mc_segmap_parloop_struct_235869->free_bytes_218785;
    struct memblock mem_219112 = {.desc ="mem_219112", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_219112,
                                  .size =0, .references =NULL};
    struct memblock mem_219117 = {.desc ="mem_219117", .mem =
                                  futhark_mc_segmap_parloop_struct_235869->free_mem_219117,
                                  .size =0, .references =NULL};
    size_t mem_218963_cached_sizze_235871 = 0;
    unsigned char *mem_218963 = NULL;
    size_t mem_218967_cached_sizze_235872 = 0;
    unsigned char *mem_218967 = NULL;
    size_t mem_219012_cached_sizze_235873 = 0;
    unsigned char *mem_219012 = NULL;
    size_t mem_219015_cached_sizze_235874 = 0;
    unsigned char *mem_219015 = NULL;
    size_t mem_219042_cached_sizze_235875 = 0;
    unsigned char *mem_219042 = NULL;
    size_t mem_219045_cached_sizze_235876 = 0;
    unsigned char *mem_219045 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227185 = start;
    
    if (mem_218963_cached_sizze_235871 < (size_t) bytes_217597) {
        mem_218963 = realloc(mem_218963, bytes_217597);
        mem_218963_cached_sizze_235871 = bytes_217597;
    }
    if (mem_218967_cached_sizze_235872 < (size_t) bytes_217597) {
        mem_218967 = realloc(mem_218967, bytes_217597);
        mem_218967_cached_sizze_235872 = bytes_217597;
    }
    if (mem_219012_cached_sizze_235873 < (size_t) bytes_218785) {
        mem_219012 = realloc(mem_219012, bytes_218785);
        mem_219012_cached_sizze_235873 = bytes_218785;
    }
    if (mem_219015_cached_sizze_235874 < (size_t) bytes_218785) {
        mem_219015 = realloc(mem_219015, bytes_218785);
        mem_219015_cached_sizze_235874 = bytes_218785;
    }
    if (mem_219042_cached_sizze_235875 < (size_t) bytes_218785) {
        mem_219042 = realloc(mem_219042, bytes_218785);
        mem_219042_cached_sizze_235875 = bytes_218785;
    }
    if (mem_219045_cached_sizze_235876 < (size_t) bytes_218785) {
        mem_219045 = realloc(mem_219045, bytes_218785);
        mem_219045_cached_sizze_235876 = bytes_218785;
    }
    for (; iter_227185 < end; iter_227185++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227317 = partition_sizze_203577;
        int64_t gtid_210806 = iter_227185;
        int64_t remnant_227318 = iter_227185 - gtid_210806;
        
        for (int64_t i_227186 = 0; i_227186 < n_p_203492; i_227186++) {
            int64_t x_227189;
            
            x_227189 = ((int64_t *) mem_217540.mem)[gtid_210806 * n_p_203492 +
                                                    i_227186];
            for (int64_t i_227192 = 0; i_227192 < s_n_m_203636; i_227192++) {
                int64_t x_227195;
                
                x_227195 = ((int64_t *) mem_217710.mem)[gtid_210806 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        i_227186 *
                                                        s_n_m_203636 +
                                                        i_227192];
                
                double x_227196;
                
                x_227196 = ((double *) mem_217715.mem)[gtid_210806 *
                                                       (s_n_m_203636 *
                                                        n_p_203492) + i_227186 *
                                                       s_n_m_203636 + i_227192];
                
                bool cond_227197 = i_227192 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_227198;
                
                if (cond_227197) {
                    defunc_0_m_fun_res_227198 = (int64_t) 0;
                } else {
                    int64_t y_227199 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_227200 = i_227192 == y_227199;
                    int64_t defunc_0_m_fun_res_f_res_227201;
                    
                    if (cond_227200) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_227202 =
                                sub64(pad_css_len_203632, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_227201 =
                            defunc_0_m_fun_res_f_res_t_res_227202;
                    } else {
                        int64_t x_227203 = sub64(i_227192, (int64_t) 1);
                        int64_t x_227204 = mul64(jump_s_203499, x_227203);
                        int64_t min_arg_227205 = add64((int64_t) 1, x_227204);
                        int64_t min_res_227206 = smin64(defunc_0_f_res_203631,
                                                        min_arg_227205);
                        
                        defunc_0_m_fun_res_f_res_227201 = min_res_227206;
                    }
                    defunc_0_m_fun_res_227198 = defunc_0_m_fun_res_f_res_227201;
                }
                for (int64_t i_227211 = 0; i_227211 < q_s_203493; i_227211++) {
                    bool cond_227214 = sle64(x_227189, i_227211);
                    int64_t defunc_0_f_res_227215;
                    
                    if (cond_227214) {
                        defunc_0_f_res_227215 = (int64_t) 0;
                    } else {
                        int64_t i_227216 = add64(x_227195, i_227211);
                        int64_t defunc_0_add_arg_227217;
                        
                        defunc_0_add_arg_227217 =
                            ((int64_t *) mem_217536.mem)[gtid_210806 *
                                                         (defunc_0_f_res_203631 *
                                                          n_p_203492) +
                                                         i_227186 *
                                                         defunc_0_f_res_203631 +
                                                         i_227216];
                        
                        int64_t defunc_1_add_res_227218 = add64((int64_t) 1,
                                                                defunc_0_add_arg_227217);
                        
                        defunc_0_f_res_227215 = defunc_1_add_res_227218;
                    }
                    
                    double defunc_0_f_res_227219;
                    
                    if (cond_227214) {
                        defunc_0_f_res_227219 = 0.0;
                    } else {
                        int64_t i_227220 = add64(x_227195, i_227211);
                        double defunc_0_add_arg_227221;
                        
                        defunc_0_add_arg_227221 =
                            ((double *) mem_218057.mem)[gtid_210806 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_227186 *
                                                        defunc_0_f_res_203631 +
                                                        i_227220];
                        defunc_0_f_res_227219 = defunc_0_add_arg_227221;
                    }
                    
                    int64_t binop_p_227222 = sub64(defunc_0_f_res_227215,
                                                   defunc_0_m_fun_res_227198);
                    double defunc_0_f_res_227223 =
                           sitofp_i64_f64(binop_p_227222);
                    double abs_res_227224 = fabs(defunc_0_f_res_227223);
                    double tmp1_227225 = abs_res_227224 / x_227196;
                    double x_227226 = tmp1_227225 * tmp1_227225;
                    double y_227227 = tmp1_227225 * x_227226;
                    double tmp2_227228 = 1.0 - y_227227;
                    double x_227229 = tmp2_227228 * tmp2_227228;
                    double tmp3_227230 = tmp2_227228 * x_227229;
                    double tmp4_227231 = defunc_0_f_res_227219 * tmp3_227230;
                    
                    ((double *) mem_219012)[i_227211] = defunc_0_f_res_227223;
                    ((double *) mem_219015)[i_227211] = tmp4_227231;
                }
                
                double defunc_2_reduce_res_227236;
                double defunc_2_reduce_res_227237;
                double defunc_2_reduce_res_227238;
                double defunc_2_reduce_res_227239;
                double defunc_2_reduce_res_227240;
                double redout_227244;
                double redout_227245;
                double redout_227246;
                double redout_227247;
                double redout_227248;
                
                redout_227244 = 0.0;
                redout_227245 = 0.0;
                redout_227246 = 0.0;
                redout_227247 = 0.0;
                redout_227248 = 0.0;
                for (int64_t i_227243 = 0; i_227243 < q_s_203493; i_227243++) {
                    double x_227251;
                    
                    x_227251 = ((double *) mem_219012)[i_227243];
                    
                    double x_227252;
                    
                    x_227252 = ((double *) mem_219015)[i_227243];
                    
                    double defunc_1_f_res_227253 = x_227251 * x_227252;
                    double defunc_1_f_res_227254 = x_227251 *
                           defunc_1_f_res_227253;
                    double defunc_1_f_res_227255 = x_227251 *
                           defunc_1_f_res_227254;
                    double defunc_1_f_res_227256 = x_227251 *
                           defunc_1_f_res_227255;
                    double defunc_1_op_res_227257 = x_227252 + redout_227244;
                    double defunc_1_op_res_227258 = defunc_1_f_res_227253 +
                           redout_227245;
                    double defunc_1_op_res_227259 = defunc_1_f_res_227254 +
                           redout_227246;
                    double defunc_1_op_res_227260 = defunc_1_f_res_227255 +
                           redout_227247;
                    double defunc_1_op_res_227261 = defunc_1_f_res_227256 +
                           redout_227248;
                    
                    ((double *) mem_219042)[i_227243] = defunc_1_f_res_227254;
                    ((double *) mem_219045)[i_227243] = defunc_1_f_res_227253;
                    
                    double redout_tmp_227325 = defunc_1_op_res_227257;
                    double redout_tmp_227326 = defunc_1_op_res_227258;
                    double redout_tmp_227327 = defunc_1_op_res_227259;
                    double redout_tmp_227328 = defunc_1_op_res_227260;
                    double redout_tmp_227329 = defunc_1_op_res_227261;
                    
                    redout_227244 = redout_tmp_227325;
                    redout_227245 = redout_tmp_227326;
                    redout_227246 = redout_tmp_227327;
                    redout_227247 = redout_tmp_227328;
                    redout_227248 = redout_tmp_227329;
                }
                defunc_2_reduce_res_227236 = redout_227244;
                defunc_2_reduce_res_227237 = redout_227245;
                defunc_2_reduce_res_227238 = redout_227246;
                defunc_2_reduce_res_227239 = redout_227247;
                defunc_2_reduce_res_227240 = redout_227248;
                
                double x_227264 = defunc_2_reduce_res_227238 *
                       defunc_2_reduce_res_227240;
                double y_227265 = defunc_2_reduce_res_227239 *
                       defunc_2_reduce_res_227239;
                double a12_227266 = x_227264 - y_227265;
                double x_227267 = defunc_2_reduce_res_227238 *
                       defunc_2_reduce_res_227239;
                double y_227268 = defunc_2_reduce_res_227237 *
                       defunc_2_reduce_res_227240;
                double b12_227269 = x_227267 - y_227268;
                double x_227270 = defunc_2_reduce_res_227237 *
                       defunc_2_reduce_res_227239;
                double y_227271 = defunc_2_reduce_res_227238 *
                       defunc_2_reduce_res_227238;
                double c12_227272 = x_227270 - y_227271;
                double x_227273 = defunc_2_reduce_res_227236 *
                       defunc_2_reduce_res_227240;
                double b2_227274 = x_227273 - y_227271;
                double x_227275 = defunc_2_reduce_res_227237 *
                       defunc_2_reduce_res_227238;
                double y_227276 = defunc_2_reduce_res_227236 *
                       defunc_2_reduce_res_227239;
                double c2_227277 = x_227275 - y_227276;
                double x_227278 = defunc_2_reduce_res_227236 * a12_227266;
                double y_227279 = defunc_2_reduce_res_227237 * b12_227269;
                double x_227280 = x_227278 + y_227279;
                double y_227281 = defunc_2_reduce_res_227238 * c12_227272;
                double y_227282 = x_227280 + y_227281;
                double det_227283 = 1.0 / y_227282;
                double a12_227284 = a12_227266 * det_227283;
                double b12_227285 = b12_227269 * det_227283;
                double c12_227286 = c12_227272 * det_227283;
                double b2_227287 = b2_227274 * det_227283;
                double c2_227288 = c2_227277 * det_227283;
                double defunc_2_reduce_res_227289;
                double defunc_2_reduce_res_227290;
                double redout_227292;
                double redout_227293;
                
                redout_227292 = 0.0;
                redout_227293 = 0.0;
                for (int64_t i_227291 = 0; i_227291 < q_s_203493; i_227291++) {
                    double x_227294;
                    
                    x_227294 = ((double *) mem_219015)[i_227291];
                    
                    double x_227295;
                    
                    x_227295 = ((double *) mem_219045)[i_227291];
                    
                    double x_227296;
                    
                    x_227296 = ((double *) mem_219042)[i_227291];
                    
                    bool cond_227297 = sle64(x_227189, i_227291);
                    double defunc_0_f_res_227298;
                    
                    if (cond_227297) {
                        defunc_0_f_res_227298 = 0.0;
                    } else {
                        int64_t i_227299 = add64(x_227195, i_227291);
                        double defunc_0_add_arg_227300;
                        
                        defunc_0_add_arg_227300 =
                            ((double *) mem_218052.mem)[gtid_210806 *
                                                        (defunc_0_f_res_203631 *
                                                         n_p_203492) +
                                                        i_227186 *
                                                        defunc_0_f_res_203631 +
                                                        i_227299];
                        defunc_0_f_res_227298 = defunc_0_add_arg_227300;
                    }
                    
                    double x_227301 = a12_227284 * x_227294;
                    double y_227302 = b12_227285 * x_227295;
                    double x_227303 = x_227301 + y_227302;
                    double y_227304 = c12_227286 * x_227296;
                    double x_227305 = x_227303 + y_227304;
                    double defunc_9_fit_fun_res_227306 = defunc_0_f_res_227298 *
                           x_227305;
                    double x_227307 = b12_227285 * x_227294;
                    double y_227308 = b2_227287 * x_227295;
                    double x_227309 = x_227307 + y_227308;
                    double y_227310 = c2_227288 * x_227296;
                    double x_227311 = x_227309 + y_227310;
                    double defunc_9_slope_fun_res_227312 =
                           defunc_0_f_res_227298 * x_227311;
                    double defunc_1_op_res_227313 =
                           defunc_9_fit_fun_res_227306 + redout_227292;
                    double defunc_1_op_res_227314 =
                           defunc_9_slope_fun_res_227312 + redout_227293;
                    double redout_tmp_227332 = defunc_1_op_res_227313;
                    double redout_tmp_227333 = defunc_1_op_res_227314;
                    
                    redout_227292 = redout_tmp_227332;
                    redout_227293 = redout_tmp_227333;
                }
                defunc_2_reduce_res_227289 = redout_227292;
                defunc_2_reduce_res_227290 = redout_227293;
                ((double *) mem_218963)[i_227186 * s_n_m_203636 + i_227192] =
                    defunc_2_reduce_res_227289;
                ((double *) mem_218967)[i_227186 * s_n_m_203636 + i_227192] =
                    defunc_2_reduce_res_227290;
            }
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_219112.mem + gtid_210806 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218963 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_219117.mem + gtid_210806 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218967 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218963);
    free(mem_218967);
    free(mem_219012);
    free(mem_219015);
    free(mem_219042);
    free(mem_219045);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235870_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235870_end -
                 futhark_mc_segmap_parloop_235870_start;
        
        ctx->futhark_mc_segmap_parloop_235870_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235870_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235870_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235868(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210805 = tid;
    int num_tasks_227184 = info.nsubtasks;
    struct futhark_mc_task_235867 *futhark_mc_task_235867 =
                                  (struct futhark_mc_task_235867 *) args;
    struct futhark_context *ctx = futhark_mc_task_235867->ctx;
    uint64_t futhark_mc_segmap_task_235868_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235868_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235867->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235867->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235867->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235867->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235867->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235867->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235867->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235867->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235867->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235867->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235867->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235867->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235867->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235867->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235867->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 = futhark_mc_task_235867->free_bytes_218785;
    struct memblock mem_219112 = {.desc ="mem_219112", .mem =
                                  futhark_mc_task_235867->free_mem_219112,
                                  .size =0, .references =NULL};
    struct memblock mem_219117 = {.desc ="mem_219117", .mem =
                                  futhark_mc_task_235867->free_mem_219117,
                                  .size =0, .references =NULL};
    int64_t iter_227185;
    struct futhark_mc_segmap_parloop_struct_235869
    futhark_mc_segmap_parloop_struct_235869;
    
    futhark_mc_segmap_parloop_struct_235869.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235869.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235869.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235869.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235869.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235869.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235869.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235869.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235869.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235869.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235869.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235869.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235869.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235869.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235869.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235869.free_bytes_218785 = bytes_218785;
    futhark_mc_segmap_parloop_struct_235869.free_mem_219112 = mem_219112.mem;
    futhark_mc_segmap_parloop_struct_235869.free_mem_219117 = mem_219117.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235870_task;
    
    futhark_mc_segmap_parloop_235870_task.name =
        "futhark_mc_segmap_parloop_235870";
    futhark_mc_segmap_parloop_235870_task.fn = futhark_mc_segmap_parloop_235870;
    futhark_mc_segmap_parloop_235870_task.args =
        &futhark_mc_segmap_parloop_struct_235869;
    futhark_mc_segmap_parloop_235870_task.iterations = iterations;
    futhark_mc_segmap_parloop_235870_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235870_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235870_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235870_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235870_task);
    
    if (futhark_mc_segmap_parloop_235870_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235870_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235870_total_end -
                 futhark_mc_segmap_parloop_235870_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235870_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235870_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235870_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235868_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235868_end -
                 futhark_mc_segmap_task_235868_start;
        
        ctx->futhark_mc_segmap_task_235868_runs[tid]++;
        ctx->futhark_mc_segmap_task_235868_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235868_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235878 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    int64_t free_bytes_217597;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    unsigned char *free_mem_219112;
    unsigned char *free_mem_219117;
};
struct futhark_mc_task_235882 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    unsigned char *free_mem_218955;
    unsigned char *free_mem_218959;
};
struct futhark_mc_segmap_parloop_struct_235884 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    unsigned char *free_mem_218955;
    unsigned char *free_mem_218959;
};
static int futhark_mc_segmap_parloop_235885(void *args, int64_t start,
                                            int64_t end, int flat_tid_227592,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235884
    *futhark_mc_segmap_parloop_struct_235884 =
    (struct futhark_mc_segmap_parloop_struct_235884 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235884->ctx;
    uint64_t futhark_mc_segmap_parloop_235885_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235885_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235884->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235884->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235884->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235884->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235884->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235884->free_s_n_m_203636;
    int64_t gtid_211197 =
            futhark_mc_segmap_parloop_struct_235884->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235884->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 =
            futhark_mc_segmap_parloop_struct_235884->free_bytes_218785;
    struct memblock mem_218955 = {.desc ="mem_218955", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_218955,
                                  .size =0, .references =NULL};
    struct memblock mem_218959 = {.desc ="mem_218959", .mem =
                                  futhark_mc_segmap_parloop_struct_235884->free_mem_218959,
                                  .size =0, .references =NULL};
    size_t mem_227595_cached_sizze_235886 = 0;
    unsigned char *mem_227595 = NULL;
    size_t mem_227597_cached_sizze_235887 = 0;
    unsigned char *mem_227597 = NULL;
    size_t mem_227599_cached_sizze_235888 = 0;
    unsigned char *mem_227599 = NULL;
    size_t mem_227600_cached_sizze_235889 = 0;
    unsigned char *mem_227600 = NULL;
    size_t mem_227601_cached_sizze_235890 = 0;
    unsigned char *mem_227601 = NULL;
    size_t mem_227602_cached_sizze_235891 = 0;
    unsigned char *mem_227602 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227733 = start;
    
    if (mem_227595_cached_sizze_235886 < (size_t) bytes_217545) {
        mem_227595 = realloc(mem_227595, bytes_217545);
        mem_227595_cached_sizze_235886 = bytes_217545;
    }
    if (mem_227597_cached_sizze_235887 < (size_t) bytes_217545) {
        mem_227597 = realloc(mem_227597, bytes_217545);
        mem_227597_cached_sizze_235887 = bytes_217545;
    }
    if (mem_227599_cached_sizze_235888 < (size_t) bytes_218785) {
        mem_227599 = realloc(mem_227599, bytes_218785);
        mem_227599_cached_sizze_235888 = bytes_218785;
    }
    if (mem_227600_cached_sizze_235889 < (size_t) bytes_218785) {
        mem_227600 = realloc(mem_227600, bytes_218785);
        mem_227600_cached_sizze_235889 = bytes_218785;
    }
    if (mem_227601_cached_sizze_235890 < (size_t) bytes_218785) {
        mem_227601 = realloc(mem_227601, bytes_218785);
        mem_227601_cached_sizze_235890 = bytes_218785;
    }
    if (mem_227602_cached_sizze_235891 < (size_t) bytes_218785) {
        mem_227602 = realloc(mem_227602, bytes_218785);
        mem_227602_cached_sizze_235891 = bytes_218785;
    }
    for (; iter_227733 < end; iter_227733++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227859 = n_p_203492;
        int64_t gtid_227593 = iter_227733;
        int64_t remnant_227860 = iter_227733 - gtid_227593;
        int64_t x_227594;
        
        x_227594 = ((int64_t *) mem_217540.mem)[gtid_211197 * n_p_203492 +
                                                gtid_227593];
        for (int64_t i_227734 = 0; i_227734 < s_n_m_203636; i_227734++) {
            int64_t x_227737;
            
            x_227737 = ((int64_t *) mem_217710.mem)[gtid_211197 *
                                                    (s_n_m_203636 *
                                                     n_p_203492) + gtid_227593 *
                                                    s_n_m_203636 + i_227734];
            
            double x_227738;
            
            x_227738 = ((double *) mem_217715.mem)[gtid_211197 * (s_n_m_203636 *
                                                                  n_p_203492) +
                                                   gtid_227593 * s_n_m_203636 +
                                                   i_227734];
            
            bool cond_227739 = i_227734 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_227740;
            
            if (cond_227739) {
                defunc_0_m_fun_res_227740 = (int64_t) 0;
            } else {
                int64_t y_227741 = sub64(s_n_m_203636, (int64_t) 1);
                bool cond_227742 = i_227734 == y_227741;
                int64_t defunc_0_m_fun_res_f_res_227743;
                
                if (cond_227742) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_227744 =
                            sub64(pad_css_len_203632, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_227743 =
                        defunc_0_m_fun_res_f_res_t_res_227744;
                } else {
                    int64_t x_227745 = sub64(i_227734, (int64_t) 1);
                    int64_t x_227746 = mul64(jump_s_203499, x_227745);
                    int64_t min_arg_227747 = add64((int64_t) 1, x_227746);
                    int64_t min_res_227748 = smin64(defunc_0_f_res_203631,
                                                    min_arg_227747);
                    
                    defunc_0_m_fun_res_f_res_227743 = min_res_227748;
                }
                defunc_0_m_fun_res_227740 = defunc_0_m_fun_res_f_res_227743;
            }
            for (int64_t i_227753 = 0; i_227753 < q_s_203493; i_227753++) {
                bool cond_227756 = sle64(x_227594, i_227753);
                int64_t defunc_0_f_res_227757;
                
                if (cond_227756) {
                    defunc_0_f_res_227757 = (int64_t) 0;
                } else {
                    int64_t i_227758 = add64(x_227737, i_227753);
                    int64_t defunc_0_add_arg_227759;
                    
                    defunc_0_add_arg_227759 =
                        ((int64_t *) mem_217536.mem)[gtid_211197 *
                                                     (defunc_0_f_res_203631 *
                                                      n_p_203492) +
                                                     gtid_227593 *
                                                     defunc_0_f_res_203631 +
                                                     i_227758];
                    
                    int64_t defunc_1_add_res_227760 = add64((int64_t) 1,
                                                            defunc_0_add_arg_227759);
                    
                    defunc_0_f_res_227757 = defunc_1_add_res_227760;
                }
                
                double defunc_0_f_res_227761;
                
                if (cond_227756) {
                    defunc_0_f_res_227761 = 0.0;
                } else {
                    int64_t i_227762 = add64(x_227737, i_227753);
                    double defunc_0_add_arg_227763;
                    
                    defunc_0_add_arg_227763 =
                        ((double *) mem_218057.mem)[gtid_211197 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_227593 *
                                                    defunc_0_f_res_203631 +
                                                    i_227762];
                    defunc_0_f_res_227761 = defunc_0_add_arg_227763;
                }
                
                int64_t binop_p_227764 = sub64(defunc_0_f_res_227757,
                                               defunc_0_m_fun_res_227740);
                double defunc_0_f_res_227765 = sitofp_i64_f64(binop_p_227764);
                double abs_res_227766 = fabs(defunc_0_f_res_227765);
                double tmp1_227767 = abs_res_227766 / x_227738;
                double x_227768 = tmp1_227767 * tmp1_227767;
                double y_227769 = tmp1_227767 * x_227768;
                double tmp2_227770 = 1.0 - y_227769;
                double x_227771 = tmp2_227770 * tmp2_227770;
                double tmp3_227772 = tmp2_227770 * x_227771;
                double tmp4_227773 = defunc_0_f_res_227761 * tmp3_227772;
                
                ((double *) mem_227599)[i_227753] = defunc_0_f_res_227765;
                ((double *) mem_227600)[i_227753] = tmp4_227773;
            }
            
            double defunc_2_reduce_res_227778;
            double defunc_2_reduce_res_227779;
            double defunc_2_reduce_res_227780;
            double defunc_2_reduce_res_227781;
            double defunc_2_reduce_res_227782;
            double redout_227786;
            double redout_227787;
            double redout_227788;
            double redout_227789;
            double redout_227790;
            
            redout_227786 = 0.0;
            redout_227787 = 0.0;
            redout_227788 = 0.0;
            redout_227789 = 0.0;
            redout_227790 = 0.0;
            for (int64_t i_227785 = 0; i_227785 < q_s_203493; i_227785++) {
                double x_227793;
                
                x_227793 = ((double *) mem_227599)[i_227785];
                
                double x_227794;
                
                x_227794 = ((double *) mem_227600)[i_227785];
                
                double defunc_1_f_res_227795 = x_227793 * x_227794;
                double defunc_1_f_res_227796 = x_227793 * defunc_1_f_res_227795;
                double defunc_1_f_res_227797 = x_227793 * defunc_1_f_res_227796;
                double defunc_1_f_res_227798 = x_227793 * defunc_1_f_res_227797;
                double defunc_1_op_res_227799 = x_227794 + redout_227786;
                double defunc_1_op_res_227800 = defunc_1_f_res_227795 +
                       redout_227787;
                double defunc_1_op_res_227801 = defunc_1_f_res_227796 +
                       redout_227788;
                double defunc_1_op_res_227802 = defunc_1_f_res_227797 +
                       redout_227789;
                double defunc_1_op_res_227803 = defunc_1_f_res_227798 +
                       redout_227790;
                
                ((double *) mem_227601)[i_227785] = defunc_1_f_res_227796;
                ((double *) mem_227602)[i_227785] = defunc_1_f_res_227795;
                
                double redout_tmp_227865 = defunc_1_op_res_227799;
                double redout_tmp_227866 = defunc_1_op_res_227800;
                double redout_tmp_227867 = defunc_1_op_res_227801;
                double redout_tmp_227868 = defunc_1_op_res_227802;
                double redout_tmp_227869 = defunc_1_op_res_227803;
                
                redout_227786 = redout_tmp_227865;
                redout_227787 = redout_tmp_227866;
                redout_227788 = redout_tmp_227867;
                redout_227789 = redout_tmp_227868;
                redout_227790 = redout_tmp_227869;
            }
            defunc_2_reduce_res_227778 = redout_227786;
            defunc_2_reduce_res_227779 = redout_227787;
            defunc_2_reduce_res_227780 = redout_227788;
            defunc_2_reduce_res_227781 = redout_227789;
            defunc_2_reduce_res_227782 = redout_227790;
            
            double x_227806 = defunc_2_reduce_res_227780 *
                   defunc_2_reduce_res_227782;
            double y_227807 = defunc_2_reduce_res_227781 *
                   defunc_2_reduce_res_227781;
            double a12_227808 = x_227806 - y_227807;
            double x_227809 = defunc_2_reduce_res_227780 *
                   defunc_2_reduce_res_227781;
            double y_227810 = defunc_2_reduce_res_227779 *
                   defunc_2_reduce_res_227782;
            double b12_227811 = x_227809 - y_227810;
            double x_227812 = defunc_2_reduce_res_227779 *
                   defunc_2_reduce_res_227781;
            double y_227813 = defunc_2_reduce_res_227780 *
                   defunc_2_reduce_res_227780;
            double c12_227814 = x_227812 - y_227813;
            double x_227815 = defunc_2_reduce_res_227778 *
                   defunc_2_reduce_res_227782;
            double b2_227816 = x_227815 - y_227813;
            double x_227817 = defunc_2_reduce_res_227779 *
                   defunc_2_reduce_res_227780;
            double y_227818 = defunc_2_reduce_res_227778 *
                   defunc_2_reduce_res_227781;
            double c2_227819 = x_227817 - y_227818;
            double x_227820 = defunc_2_reduce_res_227778 * a12_227808;
            double y_227821 = defunc_2_reduce_res_227779 * b12_227811;
            double x_227822 = x_227820 + y_227821;
            double y_227823 = defunc_2_reduce_res_227780 * c12_227814;
            double y_227824 = x_227822 + y_227823;
            double det_227825 = 1.0 / y_227824;
            double a12_227826 = a12_227808 * det_227825;
            double b12_227827 = b12_227811 * det_227825;
            double c12_227828 = c12_227814 * det_227825;
            double b2_227829 = b2_227816 * det_227825;
            double c2_227830 = c2_227819 * det_227825;
            double defunc_2_reduce_res_227831;
            double defunc_2_reduce_res_227832;
            double redout_227834;
            double redout_227835;
            
            redout_227834 = 0.0;
            redout_227835 = 0.0;
            for (int64_t i_227833 = 0; i_227833 < q_s_203493; i_227833++) {
                double x_227836;
                
                x_227836 = ((double *) mem_227600)[i_227833];
                
                double x_227837;
                
                x_227837 = ((double *) mem_227602)[i_227833];
                
                double x_227838;
                
                x_227838 = ((double *) mem_227601)[i_227833];
                
                bool cond_227839 = sle64(x_227594, i_227833);
                double defunc_0_f_res_227840;
                
                if (cond_227839) {
                    defunc_0_f_res_227840 = 0.0;
                } else {
                    int64_t i_227841 = add64(x_227737, i_227833);
                    double defunc_0_add_arg_227842;
                    
                    defunc_0_add_arg_227842 =
                        ((double *) mem_218052.mem)[gtid_211197 *
                                                    (defunc_0_f_res_203631 *
                                                     n_p_203492) + gtid_227593 *
                                                    defunc_0_f_res_203631 +
                                                    i_227841];
                    defunc_0_f_res_227840 = defunc_0_add_arg_227842;
                }
                
                double x_227843 = a12_227826 * x_227836;
                double y_227844 = b12_227827 * x_227837;
                double x_227845 = x_227843 + y_227844;
                double y_227846 = c12_227828 * x_227838;
                double x_227847 = x_227845 + y_227846;
                double defunc_9_fit_fun_res_227848 = defunc_0_f_res_227840 *
                       x_227847;
                double x_227849 = b12_227827 * x_227836;
                double y_227850 = b2_227829 * x_227837;
                double x_227851 = x_227849 + y_227850;
                double y_227852 = c2_227830 * x_227838;
                double x_227853 = x_227851 + y_227852;
                double defunc_9_slope_fun_res_227854 = defunc_0_f_res_227840 *
                       x_227853;
                double defunc_1_op_res_227855 = defunc_9_fit_fun_res_227848 +
                       redout_227834;
                double defunc_1_op_res_227856 = defunc_9_slope_fun_res_227854 +
                       redout_227835;
                double redout_tmp_227872 = defunc_1_op_res_227855;
                double redout_tmp_227873 = defunc_1_op_res_227856;
                
                redout_227834 = redout_tmp_227872;
                redout_227835 = redout_tmp_227873;
            }
            defunc_2_reduce_res_227831 = redout_227834;
            defunc_2_reduce_res_227832 = redout_227835;
            ((double *) mem_227595)[i_227734] = defunc_2_reduce_res_227831;
            ((double *) mem_227597)[i_227734] = defunc_2_reduce_res_227832;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218955.mem + gtid_227593 * s_n_m_203636 * (int64_t) 8,
                    mem_227595 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218959.mem + gtid_227593 * s_n_m_203636 * (int64_t) 8,
                    mem_227597 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_227595);
    free(mem_227597);
    free(mem_227599);
    free(mem_227600);
    free(mem_227601);
    free(mem_227602);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235885_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235885_end -
                 futhark_mc_segmap_parloop_235885_start;
        
        ctx->futhark_mc_segmap_parloop_235885_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235885_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235885_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235883(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227592 = tid;
    int num_tasks_227732 = info.nsubtasks;
    struct futhark_mc_task_235882 *futhark_mc_task_235882 =
                                  (struct futhark_mc_task_235882 *) args;
    struct futhark_context *ctx = futhark_mc_task_235882->ctx;
    uint64_t futhark_mc_segmap_task_235883_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235883_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235882->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235882->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235882->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235882->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235882->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235882->free_s_n_m_203636;
    int64_t gtid_211197 = futhark_mc_task_235882->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235882->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235882->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235882->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235882->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235882->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235882->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235882->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 = futhark_mc_task_235882->free_bytes_218785;
    struct memblock mem_218955 = {.desc ="mem_218955", .mem =
                                  futhark_mc_task_235882->free_mem_218955,
                                  .size =0, .references =NULL};
    struct memblock mem_218959 = {.desc ="mem_218959", .mem =
                                  futhark_mc_task_235882->free_mem_218959,
                                  .size =0, .references =NULL};
    int64_t iter_227733;
    struct futhark_mc_segmap_parloop_struct_235884
    futhark_mc_segmap_parloop_struct_235884;
    
    futhark_mc_segmap_parloop_struct_235884.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235884.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235884.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235884.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235884.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235884.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235884.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235884.free_gtid_211197 = gtid_211197;
    futhark_mc_segmap_parloop_struct_235884.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235884.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235884.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235884.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235884.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235884.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235884.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235884.free_bytes_218785 = bytes_218785;
    futhark_mc_segmap_parloop_struct_235884.free_mem_218955 = mem_218955.mem;
    futhark_mc_segmap_parloop_struct_235884.free_mem_218959 = mem_218959.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235885_task;
    
    futhark_mc_segmap_parloop_235885_task.name =
        "futhark_mc_segmap_parloop_235885";
    futhark_mc_segmap_parloop_235885_task.fn = futhark_mc_segmap_parloop_235885;
    futhark_mc_segmap_parloop_235885_task.args =
        &futhark_mc_segmap_parloop_struct_235884;
    futhark_mc_segmap_parloop_235885_task.iterations = iterations;
    futhark_mc_segmap_parloop_235885_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235885_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235885_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235885_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235885_task);
    
    if (futhark_mc_segmap_parloop_235885_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235885_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235885_total_end -
                 futhark_mc_segmap_parloop_235885_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235885_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235885_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235885_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235883_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235883_end -
                 futhark_mc_segmap_task_235883_start;
        
        ctx->futhark_mc_segmap_task_235883_runs[tid]++;
        ctx->futhark_mc_segmap_task_235883_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235883_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235893 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217540;
    int64_t free_bytes_217545;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    unsigned char *free_mem_218955;
    unsigned char *free_mem_218959;
};
struct futhark_mc_task_235897 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    int64_t free_gtid_227336;
    int64_t free_x_227337;
    unsigned char *free_mem_227338;
    unsigned char *free_mem_227339;
};
struct futhark_mc_segmap_parloop_struct_235899 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    int64_t free_gtid_227336;
    int64_t free_x_227337;
    unsigned char *free_mem_227338;
    unsigned char *free_mem_227339;
};
static int futhark_mc_segmap_parloop_235900(void *args, int64_t start,
                                            int64_t end, int flat_tid_227999,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235899
    *futhark_mc_segmap_parloop_struct_235899 =
    (struct futhark_mc_segmap_parloop_struct_235899 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235899->ctx;
    uint64_t futhark_mc_segmap_parloop_235900_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235900_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235899->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235899->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235899->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235899->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235899->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235899->free_s_n_m_203636;
    int64_t gtid_211197 =
            futhark_mc_segmap_parloop_struct_235899->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235899->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235899->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235899->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235899->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235899->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 =
            futhark_mc_segmap_parloop_struct_235899->free_bytes_218785;
    int64_t gtid_227336 =
            futhark_mc_segmap_parloop_struct_235899->free_gtid_227336;
    int64_t x_227337 = futhark_mc_segmap_parloop_struct_235899->free_x_227337;
    struct memblock mem_227338 = {.desc ="mem_227338", .mem =
                                  futhark_mc_segmap_parloop_struct_235899->free_mem_227338,
                                  .size =0, .references =NULL};
    struct memblock mem_227339 = {.desc ="mem_227339", .mem =
                                  futhark_mc_segmap_parloop_struct_235899->free_mem_227339,
                                  .size =0, .references =NULL};
    size_t mem_228013_cached_sizze_235901 = 0;
    unsigned char *mem_228013 = NULL;
    size_t mem_228015_cached_sizze_235902 = 0;
    unsigned char *mem_228015 = NULL;
    size_t mem_228042_cached_sizze_235903 = 0;
    unsigned char *mem_228042 = NULL;
    size_t mem_228044_cached_sizze_235904 = 0;
    unsigned char *mem_228044 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228128 = start;
    
    if (mem_228013_cached_sizze_235901 < (size_t) bytes_218785) {
        mem_228013 = realloc(mem_228013, bytes_218785);
        mem_228013_cached_sizze_235901 = bytes_218785;
    }
    if (mem_228015_cached_sizze_235902 < (size_t) bytes_218785) {
        mem_228015 = realloc(mem_228015, bytes_218785);
        mem_228015_cached_sizze_235902 = bytes_218785;
    }
    if (mem_228042_cached_sizze_235903 < (size_t) bytes_218785) {
        mem_228042 = realloc(mem_228042, bytes_218785);
        mem_228042_cached_sizze_235903 = bytes_218785;
    }
    if (mem_228044_cached_sizze_235904 < (size_t) bytes_218785) {
        mem_228044 = realloc(mem_228044, bytes_218785);
        mem_228044_cached_sizze_235904 = bytes_218785;
    }
    for (; iter_228128 < end; iter_228128++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228205 = s_n_m_203636;
        int64_t gtid_228000 = iter_228128;
        int64_t remnant_228206 = iter_228128 - gtid_228000;
        int64_t x_228001;
        
        x_228001 = ((int64_t *) mem_217710.mem)[gtid_211197 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_227336 * s_n_m_203636 +
                                                gtid_228000];
        
        double x_228002;
        
        x_228002 = ((double *) mem_217715.mem)[gtid_211197 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_227336 * s_n_m_203636 +
                                               gtid_228000];
        
        bool cond_228003 = gtid_228000 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_228004;
        
        if (cond_228003) {
            defunc_0_m_fun_res_228004 = (int64_t) 0;
        } else {
            int64_t y_228129 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_228130 = gtid_228000 == y_228129;
            int64_t defunc_0_m_fun_res_f_res_228131;
            
            if (cond_228130) {
                int64_t defunc_0_m_fun_res_f_res_t_res_228132 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_228131 =
                    defunc_0_m_fun_res_f_res_t_res_228132;
            } else {
                int64_t x_228133 = sub64(gtid_228000, (int64_t) 1);
                int64_t x_228134 = mul64(jump_s_203499, x_228133);
                int64_t min_arg_228135 = add64((int64_t) 1, x_228134);
                int64_t min_res_228136 = smin64(defunc_0_f_res_203631,
                                                min_arg_228135);
                
                defunc_0_m_fun_res_f_res_228131 = min_res_228136;
            }
            defunc_0_m_fun_res_228004 = defunc_0_m_fun_res_f_res_228131;
        }
        for (int64_t i_228137 = 0; i_228137 < q_s_203493; i_228137++) {
            bool cond_228140 = sle64(x_227337, i_228137);
            int64_t defunc_0_f_res_228141;
            
            if (cond_228140) {
                defunc_0_f_res_228141 = (int64_t) 0;
            } else {
                int64_t i_228142 = add64(x_228001, i_228137);
                int64_t defunc_0_add_arg_228143;
                
                defunc_0_add_arg_228143 =
                    ((int64_t *) mem_217536.mem)[gtid_211197 *
                                                 (defunc_0_f_res_203631 *
                                                  n_p_203492) + gtid_227336 *
                                                 defunc_0_f_res_203631 +
                                                 i_228142];
                
                int64_t defunc_1_add_res_228144 = add64((int64_t) 1,
                                                        defunc_0_add_arg_228143);
                
                defunc_0_f_res_228141 = defunc_1_add_res_228144;
            }
            
            double defunc_0_f_res_228145;
            
            if (cond_228140) {
                defunc_0_f_res_228145 = 0.0;
            } else {
                int64_t i_228146 = add64(x_228001, i_228137);
                double defunc_0_add_arg_228147;
                
                defunc_0_add_arg_228147 =
                    ((double *) mem_218057.mem)[gtid_211197 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_227336 *
                                                defunc_0_f_res_203631 +
                                                i_228146];
                defunc_0_f_res_228145 = defunc_0_add_arg_228147;
            }
            
            int64_t binop_p_228148 = sub64(defunc_0_f_res_228141,
                                           defunc_0_m_fun_res_228004);
            double defunc_0_f_res_228149 = sitofp_i64_f64(binop_p_228148);
            double abs_res_228150 = fabs(defunc_0_f_res_228149);
            double tmp1_228151 = abs_res_228150 / x_228002;
            double x_228152 = tmp1_228151 * tmp1_228151;
            double y_228153 = tmp1_228151 * x_228152;
            double tmp2_228154 = 1.0 - y_228153;
            double x_228155 = tmp2_228154 * tmp2_228154;
            double tmp3_228156 = tmp2_228154 * x_228155;
            double tmp4_228157 = defunc_0_f_res_228145 * tmp3_228156;
            
            ((double *) mem_228013)[i_228137] = defunc_0_f_res_228149;
            ((double *) mem_228015)[i_228137] = tmp4_228157;
        }
        
        double defunc_2_reduce_res_228046;
        double defunc_2_reduce_res_228047;
        double defunc_2_reduce_res_228048;
        double defunc_2_reduce_res_228049;
        double defunc_2_reduce_res_228050;
        double redout_228161;
        double redout_228162;
        double redout_228163;
        double redout_228164;
        double redout_228165;
        
        redout_228161 = 0.0;
        redout_228162 = 0.0;
        redout_228163 = 0.0;
        redout_228164 = 0.0;
        redout_228165 = 0.0;
        for (int64_t i_228160 = 0; i_228160 < q_s_203493; i_228160++) {
            double x_228168;
            
            x_228168 = ((double *) mem_228013)[i_228160];
            
            double x_228169;
            
            x_228169 = ((double *) mem_228015)[i_228160];
            
            double defunc_1_f_res_228170 = x_228168 * x_228169;
            double defunc_1_f_res_228171 = x_228168 * defunc_1_f_res_228170;
            double defunc_1_f_res_228172 = x_228168 * defunc_1_f_res_228171;
            double defunc_1_f_res_228173 = x_228168 * defunc_1_f_res_228172;
            double defunc_1_op_res_228174 = x_228169 + redout_228161;
            double defunc_1_op_res_228175 = defunc_1_f_res_228170 +
                   redout_228162;
            double defunc_1_op_res_228176 = defunc_1_f_res_228171 +
                   redout_228163;
            double defunc_1_op_res_228177 = defunc_1_f_res_228172 +
                   redout_228164;
            double defunc_1_op_res_228178 = defunc_1_f_res_228173 +
                   redout_228165;
            
            ((double *) mem_228042)[i_228160] = defunc_1_f_res_228171;
            ((double *) mem_228044)[i_228160] = defunc_1_f_res_228170;
            
            double redout_tmp_228209 = defunc_1_op_res_228174;
            double redout_tmp_228210 = defunc_1_op_res_228175;
            double redout_tmp_228211 = defunc_1_op_res_228176;
            double redout_tmp_228212 = defunc_1_op_res_228177;
            double redout_tmp_228213 = defunc_1_op_res_228178;
            
            redout_228161 = redout_tmp_228209;
            redout_228162 = redout_tmp_228210;
            redout_228163 = redout_tmp_228211;
            redout_228164 = redout_tmp_228212;
            redout_228165 = redout_tmp_228213;
        }
        defunc_2_reduce_res_228046 = redout_228161;
        defunc_2_reduce_res_228047 = redout_228162;
        defunc_2_reduce_res_228048 = redout_228163;
        defunc_2_reduce_res_228049 = redout_228164;
        defunc_2_reduce_res_228050 = redout_228165;
        
        double x_228074 = defunc_2_reduce_res_228048 *
               defunc_2_reduce_res_228050;
        double y_228075 = defunc_2_reduce_res_228049 *
               defunc_2_reduce_res_228049;
        double a12_228076 = x_228074 - y_228075;
        double x_228077 = defunc_2_reduce_res_228048 *
               defunc_2_reduce_res_228049;
        double y_228078 = defunc_2_reduce_res_228047 *
               defunc_2_reduce_res_228050;
        double b12_228079 = x_228077 - y_228078;
        double x_228080 = defunc_2_reduce_res_228047 *
               defunc_2_reduce_res_228049;
        double y_228081 = defunc_2_reduce_res_228048 *
               defunc_2_reduce_res_228048;
        double c12_228082 = x_228080 - y_228081;
        double x_228083 = defunc_2_reduce_res_228046 *
               defunc_2_reduce_res_228050;
        double b2_228084 = x_228083 - y_228081;
        double x_228085 = defunc_2_reduce_res_228047 *
               defunc_2_reduce_res_228048;
        double y_228086 = defunc_2_reduce_res_228046 *
               defunc_2_reduce_res_228049;
        double c2_228087 = x_228085 - y_228086;
        double x_228088 = defunc_2_reduce_res_228046 * a12_228076;
        double y_228089 = defunc_2_reduce_res_228047 * b12_228079;
        double x_228090 = x_228088 + y_228089;
        double y_228091 = defunc_2_reduce_res_228048 * c12_228082;
        double y_228092 = x_228090 + y_228091;
        double det_228093 = 1.0 / y_228092;
        double a12_228094 = a12_228076 * det_228093;
        double b12_228095 = b12_228079 * det_228093;
        double c12_228096 = c12_228082 * det_228093;
        double b2_228097 = b2_228084 * det_228093;
        double c2_228098 = c2_228087 * det_228093;
        double defunc_2_reduce_res_228099;
        double defunc_2_reduce_res_228100;
        double redout_228182;
        double redout_228183;
        
        redout_228182 = 0.0;
        redout_228183 = 0.0;
        for (int64_t i_228181 = 0; i_228181 < q_s_203493; i_228181++) {
            double x_228184;
            
            x_228184 = ((double *) mem_228015)[i_228181];
            
            double x_228185;
            
            x_228185 = ((double *) mem_228044)[i_228181];
            
            double x_228186;
            
            x_228186 = ((double *) mem_228042)[i_228181];
            
            bool cond_228187 = sle64(x_227337, i_228181);
            double defunc_0_f_res_228188;
            
            if (cond_228187) {
                defunc_0_f_res_228188 = 0.0;
            } else {
                int64_t i_228189 = add64(x_228001, i_228181);
                double defunc_0_add_arg_228190;
                
                defunc_0_add_arg_228190 =
                    ((double *) mem_218052.mem)[gtid_211197 *
                                                (defunc_0_f_res_203631 *
                                                 n_p_203492) + gtid_227336 *
                                                defunc_0_f_res_203631 +
                                                i_228189];
                defunc_0_f_res_228188 = defunc_0_add_arg_228190;
            }
            
            double x_228191 = a12_228094 * x_228184;
            double y_228192 = b12_228095 * x_228185;
            double x_228193 = x_228191 + y_228192;
            double y_228194 = c12_228096 * x_228186;
            double x_228195 = x_228193 + y_228194;
            double defunc_9_fit_fun_res_228196 = defunc_0_f_res_228188 *
                   x_228195;
            double x_228197 = b12_228095 * x_228184;
            double y_228198 = b2_228097 * x_228185;
            double x_228199 = x_228197 + y_228198;
            double y_228200 = c2_228098 * x_228186;
            double x_228201 = x_228199 + y_228200;
            double defunc_9_slope_fun_res_228202 = defunc_0_f_res_228188 *
                   x_228201;
            double defunc_1_op_res_228203 = defunc_9_fit_fun_res_228196 +
                   redout_228182;
            double defunc_1_op_res_228204 = defunc_9_slope_fun_res_228202 +
                   redout_228183;
            double redout_tmp_228216 = defunc_1_op_res_228203;
            double redout_tmp_228217 = defunc_1_op_res_228204;
            
            redout_228182 = redout_tmp_228216;
            redout_228183 = redout_tmp_228217;
        }
        defunc_2_reduce_res_228099 = redout_228182;
        defunc_2_reduce_res_228100 = redout_228183;
        ((double *) mem_227338.mem)[gtid_228000] = defunc_2_reduce_res_228099;
        ((double *) mem_227339.mem)[gtid_228000] = defunc_2_reduce_res_228100;
    }
    
  cleanup:
    { }
    free(mem_228013);
    free(mem_228015);
    free(mem_228042);
    free(mem_228044);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235900_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235900_end -
                 futhark_mc_segmap_parloop_235900_start;
        
        ctx->futhark_mc_segmap_parloop_235900_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235900_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235900_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235898(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227999 = tid;
    int num_tasks_228127 = info.nsubtasks;
    struct futhark_mc_task_235897 *futhark_mc_task_235897 =
                                  (struct futhark_mc_task_235897 *) args;
    struct futhark_context *ctx = futhark_mc_task_235897->ctx;
    uint64_t futhark_mc_segmap_task_235898_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235898_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235897->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235897->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235897->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235897->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235897->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235897->free_s_n_m_203636;
    int64_t gtid_211197 = futhark_mc_task_235897->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235897->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235897->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235897->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235897->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235897->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 = futhark_mc_task_235897->free_bytes_218785;
    int64_t gtid_227336 = futhark_mc_task_235897->free_gtid_227336;
    int64_t x_227337 = futhark_mc_task_235897->free_x_227337;
    struct memblock mem_227338 = {.desc ="mem_227338", .mem =
                                  futhark_mc_task_235897->free_mem_227338,
                                  .size =0, .references =NULL};
    struct memblock mem_227339 = {.desc ="mem_227339", .mem =
                                  futhark_mc_task_235897->free_mem_227339,
                                  .size =0, .references =NULL};
    int64_t iter_228128;
    struct futhark_mc_segmap_parloop_struct_235899
    futhark_mc_segmap_parloop_struct_235899;
    
    futhark_mc_segmap_parloop_struct_235899.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235899.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235899.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235899.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235899.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235899.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235899.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235899.free_gtid_211197 = gtid_211197;
    futhark_mc_segmap_parloop_struct_235899.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235899.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235899.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235899.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235899.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235899.free_bytes_218785 = bytes_218785;
    futhark_mc_segmap_parloop_struct_235899.free_gtid_227336 = gtid_227336;
    futhark_mc_segmap_parloop_struct_235899.free_x_227337 = x_227337;
    futhark_mc_segmap_parloop_struct_235899.free_mem_227338 = mem_227338.mem;
    futhark_mc_segmap_parloop_struct_235899.free_mem_227339 = mem_227339.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235900_task;
    
    futhark_mc_segmap_parloop_235900_task.name =
        "futhark_mc_segmap_parloop_235900";
    futhark_mc_segmap_parloop_235900_task.fn = futhark_mc_segmap_parloop_235900;
    futhark_mc_segmap_parloop_235900_task.args =
        &futhark_mc_segmap_parloop_struct_235899;
    futhark_mc_segmap_parloop_235900_task.iterations = iterations;
    futhark_mc_segmap_parloop_235900_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235900_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235900_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235900_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235900_task);
    
    if (futhark_mc_segmap_parloop_235900_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235900_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235900_total_end -
                 futhark_mc_segmap_parloop_235900_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235900_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235900_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235900_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235898_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235898_end -
                 futhark_mc_segmap_task_235898_start;
        
        ctx->futhark_mc_segmap_task_235898_runs[tid]++;
        ctx->futhark_mc_segmap_task_235898_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235898_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235906 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_217710;
    unsigned char *free_mem_217715;
    unsigned char *free_mem_218052;
    unsigned char *free_mem_218057;
    int64_t free_bytes_218785;
    int64_t free_gtid_227336;
    int64_t free_x_227337;
    unsigned char *free_mem_227338;
    unsigned char *free_mem_227339;
};
struct futhark_mc_task_235912 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_227336;
    int64_t free_x_227337;
    int64_t free_x_227877;
    double free_x_227878;
    int64_t free_defunc_0_m_fun_res_227880;
    unsigned char *free_mem_227889;
    unsigned char *free_mem_227890;
};
struct futhark_mc_segmap_parloop_struct_235914 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_q_s_203493;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_211197;
    unsigned char *free_mem_217536;
    unsigned char *free_mem_218057;
    int64_t free_gtid_227336;
    int64_t free_x_227337;
    int64_t free_x_227877;
    double free_x_227878;
    int64_t free_defunc_0_m_fun_res_227880;
    unsigned char *free_mem_227889;
    unsigned char *free_mem_227890;
};
static int futhark_mc_segmap_parloop_235915(void *args, int64_t start,
                                            int64_t end, int flat_tid_228227,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235914
    *futhark_mc_segmap_parloop_struct_235914 =
    (struct futhark_mc_segmap_parloop_struct_235914 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235914->ctx;
    uint64_t futhark_mc_segmap_parloop_235915_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235915_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235914->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235914->free_q_s_203493;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235914->free_defunc_0_f_res_203631;
    int64_t gtid_211197 =
            futhark_mc_segmap_parloop_struct_235914->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235914->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235914->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_227336 =
            futhark_mc_segmap_parloop_struct_235914->free_gtid_227336;
    int64_t x_227337 = futhark_mc_segmap_parloop_struct_235914->free_x_227337;
    int64_t x_227877 = futhark_mc_segmap_parloop_struct_235914->free_x_227877;
    double x_227878 = futhark_mc_segmap_parloop_struct_235914->free_x_227878;
    int64_t defunc_0_m_fun_res_227880 =
            futhark_mc_segmap_parloop_struct_235914->free_defunc_0_m_fun_res_227880;
    struct memblock mem_227889 = {.desc ="mem_227889", .mem =
                                  futhark_mc_segmap_parloop_struct_235914->free_mem_227889,
                                  .size =0, .references =NULL};
    struct memblock mem_227890 = {.desc ="mem_227890", .mem =
                                  futhark_mc_segmap_parloop_struct_235914->free_mem_227890,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228300 = start;
    
    for (; iter_228300 < end; iter_228300++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228306 = q_s_203493;
        int64_t gtid_228228 = iter_228300;
        int64_t remnant_228307 = iter_228300 - gtid_228228;
        bool cond_228229 = sle64(x_227337, gtid_228228);
        int64_t defunc_0_f_res_228230;
        
        if (cond_228229) {
            defunc_0_f_res_228230 = (int64_t) 0;
        } else {
            int64_t i_228301 = add64(x_227877, gtid_228228);
            int64_t defunc_0_add_arg_228302;
            
            defunc_0_add_arg_228302 = ((int64_t *) mem_217536.mem)[gtid_211197 *
                                                                   (defunc_0_f_res_203631 *
                                                                    n_p_203492) +
                                                                   gtid_227336 *
                                                                   defunc_0_f_res_203631 +
                                                                   i_228301];
            
            int64_t defunc_1_add_res_228303 = add64((int64_t) 1,
                                                    defunc_0_add_arg_228302);
            
            defunc_0_f_res_228230 = defunc_1_add_res_228303;
        }
        
        double defunc_0_f_res_228234;
        
        if (cond_228229) {
            defunc_0_f_res_228234 = 0.0;
        } else {
            int64_t i_228304 = add64(x_227877, gtid_228228);
            double defunc_0_add_arg_228305;
            
            defunc_0_add_arg_228305 = ((double *) mem_218057.mem)[gtid_211197 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_227336 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_228304];
            defunc_0_f_res_228234 = defunc_0_add_arg_228305;
        }
        
        int64_t binop_p_228237 = sub64(defunc_0_f_res_228230,
                                       defunc_0_m_fun_res_227880);
        double defunc_0_f_res_228238 = sitofp_i64_f64(binop_p_228237);
        double abs_res_228239 = fabs(defunc_0_f_res_228238);
        double tmp1_228240 = abs_res_228239 / x_227878;
        double x_228241 = tmp1_228240 * tmp1_228240;
        double y_228242 = tmp1_228240 * x_228241;
        double tmp2_228243 = 1.0 - y_228242;
        double x_228244 = tmp2_228243 * tmp2_228243;
        double tmp3_228245 = tmp2_228243 * x_228244;
        double tmp4_228246 = defunc_0_f_res_228234 * tmp3_228245;
        
        ((double *) mem_227889.mem)[gtid_228228] = defunc_0_f_res_228238;
        ((double *) mem_227890.mem)[gtid_228228] = tmp4_228246;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235915_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235915_end -
                 futhark_mc_segmap_parloop_235915_start;
        
        ctx->futhark_mc_segmap_parloop_235915_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235915_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235915_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235913(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228227 = tid;
    int num_tasks_228299 = info.nsubtasks;
    struct futhark_mc_task_235912 *futhark_mc_task_235912 =
                                  (struct futhark_mc_task_235912 *) args;
    struct futhark_context *ctx = futhark_mc_task_235912->ctx;
    uint64_t futhark_mc_segmap_task_235913_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235913_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235912->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235912->free_q_s_203493;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235912->free_defunc_0_f_res_203631;
    int64_t gtid_211197 = futhark_mc_task_235912->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235912->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235912->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t gtid_227336 = futhark_mc_task_235912->free_gtid_227336;
    int64_t x_227337 = futhark_mc_task_235912->free_x_227337;
    int64_t x_227877 = futhark_mc_task_235912->free_x_227877;
    double x_227878 = futhark_mc_task_235912->free_x_227878;
    int64_t defunc_0_m_fun_res_227880 =
            futhark_mc_task_235912->free_defunc_0_m_fun_res_227880;
    struct memblock mem_227889 = {.desc ="mem_227889", .mem =
                                  futhark_mc_task_235912->free_mem_227889,
                                  .size =0, .references =NULL};
    struct memblock mem_227890 = {.desc ="mem_227890", .mem =
                                  futhark_mc_task_235912->free_mem_227890,
                                  .size =0, .references =NULL};
    int64_t iter_228300;
    struct futhark_mc_segmap_parloop_struct_235914
    futhark_mc_segmap_parloop_struct_235914;
    
    futhark_mc_segmap_parloop_struct_235914.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235914.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235914.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235914.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235914.free_gtid_211197 = gtid_211197;
    futhark_mc_segmap_parloop_struct_235914.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235914.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235914.free_gtid_227336 = gtid_227336;
    futhark_mc_segmap_parloop_struct_235914.free_x_227337 = x_227337;
    futhark_mc_segmap_parloop_struct_235914.free_x_227877 = x_227877;
    futhark_mc_segmap_parloop_struct_235914.free_x_227878 = x_227878;
    futhark_mc_segmap_parloop_struct_235914.free_defunc_0_m_fun_res_227880 =
        defunc_0_m_fun_res_227880;
    futhark_mc_segmap_parloop_struct_235914.free_mem_227889 = mem_227889.mem;
    futhark_mc_segmap_parloop_struct_235914.free_mem_227890 = mem_227890.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235915_task;
    
    futhark_mc_segmap_parloop_235915_task.name =
        "futhark_mc_segmap_parloop_235915";
    futhark_mc_segmap_parloop_235915_task.fn = futhark_mc_segmap_parloop_235915;
    futhark_mc_segmap_parloop_235915_task.args =
        &futhark_mc_segmap_parloop_struct_235914;
    futhark_mc_segmap_parloop_235915_task.iterations = iterations;
    futhark_mc_segmap_parloop_235915_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235915_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235915_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235915_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235915_task);
    
    if (futhark_mc_segmap_parloop_235915_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235915_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235915_total_end -
                 futhark_mc_segmap_parloop_235915_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235915_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235915_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235915_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235913_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235913_end -
                 futhark_mc_segmap_task_235913_start;
        
        ctx->futhark_mc_segmap_task_235913_runs[tid]++;
        ctx->futhark_mc_segmap_task_235913_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235913_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235916 {
    struct futhark_context *ctx;
    unsigned char *free_mem_227889;
    unsigned char *free_mem_227890;
    double *retval_defunc_2_reduce_res_227915;
    double *retval_defunc_2_reduce_res_227916;
    double *retval_defunc_2_reduce_res_227917;
    double *retval_defunc_2_reduce_res_227918;
    double *retval_defunc_2_reduce_res_227919;
    unsigned char *retval_mem_227913;
    unsigned char *retval_mem_227914;
};
struct futhark_mc_segred_stage_1_parloop_struct_235923 {
    struct futhark_context *ctx;
    unsigned char *free_mem_227889;
    unsigned char *free_mem_227890;
    unsigned char *free_mem_227913;
    unsigned char *free_mem_227914;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228309;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228311;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228313;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228315;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228317;
};
static int futhark_mc_segred_stage_1_parloop_235924(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_228247,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235923
    *futhark_mc_segred_stage_1_parloop_struct_235923 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235923 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235923->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235924_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235924_start = get_wall_time();
    
    struct memblock mem_227889 = {.desc ="mem_227889", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235923->free_mem_227889,
                                  .size =0, .references =NULL};
    struct memblock mem_227890 = {.desc ="mem_227890", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235923->free_mem_227890,
                                  .size =0, .references =NULL};
    struct memblock mem_227913 = {.desc ="mem_227913", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235923->free_mem_227913,
                                  .size =0, .references =NULL};
    struct memblock mem_227914 = {.desc ="mem_227914", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235923->free_mem_227914,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228309 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228309",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235923->free_reduce_stage_1_tid_res_arr_mem_228309,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228311 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228311",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235923->free_reduce_stage_1_tid_res_arr_mem_228311,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228313 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228313",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235923->free_reduce_stage_1_tid_res_arr_mem_228313,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228315 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228315",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235923->free_reduce_stage_1_tid_res_arr_mem_228315,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228317 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228317",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235923->free_reduce_stage_1_tid_res_arr_mem_228317,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228319 = start;
    double x_228249;
    double x_228250;
    double x_228252;
    double x_228253;
    double x_228255;
    double x_228256;
    double x_228258;
    double x_228259;
    double x_228261;
    double x_228262;
    double local_acc_228320 = 0.0;
    double local_acc_228321 = 0.0;
    double local_acc_228322 = 0.0;
    double local_acc_228323 = 0.0;
    double local_acc_228324 = 0.0;
    
    for (; iter_228319 < end; iter_228319++) {
        int64_t gtid_228248 = iter_228319;
        double x_228264;
        
        x_228264 = ((double *) mem_227889.mem)[gtid_228248];
        
        double x_228265;
        
        x_228265 = ((double *) mem_227890.mem)[gtid_228248];
        
        double defunc_1_f_res_228266 = x_228264 * x_228265;
        double defunc_1_f_res_228267 = x_228264 * defunc_1_f_res_228266;
        double defunc_1_f_res_228268 = x_228264 * defunc_1_f_res_228267;
        double defunc_1_f_res_228269 = x_228264 * defunc_1_f_res_228268;
        
        // save map-out results
        {
            ((double *) mem_227913.mem)[gtid_228248] = defunc_1_f_res_228267;
            ((double *) mem_227914.mem)[gtid_228248] = defunc_1_f_res_228266;
        }
        // Load accum params
        {
            x_228249 = local_acc_228320;
        }
        // Load next params
        {
            x_228250 = x_228265;
        }
        // Red body
        {
            double defunc_1_op_res_228251 = x_228249 + x_228250;
            
            local_acc_228320 = defunc_1_op_res_228251;
        }
        // Load accum params
        {
            x_228252 = local_acc_228321;
        }
        // Load next params
        {
            x_228253 = defunc_1_f_res_228266;
        }
        // Red body
        {
            double defunc_1_op_res_228254 = x_228252 + x_228253;
            
            local_acc_228321 = defunc_1_op_res_228254;
        }
        // Load accum params
        {
            x_228255 = local_acc_228322;
        }
        // Load next params
        {
            x_228256 = defunc_1_f_res_228267;
        }
        // Red body
        {
            double defunc_1_op_res_228257 = x_228255 + x_228256;
            
            local_acc_228322 = defunc_1_op_res_228257;
        }
        // Load accum params
        {
            x_228258 = local_acc_228323;
        }
        // Load next params
        {
            x_228259 = defunc_1_f_res_228268;
        }
        // Red body
        {
            double defunc_1_op_res_228260 = x_228258 + x_228259;
            
            local_acc_228323 = defunc_1_op_res_228260;
        }
        // Load accum params
        {
            x_228261 = local_acc_228324;
        }
        // Load next params
        {
            x_228262 = defunc_1_f_res_228269;
        }
        // Red body
        {
            double defunc_1_op_res_228263 = x_228261 + x_228262;
            
            local_acc_228324 = defunc_1_op_res_228263;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_228309.mem)[flat_tid_228247] =
        local_acc_228320;
    ((double *) reduce_stage_1_tid_res_arr_mem_228311.mem)[flat_tid_228247] =
        local_acc_228321;
    ((double *) reduce_stage_1_tid_res_arr_mem_228313.mem)[flat_tid_228247] =
        local_acc_228322;
    ((double *) reduce_stage_1_tid_res_arr_mem_228315.mem)[flat_tid_228247] =
        local_acc_228323;
    ((double *) reduce_stage_1_tid_res_arr_mem_228317.mem)[flat_tid_228247] =
        local_acc_228324;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235924_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235924_end -
                 futhark_mc_segred_stage_1_parloop_235924_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235924_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235924_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235924_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235917(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228247 = tid;
    int num_tasks_228308 = info.nsubtasks;
    struct futhark_mc_task_235916 *futhark_mc_task_235916 =
                                  (struct futhark_mc_task_235916 *) args;
    struct futhark_context *ctx = futhark_mc_task_235916->ctx;
    uint64_t futhark_mc_segred_task_235917_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235917_start = get_wall_time();
    
    struct memblock mem_227889 = {.desc ="mem_227889", .mem =
                                  futhark_mc_task_235916->free_mem_227889,
                                  .size =0, .references =NULL};
    struct memblock mem_227890 = {.desc ="mem_227890", .mem =
                                  futhark_mc_task_235916->free_mem_227890,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_227915 =
           *futhark_mc_task_235916->retval_defunc_2_reduce_res_227915;
    double defunc_2_reduce_res_227916 =
           *futhark_mc_task_235916->retval_defunc_2_reduce_res_227916;
    double defunc_2_reduce_res_227917 =
           *futhark_mc_task_235916->retval_defunc_2_reduce_res_227917;
    double defunc_2_reduce_res_227918 =
           *futhark_mc_task_235916->retval_defunc_2_reduce_res_227918;
    double defunc_2_reduce_res_227919 =
           *futhark_mc_task_235916->retval_defunc_2_reduce_res_227919;
    struct memblock mem_227913 = {.desc ="mem_227913", .mem =
                                  futhark_mc_task_235916->retval_mem_227913,
                                  .size =0, .references =NULL};
    struct memblock mem_227914 = {.desc ="mem_227914", .mem =
                                  futhark_mc_task_235916->retval_mem_227914,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_228309_cached_sizze_235918 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228309 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228311_cached_sizze_235919 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228311 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228313_cached_sizze_235920 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228313 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228315_cached_sizze_235921 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228315 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228317_cached_sizze_235922 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228317 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_228309_cached_sizze_235918 <
        (size_t) ((int64_t) 8 * num_tasks_228308)) {
        reduce_stage_1_tid_res_arr_mem_228309 =
            realloc(reduce_stage_1_tid_res_arr_mem_228309, (int64_t) 8 *
                    num_tasks_228308);
        reduce_stage_1_tid_res_arr_mem_228309_cached_sizze_235918 =
            (int64_t) 8 * num_tasks_228308;
    }
    if (reduce_stage_1_tid_res_arr_mem_228311_cached_sizze_235919 <
        (size_t) ((int64_t) 8 * num_tasks_228308)) {
        reduce_stage_1_tid_res_arr_mem_228311 =
            realloc(reduce_stage_1_tid_res_arr_mem_228311, (int64_t) 8 *
                    num_tasks_228308);
        reduce_stage_1_tid_res_arr_mem_228311_cached_sizze_235919 =
            (int64_t) 8 * num_tasks_228308;
    }
    if (reduce_stage_1_tid_res_arr_mem_228313_cached_sizze_235920 <
        (size_t) ((int64_t) 8 * num_tasks_228308)) {
        reduce_stage_1_tid_res_arr_mem_228313 =
            realloc(reduce_stage_1_tid_res_arr_mem_228313, (int64_t) 8 *
                    num_tasks_228308);
        reduce_stage_1_tid_res_arr_mem_228313_cached_sizze_235920 =
            (int64_t) 8 * num_tasks_228308;
    }
    if (reduce_stage_1_tid_res_arr_mem_228315_cached_sizze_235921 <
        (size_t) ((int64_t) 8 * num_tasks_228308)) {
        reduce_stage_1_tid_res_arr_mem_228315 =
            realloc(reduce_stage_1_tid_res_arr_mem_228315, (int64_t) 8 *
                    num_tasks_228308);
        reduce_stage_1_tid_res_arr_mem_228315_cached_sizze_235921 =
            (int64_t) 8 * num_tasks_228308;
    }
    if (reduce_stage_1_tid_res_arr_mem_228317_cached_sizze_235922 <
        (size_t) ((int64_t) 8 * num_tasks_228308)) {
        reduce_stage_1_tid_res_arr_mem_228317 =
            realloc(reduce_stage_1_tid_res_arr_mem_228317, (int64_t) 8 *
                    num_tasks_228308);
        reduce_stage_1_tid_res_arr_mem_228317_cached_sizze_235922 =
            (int64_t) 8 * num_tasks_228308;
    }
    
    int64_t iter_228319;
    struct futhark_mc_segred_stage_1_parloop_struct_235923
    futhark_mc_segred_stage_1_parloop_struct_235923;
    
    futhark_mc_segred_stage_1_parloop_struct_235923.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_mem_227889 =
        mem_227889.mem;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_mem_227890 =
        mem_227890.mem;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_mem_227913 =
        mem_227913.mem;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_mem_227914 =
        mem_227914.mem;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_reduce_stage_1_tid_res_arr_mem_228309 =
        reduce_stage_1_tid_res_arr_mem_228309;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_reduce_stage_1_tid_res_arr_mem_228311 =
        reduce_stage_1_tid_res_arr_mem_228311;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_reduce_stage_1_tid_res_arr_mem_228313 =
        reduce_stage_1_tid_res_arr_mem_228313;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_reduce_stage_1_tid_res_arr_mem_228315 =
        reduce_stage_1_tid_res_arr_mem_228315;
    futhark_mc_segred_stage_1_parloop_struct_235923.free_reduce_stage_1_tid_res_arr_mem_228317 =
        reduce_stage_1_tid_res_arr_mem_228317;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235924_task;
    
    futhark_mc_segred_stage_1_parloop_235924_task.name =
        "futhark_mc_segred_stage_1_parloop_235924";
    futhark_mc_segred_stage_1_parloop_235924_task.fn =
        futhark_mc_segred_stage_1_parloop_235924;
    futhark_mc_segred_stage_1_parloop_235924_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235923;
    futhark_mc_segred_stage_1_parloop_235924_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235924_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235924_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235924_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235924_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235924_task);
    
    if (futhark_mc_segred_stage_1_parloop_235924_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235924_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235924_total_end -
                 futhark_mc_segred_stage_1_parloop_235924_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235924_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235924_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235924_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_227915 = 0.0;
        defunc_2_reduce_res_227916 = 0.0;
        defunc_2_reduce_res_227917 = 0.0;
        defunc_2_reduce_res_227918 = 0.0;
        defunc_2_reduce_res_227919 = 0.0;
    }
    
    double x_228325;
    double x_228326;
    double x_228328;
    double x_228329;
    double x_228331;
    double x_228332;
    double x_228334;
    double x_228335;
    double x_228337;
    double x_228338;
    
    for (int32_t i_228340 = 0; i_228340 < num_tasks_228308; i_228340++) {
        flat_tid_228247 = i_228340;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_228325 = defunc_2_reduce_res_227915;
            }
            // load next params
            {
                x_228326 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228309)[flat_tid_228247];
            }
            // red body
            {
                double defunc_1_op_res_228327 = x_228325 + x_228326;
                
                defunc_2_reduce_res_227915 = defunc_1_op_res_228327;
            }
            // load acc params
            {
                x_228328 = defunc_2_reduce_res_227916;
            }
            // load next params
            {
                x_228329 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228311)[flat_tid_228247];
            }
            // red body
            {
                double defunc_1_op_res_228330 = x_228328 + x_228329;
                
                defunc_2_reduce_res_227916 = defunc_1_op_res_228330;
            }
            // load acc params
            {
                x_228331 = defunc_2_reduce_res_227917;
            }
            // load next params
            {
                x_228332 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228313)[flat_tid_228247];
            }
            // red body
            {
                double defunc_1_op_res_228333 = x_228331 + x_228332;
                
                defunc_2_reduce_res_227917 = defunc_1_op_res_228333;
            }
            // load acc params
            {
                x_228334 = defunc_2_reduce_res_227918;
            }
            // load next params
            {
                x_228335 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228315)[flat_tid_228247];
            }
            // red body
            {
                double defunc_1_op_res_228336 = x_228334 + x_228335;
                
                defunc_2_reduce_res_227918 = defunc_1_op_res_228336;
            }
            // load acc params
            {
                x_228337 = defunc_2_reduce_res_227919;
            }
            // load next params
            {
                x_228338 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228317)[flat_tid_228247];
            }
            // red body
            {
                double defunc_1_op_res_228339 = x_228337 + x_228338;
                
                defunc_2_reduce_res_227919 = defunc_1_op_res_228339;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_228309);
        free(reduce_stage_1_tid_res_arr_mem_228311);
        free(reduce_stage_1_tid_res_arr_mem_228313);
        free(reduce_stage_1_tid_res_arr_mem_228315);
        free(reduce_stage_1_tid_res_arr_mem_228317);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235917_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235917_end -
                 futhark_mc_segred_task_235917_start;
        
        ctx->futhark_mc_segred_task_235917_runs[tid]++;
        ctx->futhark_mc_segred_task_235917_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235917_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235916->retval_defunc_2_reduce_res_227915 =
            defunc_2_reduce_res_227915;
        *futhark_mc_task_235916->retval_defunc_2_reduce_res_227916 =
            defunc_2_reduce_res_227916;
        *futhark_mc_task_235916->retval_defunc_2_reduce_res_227917 =
            defunc_2_reduce_res_227917;
        *futhark_mc_task_235916->retval_defunc_2_reduce_res_227918 =
            defunc_2_reduce_res_227918;
        *futhark_mc_task_235916->retval_defunc_2_reduce_res_227919 =
            defunc_2_reduce_res_227919;
        futhark_mc_task_235916->retval_mem_227913 = mem_227913.mem;
        futhark_mc_task_235916->retval_mem_227914 = mem_227914.mem;
    }
    return err;
}
struct futhark_mc_task_235925 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_211197;
    unsigned char *free_mem_218052;
    int64_t free_gtid_227336;
    int64_t free_x_227337;
    int64_t free_x_227877;
    unsigned char *free_mem_227890;
    unsigned char *free_mem_227913;
    unsigned char *free_mem_227914;
    double free_a12_227965;
    double free_b12_227966;
    double free_c12_227967;
    double free_b2_227968;
    double free_c2_227969;
    double *retval_defunc_2_reduce_res_227970;
    double *retval_defunc_2_reduce_res_227971;
};
struct futhark_mc_segred_stage_1_parloop_struct_235929 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_gtid_211197;
    unsigned char *free_mem_218052;
    int64_t free_gtid_227336;
    int64_t free_x_227337;
    int64_t free_x_227877;
    unsigned char *free_mem_227890;
    unsigned char *free_mem_227913;
    unsigned char *free_mem_227914;
    double free_a12_227965;
    double free_b12_227966;
    double free_c12_227967;
    double free_b2_227968;
    double free_c2_227969;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228342;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228344;
};
static int futhark_mc_segred_stage_1_parloop_235930(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_228270,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235929
    *futhark_mc_segred_stage_1_parloop_struct_235929 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235929 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235929->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235930_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235930_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segred_stage_1_parloop_struct_235929->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segred_stage_1_parloop_struct_235929->free_defunc_0_f_res_203631;
    int64_t gtid_211197 =
            futhark_mc_segred_stage_1_parloop_struct_235929->free_gtid_211197;
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235929->free_mem_218052,
                                  .size =0, .references =NULL};
    int64_t gtid_227336 =
            futhark_mc_segred_stage_1_parloop_struct_235929->free_gtid_227336;
    int64_t x_227337 =
            futhark_mc_segred_stage_1_parloop_struct_235929->free_x_227337;
    int64_t x_227877 =
            futhark_mc_segred_stage_1_parloop_struct_235929->free_x_227877;
    struct memblock mem_227890 = {.desc ="mem_227890", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235929->free_mem_227890,
                                  .size =0, .references =NULL};
    struct memblock mem_227913 = {.desc ="mem_227913", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235929->free_mem_227913,
                                  .size =0, .references =NULL};
    struct memblock mem_227914 = {.desc ="mem_227914", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235929->free_mem_227914,
                                  .size =0, .references =NULL};
    double a12_227965 =
           futhark_mc_segred_stage_1_parloop_struct_235929->free_a12_227965;
    double b12_227966 =
           futhark_mc_segred_stage_1_parloop_struct_235929->free_b12_227966;
    double c12_227967 =
           futhark_mc_segred_stage_1_parloop_struct_235929->free_c12_227967;
    double b2_227968 =
           futhark_mc_segred_stage_1_parloop_struct_235929->free_b2_227968;
    double c2_227969 =
           futhark_mc_segred_stage_1_parloop_struct_235929->free_c2_227969;
    struct memblock reduce_stage_1_tid_res_arr_mem_228342 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228342",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235929->free_reduce_stage_1_tid_res_arr_mem_228342,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228344 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228344",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235929->free_reduce_stage_1_tid_res_arr_mem_228344,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228346 = start;
    double x_228272;
    double x_228273;
    double x_228275;
    double x_228276;
    double local_acc_228347 = 0.0;
    double local_acc_228348 = 0.0;
    
    for (; iter_228346 < end; iter_228346++) {
        int64_t gtid_228271 = iter_228346;
        double x_228278;
        
        x_228278 = ((double *) mem_227890.mem)[gtid_228271];
        
        double x_228279;
        
        x_228279 = ((double *) mem_227914.mem)[gtid_228271];
        
        double x_228280;
        
        x_228280 = ((double *) mem_227913.mem)[gtid_228271];
        
        bool cond_228281 = sle64(x_227337, gtid_228271);
        double defunc_0_f_res_228282;
        
        if (cond_228281) {
            defunc_0_f_res_228282 = 0.0;
        } else {
            int64_t i_228283 = add64(x_227877, gtid_228271);
            double defunc_0_add_arg_228284;
            
            defunc_0_add_arg_228284 = ((double *) mem_218052.mem)[gtid_211197 *
                                                                  (defunc_0_f_res_203631 *
                                                                   n_p_203492) +
                                                                  gtid_227336 *
                                                                  defunc_0_f_res_203631 +
                                                                  i_228283];
            defunc_0_f_res_228282 = defunc_0_add_arg_228284;
        }
        
        double x_228285 = a12_227965 * x_228278;
        double y_228286 = b12_227966 * x_228279;
        double x_228287 = x_228285 + y_228286;
        double y_228288 = c12_227967 * x_228280;
        double x_228289 = x_228287 + y_228288;
        double defunc_9_fit_fun_res_228290 = defunc_0_f_res_228282 * x_228289;
        double x_228291 = b12_227966 * x_228278;
        double y_228292 = b2_227968 * x_228279;
        double x_228293 = x_228291 + y_228292;
        double y_228294 = c2_227969 * x_228280;
        double x_228295 = x_228293 + y_228294;
        double defunc_9_slope_fun_res_228296 = defunc_0_f_res_228282 * x_228295;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_228272 = local_acc_228347;
        }
        // Load next params
        {
            x_228273 = defunc_9_fit_fun_res_228290;
        }
        // Red body
        {
            double defunc_1_op_res_228274 = x_228272 + x_228273;
            
            local_acc_228347 = defunc_1_op_res_228274;
        }
        // Load accum params
        {
            x_228275 = local_acc_228348;
        }
        // Load next params
        {
            x_228276 = defunc_9_slope_fun_res_228296;
        }
        // Red body
        {
            double defunc_1_op_res_228277 = x_228275 + x_228276;
            
            local_acc_228348 = defunc_1_op_res_228277;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_228342.mem)[flat_tid_228270] =
        local_acc_228347;
    ((double *) reduce_stage_1_tid_res_arr_mem_228344.mem)[flat_tid_228270] =
        local_acc_228348;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235930_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235930_end -
                 futhark_mc_segred_stage_1_parloop_235930_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235930_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235930_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235930_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235926(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228270 = tid;
    int num_tasks_228341 = info.nsubtasks;
    struct futhark_mc_task_235925 *futhark_mc_task_235925 =
                                  (struct futhark_mc_task_235925 *) args;
    struct futhark_context *ctx = futhark_mc_task_235925->ctx;
    uint64_t futhark_mc_segred_task_235926_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235926_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235925->free_n_p_203492;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235925->free_defunc_0_f_res_203631;
    int64_t gtid_211197 = futhark_mc_task_235925->free_gtid_211197;
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235925->free_mem_218052,
                                  .size =0, .references =NULL};
    int64_t gtid_227336 = futhark_mc_task_235925->free_gtid_227336;
    int64_t x_227337 = futhark_mc_task_235925->free_x_227337;
    int64_t x_227877 = futhark_mc_task_235925->free_x_227877;
    struct memblock mem_227890 = {.desc ="mem_227890", .mem =
                                  futhark_mc_task_235925->free_mem_227890,
                                  .size =0, .references =NULL};
    struct memblock mem_227913 = {.desc ="mem_227913", .mem =
                                  futhark_mc_task_235925->free_mem_227913,
                                  .size =0, .references =NULL};
    struct memblock mem_227914 = {.desc ="mem_227914", .mem =
                                  futhark_mc_task_235925->free_mem_227914,
                                  .size =0, .references =NULL};
    double a12_227965 = futhark_mc_task_235925->free_a12_227965;
    double b12_227966 = futhark_mc_task_235925->free_b12_227966;
    double c12_227967 = futhark_mc_task_235925->free_c12_227967;
    double b2_227968 = futhark_mc_task_235925->free_b2_227968;
    double c2_227969 = futhark_mc_task_235925->free_c2_227969;
    double defunc_2_reduce_res_227970 =
           *futhark_mc_task_235925->retval_defunc_2_reduce_res_227970;
    double defunc_2_reduce_res_227971 =
           *futhark_mc_task_235925->retval_defunc_2_reduce_res_227971;
    size_t reduce_stage_1_tid_res_arr_mem_228342_cached_sizze_235927 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228342 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228344_cached_sizze_235928 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228344 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_228342_cached_sizze_235927 <
        (size_t) ((int64_t) 8 * num_tasks_228341)) {
        reduce_stage_1_tid_res_arr_mem_228342 =
            realloc(reduce_stage_1_tid_res_arr_mem_228342, (int64_t) 8 *
                    num_tasks_228341);
        reduce_stage_1_tid_res_arr_mem_228342_cached_sizze_235927 =
            (int64_t) 8 * num_tasks_228341;
    }
    if (reduce_stage_1_tid_res_arr_mem_228344_cached_sizze_235928 <
        (size_t) ((int64_t) 8 * num_tasks_228341)) {
        reduce_stage_1_tid_res_arr_mem_228344 =
            realloc(reduce_stage_1_tid_res_arr_mem_228344, (int64_t) 8 *
                    num_tasks_228341);
        reduce_stage_1_tid_res_arr_mem_228344_cached_sizze_235928 =
            (int64_t) 8 * num_tasks_228341;
    }
    
    int64_t iter_228346;
    struct futhark_mc_segred_stage_1_parloop_struct_235929
    futhark_mc_segred_stage_1_parloop_struct_235929;
    
    futhark_mc_segred_stage_1_parloop_struct_235929.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_n_p_203492 =
        n_p_203492;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_gtid_211197 =
        gtid_211197;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_mem_218052 =
        mem_218052.mem;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_gtid_227336 =
        gtid_227336;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_x_227337 = x_227337;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_x_227877 = x_227877;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_mem_227890 =
        mem_227890.mem;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_mem_227913 =
        mem_227913.mem;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_mem_227914 =
        mem_227914.mem;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_a12_227965 =
        a12_227965;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_b12_227966 =
        b12_227966;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_c12_227967 =
        c12_227967;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_b2_227968 = b2_227968;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_c2_227969 = c2_227969;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_reduce_stage_1_tid_res_arr_mem_228342 =
        reduce_stage_1_tid_res_arr_mem_228342;
    futhark_mc_segred_stage_1_parloop_struct_235929.free_reduce_stage_1_tid_res_arr_mem_228344 =
        reduce_stage_1_tid_res_arr_mem_228344;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235930_task;
    
    futhark_mc_segred_stage_1_parloop_235930_task.name =
        "futhark_mc_segred_stage_1_parloop_235930";
    futhark_mc_segred_stage_1_parloop_235930_task.fn =
        futhark_mc_segred_stage_1_parloop_235930;
    futhark_mc_segred_stage_1_parloop_235930_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235929;
    futhark_mc_segred_stage_1_parloop_235930_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235930_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235930_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235930_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235930_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235930_task);
    
    if (futhark_mc_segred_stage_1_parloop_235930_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235930_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235930_total_end -
                 futhark_mc_segred_stage_1_parloop_235930_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235930_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235930_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235930_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_227970 = 0.0;
        defunc_2_reduce_res_227971 = 0.0;
    }
    
    double x_228349;
    double x_228350;
    double x_228352;
    double x_228353;
    
    for (int32_t i_228355 = 0; i_228355 < num_tasks_228341; i_228355++) {
        flat_tid_228270 = i_228355;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_228349 = defunc_2_reduce_res_227970;
            }
            // load next params
            {
                x_228350 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228342)[flat_tid_228270];
            }
            // red body
            {
                double defunc_1_op_res_228351 = x_228349 + x_228350;
                
                defunc_2_reduce_res_227970 = defunc_1_op_res_228351;
            }
            // load acc params
            {
                x_228352 = defunc_2_reduce_res_227971;
            }
            // load next params
            {
                x_228353 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228344)[flat_tid_228270];
            }
            // red body
            {
                double defunc_1_op_res_228354 = x_228352 + x_228353;
                
                defunc_2_reduce_res_227971 = defunc_1_op_res_228354;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_228342);
        free(reduce_stage_1_tid_res_arr_mem_228344);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235926_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235926_end -
                 futhark_mc_segred_task_235926_start;
        
        ctx->futhark_mc_segred_task_235926_runs[tid]++;
        ctx->futhark_mc_segred_task_235926_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235926_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235925->retval_defunc_2_reduce_res_227970 =
            defunc_2_reduce_res_227970;
        *futhark_mc_task_235925->retval_defunc_2_reduce_res_227971 =
            defunc_2_reduce_res_227971;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235907(void *args, int64_t start,
                                            int64_t end, int flat_tid_227875,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235906
    *futhark_mc_segmap_parloop_struct_235906 =
    (struct futhark_mc_segmap_parloop_struct_235906 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235906->ctx;
    uint64_t futhark_mc_segmap_parloop_235907_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235907_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235906->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235906->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235906->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235906->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235906->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235906->free_s_n_m_203636;
    int64_t gtid_211197 =
            futhark_mc_segmap_parloop_struct_235906->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235906->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235906->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235906->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235906->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235906->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 =
            futhark_mc_segmap_parloop_struct_235906->free_bytes_218785;
    int64_t gtid_227336 =
            futhark_mc_segmap_parloop_struct_235906->free_gtid_227336;
    int64_t x_227337 = futhark_mc_segmap_parloop_struct_235906->free_x_227337;
    struct memblock mem_227338 = {.desc ="mem_227338", .mem =
                                  futhark_mc_segmap_parloop_struct_235906->free_mem_227338,
                                  .size =0, .references =NULL};
    struct memblock mem_227339 = {.desc ="mem_227339", .mem =
                                  futhark_mc_segmap_parloop_struct_235906->free_mem_227339,
                                  .size =0, .references =NULL};
    size_t mem_227889_cached_sizze_235908 = 0;
    unsigned char *mem_227889 = NULL;
    size_t mem_227890_cached_sizze_235909 = 0;
    unsigned char *mem_227890 = NULL;
    size_t mem_227913_cached_sizze_235910 = 0;
    unsigned char *mem_227913 = NULL;
    size_t mem_227914_cached_sizze_235911 = 0;
    unsigned char *mem_227914 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228218 = start;
    
    if (mem_227889_cached_sizze_235908 < (size_t) bytes_218785) {
        mem_227889 = realloc(mem_227889, bytes_218785);
        mem_227889_cached_sizze_235908 = bytes_218785;
    }
    if (mem_227890_cached_sizze_235909 < (size_t) bytes_218785) {
        mem_227890 = realloc(mem_227890, bytes_218785);
        mem_227890_cached_sizze_235909 = bytes_218785;
    }
    if (mem_227913_cached_sizze_235910 < (size_t) bytes_218785) {
        mem_227913 = realloc(mem_227913, bytes_218785);
        mem_227913_cached_sizze_235910 = bytes_218785;
    }
    if (mem_227914_cached_sizze_235911 < (size_t) bytes_218785) {
        mem_227914 = realloc(mem_227914, bytes_218785);
        mem_227914_cached_sizze_235911 = bytes_218785;
    }
    for (; iter_228218 < end; iter_228218++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228297 = s_n_m_203636;
        int64_t gtid_227876 = iter_228218;
        int64_t remnant_228298 = iter_228218 - gtid_227876;
        int64_t x_227877;
        
        x_227877 = ((int64_t *) mem_217710.mem)[gtid_211197 * (s_n_m_203636 *
                                                               n_p_203492) +
                                                gtid_227336 * s_n_m_203636 +
                                                gtid_227876];
        
        double x_227878;
        
        x_227878 = ((double *) mem_217715.mem)[gtid_211197 * (s_n_m_203636 *
                                                              n_p_203492) +
                                               gtid_227336 * s_n_m_203636 +
                                               gtid_227876];
        
        bool cond_227879 = gtid_227876 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_227880;
        
        if (cond_227879) {
            defunc_0_m_fun_res_227880 = (int64_t) 0;
        } else {
            int64_t y_228219 = sub64(s_n_m_203636, (int64_t) 1);
            bool cond_228220 = gtid_227876 == y_228219;
            int64_t defunc_0_m_fun_res_f_res_228221;
            
            if (cond_228220) {
                int64_t defunc_0_m_fun_res_f_res_t_res_228222 =
                        sub64(pad_css_len_203632, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_228221 =
                    defunc_0_m_fun_res_f_res_t_res_228222;
            } else {
                int64_t x_228223 = sub64(gtid_227876, (int64_t) 1);
                int64_t x_228224 = mul64(jump_s_203499, x_228223);
                int64_t min_arg_228225 = add64((int64_t) 1, x_228224);
                int64_t min_res_228226 = smin64(defunc_0_f_res_203631,
                                                min_arg_228225);
                
                defunc_0_m_fun_res_f_res_228221 = min_res_228226;
            }
            defunc_0_m_fun_res_227880 = defunc_0_m_fun_res_f_res_228221;
        }
        
        int64_t flat_tid_228227 = (int64_t) 0;
        int32_t num_tasks_228299;
        struct futhark_mc_task_235912 futhark_mc_task_235912;
        
        futhark_mc_task_235912.ctx = ctx;
        futhark_mc_task_235912.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235912.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235912.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235912.free_gtid_211197 = gtid_211197;
        futhark_mc_task_235912.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235912.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235912.free_gtid_227336 = gtid_227336;
        futhark_mc_task_235912.free_x_227337 = x_227337;
        futhark_mc_task_235912.free_x_227877 = x_227877;
        futhark_mc_task_235912.free_x_227878 = x_227878;
        futhark_mc_task_235912.free_defunc_0_m_fun_res_227880 =
            defunc_0_m_fun_res_227880;
        futhark_mc_task_235912.free_mem_227889 = mem_227889;
        futhark_mc_task_235912.free_mem_227890 = mem_227890;
        
        struct scheduler_segop futhark_mc_task_235912_task;
        
        futhark_mc_task_235912_task.args = &futhark_mc_task_235912;
        futhark_mc_task_235912_task.top_level_fn =
            futhark_mc_segmap_task_235913;
        futhark_mc_task_235912_task.name = "futhark_mc_segmap_task_235913";
        futhark_mc_task_235912_task.iterations = q_s_203493;
        futhark_mc_task_235912_task.task_time =
            &ctx->futhark_mc_segmap_task_235913_total_time;
        futhark_mc_task_235912_task.task_iter =
            &ctx->futhark_mc_segmap_task_235913_total_iter;
        futhark_mc_task_235912_task.sched = STATIC;
        futhark_mc_task_235912_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235913_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235912_task);
        
        if (futhark_mc_segmap_task_235913_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double defunc_2_reduce_res_227915;
        double defunc_2_reduce_res_227916;
        double defunc_2_reduce_res_227917;
        double defunc_2_reduce_res_227918;
        double defunc_2_reduce_res_227919;
        int64_t flat_tid_228247 = (int64_t) 0;
        int32_t num_tasks_228308;
        
        defunc_2_reduce_res_227915 = 0.0;
        defunc_2_reduce_res_227916 = 0.0;
        defunc_2_reduce_res_227917 = 0.0;
        defunc_2_reduce_res_227918 = 0.0;
        defunc_2_reduce_res_227919 = 0.0;
        
        struct futhark_mc_task_235916 futhark_mc_task_235916;
        
        futhark_mc_task_235916.ctx = ctx;
        futhark_mc_task_235916.free_mem_227889 = mem_227889;
        futhark_mc_task_235916.free_mem_227890 = mem_227890;
        futhark_mc_task_235916.retval_defunc_2_reduce_res_227915 =
            &defunc_2_reduce_res_227915;
        futhark_mc_task_235916.retval_defunc_2_reduce_res_227916 =
            &defunc_2_reduce_res_227916;
        futhark_mc_task_235916.retval_defunc_2_reduce_res_227917 =
            &defunc_2_reduce_res_227917;
        futhark_mc_task_235916.retval_defunc_2_reduce_res_227918 =
            &defunc_2_reduce_res_227918;
        futhark_mc_task_235916.retval_defunc_2_reduce_res_227919 =
            &defunc_2_reduce_res_227919;
        futhark_mc_task_235916.retval_mem_227913 = mem_227913;
        futhark_mc_task_235916.retval_mem_227914 = mem_227914;
        
        struct scheduler_segop futhark_mc_task_235916_task;
        
        futhark_mc_task_235916_task.args = &futhark_mc_task_235916;
        futhark_mc_task_235916_task.top_level_fn =
            futhark_mc_segred_task_235917;
        futhark_mc_task_235916_task.name = "futhark_mc_segred_task_235917";
        futhark_mc_task_235916_task.iterations = q_s_203493;
        futhark_mc_task_235916_task.task_time =
            &ctx->futhark_mc_segred_task_235917_total_time;
        futhark_mc_task_235916_task.task_iter =
            &ctx->futhark_mc_segred_task_235917_total_iter;
        futhark_mc_task_235916_task.sched = STATIC;
        futhark_mc_task_235916_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235917_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235916_task);
        
        if (futhark_mc_segred_task_235917_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_227945 = defunc_2_reduce_res_227917 *
               defunc_2_reduce_res_227919;
        double y_227946 = defunc_2_reduce_res_227918 *
               defunc_2_reduce_res_227918;
        double a12_227947 = x_227945 - y_227946;
        double x_227948 = defunc_2_reduce_res_227917 *
               defunc_2_reduce_res_227918;
        double y_227949 = defunc_2_reduce_res_227916 *
               defunc_2_reduce_res_227919;
        double b12_227950 = x_227948 - y_227949;
        double x_227951 = defunc_2_reduce_res_227916 *
               defunc_2_reduce_res_227918;
        double y_227952 = defunc_2_reduce_res_227917 *
               defunc_2_reduce_res_227917;
        double c12_227953 = x_227951 - y_227952;
        double x_227954 = defunc_2_reduce_res_227915 *
               defunc_2_reduce_res_227919;
        double b2_227955 = x_227954 - y_227952;
        double x_227956 = defunc_2_reduce_res_227916 *
               defunc_2_reduce_res_227917;
        double y_227957 = defunc_2_reduce_res_227915 *
               defunc_2_reduce_res_227918;
        double c2_227958 = x_227956 - y_227957;
        double x_227959 = defunc_2_reduce_res_227915 * a12_227947;
        double y_227960 = defunc_2_reduce_res_227916 * b12_227950;
        double x_227961 = x_227959 + y_227960;
        double y_227962 = defunc_2_reduce_res_227917 * c12_227953;
        double y_227963 = x_227961 + y_227962;
        double det_227964 = 1.0 / y_227963;
        double a12_227965 = a12_227947 * det_227964;
        double b12_227966 = b12_227950 * det_227964;
        double c12_227967 = c12_227953 * det_227964;
        double b2_227968 = b2_227955 * det_227964;
        double c2_227969 = c2_227958 * det_227964;
        double defunc_2_reduce_res_227970;
        double defunc_2_reduce_res_227971;
        int64_t flat_tid_228270 = (int64_t) 0;
        int32_t num_tasks_228341;
        
        defunc_2_reduce_res_227970 = 0.0;
        defunc_2_reduce_res_227971 = 0.0;
        
        struct futhark_mc_task_235925 futhark_mc_task_235925;
        
        futhark_mc_task_235925.ctx = ctx;
        futhark_mc_task_235925.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235925.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235925.free_gtid_211197 = gtid_211197;
        futhark_mc_task_235925.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235925.free_gtid_227336 = gtid_227336;
        futhark_mc_task_235925.free_x_227337 = x_227337;
        futhark_mc_task_235925.free_x_227877 = x_227877;
        futhark_mc_task_235925.free_mem_227890 = mem_227890;
        futhark_mc_task_235925.free_mem_227913 = mem_227913;
        futhark_mc_task_235925.free_mem_227914 = mem_227914;
        futhark_mc_task_235925.free_a12_227965 = a12_227965;
        futhark_mc_task_235925.free_b12_227966 = b12_227966;
        futhark_mc_task_235925.free_c12_227967 = c12_227967;
        futhark_mc_task_235925.free_b2_227968 = b2_227968;
        futhark_mc_task_235925.free_c2_227969 = c2_227969;
        futhark_mc_task_235925.retval_defunc_2_reduce_res_227970 =
            &defunc_2_reduce_res_227970;
        futhark_mc_task_235925.retval_defunc_2_reduce_res_227971 =
            &defunc_2_reduce_res_227971;
        
        struct scheduler_segop futhark_mc_task_235925_task;
        
        futhark_mc_task_235925_task.args = &futhark_mc_task_235925;
        futhark_mc_task_235925_task.top_level_fn =
            futhark_mc_segred_task_235926;
        futhark_mc_task_235925_task.name = "futhark_mc_segred_task_235926";
        futhark_mc_task_235925_task.iterations = q_s_203493;
        futhark_mc_task_235925_task.task_time =
            &ctx->futhark_mc_segred_task_235926_total_time;
        futhark_mc_task_235925_task.task_iter =
            &ctx->futhark_mc_segred_task_235926_total_iter;
        futhark_mc_task_235925_task.sched = STATIC;
        futhark_mc_task_235925_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235926_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235925_task);
        
        if (futhark_mc_segred_task_235926_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_227338.mem)[gtid_227876] = defunc_2_reduce_res_227970;
        ((double *) mem_227339.mem)[gtid_227876] = defunc_2_reduce_res_227971;
    }
    
  cleanup:
    { }
    free(mem_227889);
    free(mem_227890);
    free(mem_227913);
    free(mem_227914);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235907_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235907_end -
                 futhark_mc_segmap_parloop_235907_start;
        
        ctx->futhark_mc_segmap_parloop_235907_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235907_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235907_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235905(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227875 = tid;
    int num_tasks_228127 = info.nsubtasks;
    struct futhark_mc_task_235897 *futhark_mc_task_235897 =
                                  (struct futhark_mc_task_235897 *) args;
    struct futhark_context *ctx = futhark_mc_task_235897->ctx;
    uint64_t futhark_mc_segmap_nested_task_235905_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235905_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235897->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235897->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235897->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235897->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235897->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235897->free_s_n_m_203636;
    int64_t gtid_211197 = futhark_mc_task_235897->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235897->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235897->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235897->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235897->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235897->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 = futhark_mc_task_235897->free_bytes_218785;
    int64_t gtid_227336 = futhark_mc_task_235897->free_gtid_227336;
    int64_t x_227337 = futhark_mc_task_235897->free_x_227337;
    struct memblock mem_227338 = {.desc ="mem_227338", .mem =
                                  futhark_mc_task_235897->free_mem_227338,
                                  .size =0, .references =NULL};
    struct memblock mem_227339 = {.desc ="mem_227339", .mem =
                                  futhark_mc_task_235897->free_mem_227339,
                                  .size =0, .references =NULL};
    int64_t iter_228218;
    struct futhark_mc_segmap_parloop_struct_235906
    futhark_mc_segmap_parloop_struct_235906;
    
    futhark_mc_segmap_parloop_struct_235906.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235906.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235906.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235906.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235906.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235906.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235906.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235906.free_gtid_211197 = gtid_211197;
    futhark_mc_segmap_parloop_struct_235906.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235906.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235906.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235906.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235906.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235906.free_bytes_218785 = bytes_218785;
    futhark_mc_segmap_parloop_struct_235906.free_gtid_227336 = gtid_227336;
    futhark_mc_segmap_parloop_struct_235906.free_x_227337 = x_227337;
    futhark_mc_segmap_parloop_struct_235906.free_mem_227338 = mem_227338.mem;
    futhark_mc_segmap_parloop_struct_235906.free_mem_227339 = mem_227339.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235907_task;
    
    futhark_mc_segmap_parloop_235907_task.name =
        "futhark_mc_segmap_parloop_235907";
    futhark_mc_segmap_parloop_235907_task.fn = futhark_mc_segmap_parloop_235907;
    futhark_mc_segmap_parloop_235907_task.args =
        &futhark_mc_segmap_parloop_struct_235906;
    futhark_mc_segmap_parloop_235907_task.iterations = iterations;
    futhark_mc_segmap_parloop_235907_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235907_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235907_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235907_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235907_task);
    
    if (futhark_mc_segmap_parloop_235907_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235907_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235907_total_end -
                 futhark_mc_segmap_parloop_235907_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235907_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235907_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235907_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235905_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235905_end -
                 futhark_mc_segmap_nested_task_235905_start;
        
        ctx->futhark_mc_segmap_nested_task_235905_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235905_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235905_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235894(void *args, int64_t start,
                                            int64_t end, int flat_tid_227335,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235893
    *futhark_mc_segmap_parloop_struct_235893 =
    (struct futhark_mc_segmap_parloop_struct_235893 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235893->ctx;
    uint64_t futhark_mc_segmap_parloop_235894_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235894_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235893->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235893->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235893->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235893->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235893->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235893->free_s_n_m_203636;
    int64_t gtid_211197 =
            futhark_mc_segmap_parloop_struct_235893->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235893->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 =
            futhark_mc_segmap_parloop_struct_235893->free_bytes_218785;
    struct memblock mem_218955 = {.desc ="mem_218955", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_218955,
                                  .size =0, .references =NULL};
    struct memblock mem_218959 = {.desc ="mem_218959", .mem =
                                  futhark_mc_segmap_parloop_struct_235893->free_mem_218959,
                                  .size =0, .references =NULL};
    size_t mem_227338_cached_sizze_235895 = 0;
    unsigned char *mem_227338 = NULL;
    size_t mem_227339_cached_sizze_235896 = 0;
    unsigned char *mem_227339 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227874 = start;
    
    if (mem_227338_cached_sizze_235895 < (size_t) bytes_217545) {
        mem_227338 = realloc(mem_227338, bytes_217545);
        mem_227338_cached_sizze_235895 = bytes_217545;
    }
    if (mem_227339_cached_sizze_235896 < (size_t) bytes_217545) {
        mem_227339 = realloc(mem_227339, bytes_217545);
        mem_227339_cached_sizze_235896 = bytes_217545;
    }
    for (; iter_227874 < end; iter_227874++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228125 = n_p_203492;
        int64_t gtid_227336 = iter_227874;
        int64_t remnant_228126 = iter_227874 - gtid_227336;
        int64_t x_227337;
        
        x_227337 = ((int64_t *) mem_217540.mem)[gtid_211197 * n_p_203492 +
                                                gtid_227336];
        
        int64_t flat_tid_227999 = (int64_t) 0;
        int32_t num_tasks_228127;
        int64_t flat_tid_227875 = (int64_t) 0;
        struct futhark_mc_task_235897 futhark_mc_task_235897;
        
        futhark_mc_task_235897.ctx = ctx;
        futhark_mc_task_235897.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235897.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235897.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235897.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235897.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235897.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235897.free_gtid_211197 = gtid_211197;
        futhark_mc_task_235897.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235897.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235897.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235897.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235897.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235897.free_bytes_218785 = bytes_218785;
        futhark_mc_task_235897.free_gtid_227336 = gtid_227336;
        futhark_mc_task_235897.free_x_227337 = x_227337;
        futhark_mc_task_235897.free_mem_227338 = mem_227338;
        futhark_mc_task_235897.free_mem_227339 = mem_227339;
        
        struct scheduler_segop futhark_mc_task_235897_task;
        
        futhark_mc_task_235897_task.args = &futhark_mc_task_235897;
        futhark_mc_task_235897_task.top_level_fn =
            futhark_mc_segmap_task_235898;
        futhark_mc_task_235897_task.name = "futhark_mc_segmap_task_235898";
        futhark_mc_task_235897_task.iterations = s_n_m_203636;
        futhark_mc_task_235897_task.task_time =
            &ctx->futhark_mc_segmap_task_235898_total_time;
        futhark_mc_task_235897_task.task_iter =
            &ctx->futhark_mc_segmap_task_235898_total_iter;
        futhark_mc_task_235897_task.sched = STATIC;
        futhark_mc_task_235897_task.nested_fn =
            futhark_mc_segmap_nested_task_235905;
        
        int futhark_mc_segmap_task_235898_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235897_task);
        
        if (futhark_mc_segmap_task_235898_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218955.mem + gtid_227336 * s_n_m_203636 * (int64_t) 8,
                    mem_227338 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
        if (s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_218959.mem + gtid_227336 * s_n_m_203636 * (int64_t) 8,
                    mem_227339 + (int64_t) 0, s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_227338);
    free(mem_227339);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235894_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235894_end -
                 futhark_mc_segmap_parloop_235894_start;
        
        ctx->futhark_mc_segmap_parloop_235894_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235894_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235894_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235892(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227335 = tid;
    int num_tasks_227732 = info.nsubtasks;
    struct futhark_mc_task_235882 *futhark_mc_task_235882 =
                                  (struct futhark_mc_task_235882 *) args;
    struct futhark_context *ctx = futhark_mc_task_235882->ctx;
    uint64_t futhark_mc_segmap_nested_task_235892_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235892_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235882->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235882->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235882->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235882->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235882->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235882->free_s_n_m_203636;
    int64_t gtid_211197 = futhark_mc_task_235882->free_gtid_211197;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235882->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235882->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235882->free_bytes_217545;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235882->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235882->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235882->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235882->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 = futhark_mc_task_235882->free_bytes_218785;
    struct memblock mem_218955 = {.desc ="mem_218955", .mem =
                                  futhark_mc_task_235882->free_mem_218955,
                                  .size =0, .references =NULL};
    struct memblock mem_218959 = {.desc ="mem_218959", .mem =
                                  futhark_mc_task_235882->free_mem_218959,
                                  .size =0, .references =NULL};
    int64_t iter_227874;
    struct futhark_mc_segmap_parloop_struct_235893
    futhark_mc_segmap_parloop_struct_235893;
    
    futhark_mc_segmap_parloop_struct_235893.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235893.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235893.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235893.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235893.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235893.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235893.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235893.free_gtid_211197 = gtid_211197;
    futhark_mc_segmap_parloop_struct_235893.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235893.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235893.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235893.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235893.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235893.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235893.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235893.free_bytes_218785 = bytes_218785;
    futhark_mc_segmap_parloop_struct_235893.free_mem_218955 = mem_218955.mem;
    futhark_mc_segmap_parloop_struct_235893.free_mem_218959 = mem_218959.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235894_task;
    
    futhark_mc_segmap_parloop_235894_task.name =
        "futhark_mc_segmap_parloop_235894";
    futhark_mc_segmap_parloop_235894_task.fn = futhark_mc_segmap_parloop_235894;
    futhark_mc_segmap_parloop_235894_task.args =
        &futhark_mc_segmap_parloop_struct_235893;
    futhark_mc_segmap_parloop_235894_task.iterations = iterations;
    futhark_mc_segmap_parloop_235894_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235894_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235894_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235894_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235894_task);
    
    if (futhark_mc_segmap_parloop_235894_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235894_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235894_total_end -
                 futhark_mc_segmap_parloop_235894_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235894_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235894_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235894_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235892_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235892_end -
                 futhark_mc_segmap_nested_task_235892_start;
        
        ctx->futhark_mc_segmap_nested_task_235892_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235892_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235892_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235879(void *args, int64_t start,
                                            int64_t end, int flat_tid_211196,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235878
    *futhark_mc_segmap_parloop_struct_235878 =
    (struct futhark_mc_segmap_parloop_struct_235878 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235878->ctx;
    uint64_t futhark_mc_segmap_parloop_235879_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235879_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235878->free_n_p_203492;
    int64_t q_s_203493 =
            futhark_mc_segmap_parloop_struct_235878->free_q_s_203493;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235878->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235878->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235878->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235878->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235878->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 =
            futhark_mc_segmap_parloop_struct_235878->free_bytes_217545;
    int64_t bytes_217597 =
            futhark_mc_segmap_parloop_struct_235878->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 =
            futhark_mc_segmap_parloop_struct_235878->free_bytes_218785;
    struct memblock mem_219112 = {.desc ="mem_219112", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_219112,
                                  .size =0, .references =NULL};
    struct memblock mem_219117 = {.desc ="mem_219117", .mem =
                                  futhark_mc_segmap_parloop_struct_235878->free_mem_219117,
                                  .size =0, .references =NULL};
    size_t mem_218955_cached_sizze_235880 = 0;
    unsigned char *mem_218955 = NULL;
    size_t mem_218959_cached_sizze_235881 = 0;
    unsigned char *mem_218959 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227334 = start;
    
    if (mem_218955_cached_sizze_235880 < (size_t) bytes_217597) {
        mem_218955 = realloc(mem_218955, bytes_217597);
        mem_218955_cached_sizze_235880 = bytes_217597;
    }
    if (mem_218959_cached_sizze_235881 < (size_t) bytes_217597) {
        mem_218959 = realloc(mem_218959, bytes_217597);
        mem_218959_cached_sizze_235881 = bytes_217597;
    }
    for (; iter_227334 < end; iter_227334++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227730 = partition_sizze_203577;
        int64_t gtid_211197 = iter_227334;
        int64_t remnant_227731 = iter_227334 - gtid_211197;
        int64_t flat_tid_227592 = (int64_t) 0;
        int32_t num_tasks_227732;
        int64_t flat_tid_227335 = (int64_t) 0;
        struct futhark_mc_task_235882 futhark_mc_task_235882;
        
        futhark_mc_task_235882.ctx = ctx;
        futhark_mc_task_235882.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235882.free_q_s_203493 = q_s_203493;
        futhark_mc_task_235882.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235882.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235882.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235882.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235882.free_gtid_211197 = gtid_211197;
        futhark_mc_task_235882.free_mem_217536 = mem_217536.mem;
        futhark_mc_task_235882.free_mem_217540 = mem_217540.mem;
        futhark_mc_task_235882.free_bytes_217545 = bytes_217545;
        futhark_mc_task_235882.free_mem_217710 = mem_217710.mem;
        futhark_mc_task_235882.free_mem_217715 = mem_217715.mem;
        futhark_mc_task_235882.free_mem_218052 = mem_218052.mem;
        futhark_mc_task_235882.free_mem_218057 = mem_218057.mem;
        futhark_mc_task_235882.free_bytes_218785 = bytes_218785;
        futhark_mc_task_235882.free_mem_218955 = mem_218955;
        futhark_mc_task_235882.free_mem_218959 = mem_218959;
        
        struct scheduler_segop futhark_mc_task_235882_task;
        
        futhark_mc_task_235882_task.args = &futhark_mc_task_235882;
        futhark_mc_task_235882_task.top_level_fn =
            futhark_mc_segmap_task_235883;
        futhark_mc_task_235882_task.name = "futhark_mc_segmap_task_235883";
        futhark_mc_task_235882_task.iterations = n_p_203492;
        futhark_mc_task_235882_task.task_time =
            &ctx->futhark_mc_segmap_task_235883_total_time;
        futhark_mc_task_235882_task.task_iter =
            &ctx->futhark_mc_segmap_task_235883_total_iter;
        futhark_mc_task_235882_task.sched = STATIC;
        futhark_mc_task_235882_task.nested_fn =
            futhark_mc_segmap_nested_task_235892;
        
        int futhark_mc_segmap_task_235883_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235882_task);
        
        if (futhark_mc_segmap_task_235883_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_219112.mem + gtid_211197 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218955 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
        if (n_p_203492 * s_n_m_203636 * (int64_t) 8 > 0)
            memmove(mem_219117.mem + gtid_211197 * (s_n_m_203636 * n_p_203492) *
                    (int64_t) 8, mem_218959 + (int64_t) 0, n_p_203492 *
                    s_n_m_203636 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218955);
    free(mem_218959);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235879_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235879_end -
                 futhark_mc_segmap_parloop_235879_start;
        
        ctx->futhark_mc_segmap_parloop_235879_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235879_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235879_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235877(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211196 = tid;
    int num_tasks_227184 = info.nsubtasks;
    struct futhark_mc_task_235867 *futhark_mc_task_235867 =
                                  (struct futhark_mc_task_235867 *) args;
    struct futhark_context *ctx = futhark_mc_task_235867->ctx;
    uint64_t futhark_mc_segmap_nested_task_235877_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235877_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235867->free_n_p_203492;
    int64_t q_s_203493 = futhark_mc_task_235867->free_q_s_203493;
    int64_t jump_s_203499 = futhark_mc_task_235867->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235867->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235867->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235867->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235867->free_s_n_m_203636;
    struct memblock mem_217536 = {.desc ="mem_217536", .mem =
                                  futhark_mc_task_235867->free_mem_217536,
                                  .size =0, .references =NULL};
    struct memblock mem_217540 = {.desc ="mem_217540", .mem =
                                  futhark_mc_task_235867->free_mem_217540,
                                  .size =0, .references =NULL};
    int64_t bytes_217545 = futhark_mc_task_235867->free_bytes_217545;
    int64_t bytes_217597 = futhark_mc_task_235867->free_bytes_217597;
    struct memblock mem_217710 = {.desc ="mem_217710", .mem =
                                  futhark_mc_task_235867->free_mem_217710,
                                  .size =0, .references =NULL};
    struct memblock mem_217715 = {.desc ="mem_217715", .mem =
                                  futhark_mc_task_235867->free_mem_217715,
                                  .size =0, .references =NULL};
    struct memblock mem_218052 = {.desc ="mem_218052", .mem =
                                  futhark_mc_task_235867->free_mem_218052,
                                  .size =0, .references =NULL};
    struct memblock mem_218057 = {.desc ="mem_218057", .mem =
                                  futhark_mc_task_235867->free_mem_218057,
                                  .size =0, .references =NULL};
    int64_t bytes_218785 = futhark_mc_task_235867->free_bytes_218785;
    struct memblock mem_219112 = {.desc ="mem_219112", .mem =
                                  futhark_mc_task_235867->free_mem_219112,
                                  .size =0, .references =NULL};
    struct memblock mem_219117 = {.desc ="mem_219117", .mem =
                                  futhark_mc_task_235867->free_mem_219117,
                                  .size =0, .references =NULL};
    int64_t iter_227334;
    struct futhark_mc_segmap_parloop_struct_235878
    futhark_mc_segmap_parloop_struct_235878;
    
    futhark_mc_segmap_parloop_struct_235878.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235878.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235878.free_q_s_203493 = q_s_203493;
    futhark_mc_segmap_parloop_struct_235878.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235878.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235878.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235878.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235878.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235878.free_mem_217536 = mem_217536.mem;
    futhark_mc_segmap_parloop_struct_235878.free_mem_217540 = mem_217540.mem;
    futhark_mc_segmap_parloop_struct_235878.free_bytes_217545 = bytes_217545;
    futhark_mc_segmap_parloop_struct_235878.free_bytes_217597 = bytes_217597;
    futhark_mc_segmap_parloop_struct_235878.free_mem_217710 = mem_217710.mem;
    futhark_mc_segmap_parloop_struct_235878.free_mem_217715 = mem_217715.mem;
    futhark_mc_segmap_parloop_struct_235878.free_mem_218052 = mem_218052.mem;
    futhark_mc_segmap_parloop_struct_235878.free_mem_218057 = mem_218057.mem;
    futhark_mc_segmap_parloop_struct_235878.free_bytes_218785 = bytes_218785;
    futhark_mc_segmap_parloop_struct_235878.free_mem_219112 = mem_219112.mem;
    futhark_mc_segmap_parloop_struct_235878.free_mem_219117 = mem_219117.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235879_task;
    
    futhark_mc_segmap_parloop_235879_task.name =
        "futhark_mc_segmap_parloop_235879";
    futhark_mc_segmap_parloop_235879_task.fn = futhark_mc_segmap_parloop_235879;
    futhark_mc_segmap_parloop_235879_task.args =
        &futhark_mc_segmap_parloop_struct_235878;
    futhark_mc_segmap_parloop_235879_task.iterations = iterations;
    futhark_mc_segmap_parloop_235879_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235879_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235879_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235879_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235879_task);
    
    if (futhark_mc_segmap_parloop_235879_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235879_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235879_total_end -
                 futhark_mc_segmap_parloop_235879_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235879_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235879_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235879_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235877_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235877_end -
                 futhark_mc_segmap_nested_task_235877_start;
        
        ctx->futhark_mc_segmap_nested_task_235877_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235877_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235877_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235931 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_bytes_219125;
    int64_t free_bytes_219144;
    unsigned char *free_mem_219194;
};
struct futhark_mc_segmap_parloop_struct_235933 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_bytes_219144;
    unsigned char *free_mem_219194;
};
static int futhark_mc_segmap_parloop_235934(void *args, int64_t start,
                                            int64_t end, int flat_tid_211581,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235933
    *futhark_mc_segmap_parloop_struct_235933 =
    (struct futhark_mc_segmap_parloop_struct_235933 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235933->ctx;
    uint64_t futhark_mc_segmap_parloop_235934_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235934_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235933->free_n_p_203492;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235933->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235933->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235933->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235933->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235933->free_s_n_m_203636;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_segmap_parloop_struct_235933->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_segmap_parloop_struct_235933->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219144 =
            futhark_mc_segmap_parloop_struct_235933->free_bytes_219144;
    struct memblock mem_219194 = {.desc ="mem_219194", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_219194,
                                  .size =0, .references =NULL};
    size_t mem_219149_cached_sizze_235935 = 0;
    unsigned char *mem_219149 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228357 = start;
    
    if (mem_219149_cached_sizze_235935 < (size_t) bytes_219144) {
        mem_219149 = realloc(mem_219149, bytes_219144);
        mem_219149_cached_sizze_235935 = bytes_219144;
    }
    for (; iter_228357 < end; iter_228357++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228443 = partition_sizze_203577;
        int64_t gtid_211582 = iter_228357;
        int64_t remnant_228444 = iter_228357 - gtid_211582;
        
        for (int64_t i_228358 = 0; i_228358 < n_p_203492; i_228358++) {
            for (int64_t i_228361 = 0; i_228361 < pad_css_len_203632;
                 i_228361++) {
                bool cond_228363 = i_228361 == (int64_t) 0;
                double defunc_0_f_res_228364;
                
                if (cond_228363) {
                    bool y_228365 = slt64((int64_t) 0, s_n_m_203636);
                    bool index_certs_228366;
                    
                    if (!y_228365) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) (int64_t) 0,
                                      "] out of bounds for array of shape [",
                                      (long long) s_n_m_203636, "].",
                                      "-> #0  /prelude/array.fut:21:29-32\n   #1  loess.fut:559:12-20\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    double head_res_228367;
                    
                    head_res_228367 =
                        ((double *) ext_mem_219123.mem)[gtid_211582 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        i_228358 *
                                                        s_n_m_203636];
                    defunc_0_f_res_228364 = head_res_228367;
                } else {
                    int64_t y_228368 = sub64(pad_css_len_203632, (int64_t) 1);
                    bool cond_228369 = i_228361 == y_228368;
                    double defunc_0_f_res_f_res_228370;
                    
                    if (cond_228369) {
                        int64_t i_228371 = sub64(s_n_m_203636, (int64_t) 1);
                        bool x_228372 = sle64((int64_t) 0, i_228371);
                        bool y_228373 = slt64(i_228371, s_n_m_203636);
                        bool bounds_check_228374 = x_228372 && y_228373;
                        bool index_certs_228375;
                        
                        if (!bounds_check_228374) {
                            ctx->error =
                                msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                          "Index [", (long long) i_228371,
                                          "] out of bounds for array of shape [",
                                          (long long) s_n_m_203636, "].",
                                          "-> #0  /prelude/array.fut:26:29-34\n   #1  loess.fut:561:12-20\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                            err = 1;
                            goto cleanup;
                        }
                        
                        double last_res_228376;
                        
                        last_res_228376 =
                            ((double *) ext_mem_219123.mem)[gtid_211582 *
                                                            (s_n_m_203636 *
                                                             n_p_203492) +
                                                            i_228358 *
                                                            s_n_m_203636 +
                                                            i_228371];
                        defunc_0_f_res_f_res_228370 = last_res_228376;
                    } else {
                        int64_t x_228377 = sub64(i_228361, (int64_t) 1);
                        bool zzero_228378 = jump_s_203499 == (int64_t) 0;
                        bool nonzzero_228379 = !zzero_228378;
                        bool nonzzero_cert_228380;
                        
                        if (!nonzzero_228379) {
                            ctx->error =
                                msgprintf("Error: %s\n\nBacktrace:\n%s",
                                          "division by zero",
                                          "-> #0  loess.fut:563:22-35\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:557:3-566:9\n   #5  stl.fut:220:31-96\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:219:23-221:48\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:218:15-222:44\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t x_228381 = sdiv64(x_228377, jump_s_203499);
                        int64_t m_v_228382 = add64((int64_t) 1, x_228381);
                        int64_t j_228383;
                        
                        if (cond_228363) {
                            j_228383 = (int64_t) 0;
                        } else {
                            int64_t y_228384 = sub64(s_n_m_203636, (int64_t) 1);
                            bool cond_228385 = m_v_228382 == y_228384;
                            int64_t j_f_res_228386;
                            
                            if (cond_228385) {
                                j_f_res_228386 = x_228381;
                            } else {
                                j_f_res_228386 = m_v_228382;
                            }
                            j_228383 = j_f_res_228386;
                        }
                        
                        bool cond_228387 = j_228383 == (int64_t) 0;
                        int64_t defunc_0_m_fun_res_228388;
                        
                        if (cond_228387) {
                            defunc_0_m_fun_res_228388 = (int64_t) 0;
                        } else {
                            int64_t y_228389 = sub64(s_n_m_203636, (int64_t) 1);
                            bool cond_228390 = j_228383 == y_228389;
                            int64_t defunc_0_m_fun_res_f_res_228391;
                            
                            if (cond_228390) {
                                defunc_0_m_fun_res_f_res_228391 = y_228368;
                            } else {
                                int64_t x_228392 = sub64(j_228383, (int64_t) 1);
                                int64_t x_228393 = mul64(jump_s_203499,
                                                         x_228392);
                                int64_t min_arg_228394 = add64((int64_t) 1,
                                                               x_228393);
                                int64_t min_res_228395 =
                                        smin64(defunc_0_f_res_203631,
                                               min_arg_228394);
                                
                                defunc_0_m_fun_res_f_res_228391 =
                                    min_res_228395;
                            }
                            defunc_0_m_fun_res_228388 =
                                defunc_0_m_fun_res_f_res_228391;
                        }
                        
                        int64_t defunc_0_m_fun_arg_228396 = add64((int64_t) 1,
                                                                  j_228383);
                        bool cond_228397 = defunc_0_m_fun_arg_228396 ==
                             (int64_t) 0;
                        int64_t defunc_0_m_fun_res_228398;
                        
                        if (cond_228397) {
                            defunc_0_m_fun_res_228398 = (int64_t) 0;
                        } else {
                            int64_t y_228399 = sub64(s_n_m_203636, (int64_t) 1);
                            bool cond_228400 = defunc_0_m_fun_arg_228396 ==
                                 y_228399;
                            int64_t defunc_0_m_fun_res_f_res_228401;
                            
                            if (cond_228400) {
                                defunc_0_m_fun_res_f_res_228401 = y_228368;
                            } else {
                                int64_t x_228402 = mul64(jump_s_203499,
                                                         j_228383);
                                int64_t min_arg_228403 = add64((int64_t) 1,
                                                               x_228402);
                                int64_t min_res_228404 =
                                        smin64(defunc_0_f_res_203631,
                                               min_arg_228403);
                                
                                defunc_0_m_fun_res_f_res_228401 =
                                    min_res_228404;
                            }
                            defunc_0_m_fun_res_228398 =
                                defunc_0_m_fun_res_f_res_228401;
                        }
                        
                        int64_t i64_arg_228405 =
                                sub64(defunc_0_m_fun_res_228398,
                                      defunc_0_m_fun_res_228388);
                        double i64_res_228406 = sitofp_i64_f64(i64_arg_228405);
                        int64_t i64_arg_228407 = sub64(i_228361,
                                                       defunc_0_m_fun_res_228388);
                        double i64_res_228408 = sitofp_i64_f64(i64_arg_228407);
                        double u_228409 = i64_res_228408 / i64_res_228406;
                        double u2_228410 = u_228409 * u_228409;
                        double u3_228411 = u_228409 * u2_228410;
                        double x_228412 = 2.0 * u3_228411;
                        double y_228413 = 3.0 * u2_228410;
                        double x_228414 = x_228412 - y_228413;
                        double x_228415 = 1.0 + x_228414;
                        bool x_228416 = sle64((int64_t) 0, j_228383);
                        bool y_228417 = slt64(j_228383, s_n_m_203636);
                        bool bounds_check_228418 = x_228416 && y_228417;
                        bool index_certs_228419;
                        
                        if (!bounds_check_228418) {
                            ctx->error =
                                msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                          "Index [", (long long) j_228383,
                                          "] out of bounds for array of shape [",
                                          (long long) s_n_m_203636, "].",
                                          "-> #0  loess.fut:536:27-33\n   #1  loess.fut:565:15-52\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                            err = 1;
                            goto cleanup;
                        }
                        
                        double y_228420;
                        
                        y_228420 = ((double *) ext_mem_219123.mem)[gtid_211582 *
                                                                   (s_n_m_203636 *
                                                                    n_p_203492) +
                                                                   i_228358 *
                                                                   s_n_m_203636 +
                                                                   j_228383];
                        
                        double x_228421 = x_228415 * y_228420;
                        double x_228422 = y_228413 - x_228412;
                        bool x_228423 = sle64((int64_t) 0,
                                              defunc_0_m_fun_arg_228396);
                        bool y_228424 = slt64(defunc_0_m_fun_arg_228396,
                                              s_n_m_203636);
                        bool bounds_check_228425 = x_228423 && y_228424;
                        bool index_certs_228426;
                        
                        if (!bounds_check_228425) {
                            ctx->error =
                                msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                          "Index [",
                                          (long long) defunc_0_m_fun_arg_228396,
                                          "] out of bounds for array of shape [",
                                          (long long) s_n_m_203636, "].",
                                          "-> #0  loess.fut:537:27-37\n   #1  loess.fut:565:15-52\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                            err = 1;
                            goto cleanup;
                        }
                        
                        double y_228427;
                        
                        y_228427 = ((double *) ext_mem_219123.mem)[gtid_211582 *
                                                                   (s_n_m_203636 *
                                                                    n_p_203492) +
                                                                   i_228358 *
                                                                   s_n_m_203636 +
                                                                   defunc_0_m_fun_arg_228396];
                        
                        double y_228428 = x_228422 * y_228427;
                        double x_228429 = x_228421 + y_228428;
                        double y_228430 = 2.0 * u2_228410;
                        double x_228431 = u3_228411 - y_228430;
                        double x_228432 = u_228409 + x_228431;
                        double y_228433;
                        
                        y_228433 = ((double *) ext_mem_219122.mem)[gtid_211582 *
                                                                   (s_n_m_203636 *
                                                                    n_p_203492) +
                                                                   i_228358 *
                                                                   s_n_m_203636 +
                                                                   j_228383];
                        
                        double x_228434 = x_228432 * y_228433;
                        double y_228435 = i64_res_228406 * x_228434;
                        double x_228436 = x_228429 + y_228435;
                        double x_228437 = u3_228411 - u2_228410;
                        double y_228438;
                        
                        y_228438 = ((double *) ext_mem_219122.mem)[gtid_211582 *
                                                                   (s_n_m_203636 *
                                                                    n_p_203492) +
                                                                   i_228358 *
                                                                   s_n_m_203636 +
                                                                   defunc_0_m_fun_arg_228396];
                        
                        double x_228439 = x_228437 * y_228438;
                        double y_228440 = i64_res_228406 * x_228439;
                        double defunc_4_interpolate_proc_res_228441 = x_228436 +
                               y_228440;
                        
                        defunc_0_f_res_f_res_228370 =
                            defunc_4_interpolate_proc_res_228441;
                    }
                    defunc_0_f_res_228364 = defunc_0_f_res_f_res_228370;
                }
                ((double *) mem_219149)[i_228358 * pad_css_len_203632 +
                                        i_228361] = defunc_0_f_res_228364;
            }
        }
        if (n_p_203492 * pad_css_len_203632 * (int64_t) 8 > 0)
            memmove(mem_219194.mem + gtid_211582 * (pad_css_len_203632 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_219149 + (int64_t) 0, n_p_203492 * pad_css_len_203632 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219149);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235934_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235934_end -
                 futhark_mc_segmap_parloop_235934_start;
        
        ctx->futhark_mc_segmap_parloop_235934_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235934_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235934_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235932(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211581 = tid;
    int num_tasks_228356 = info.nsubtasks;
    struct futhark_mc_task_235931 *futhark_mc_task_235931 =
                                  (struct futhark_mc_task_235931 *) args;
    struct futhark_context *ctx = futhark_mc_task_235931->ctx;
    uint64_t futhark_mc_segmap_task_235932_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235932_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235931->free_n_p_203492;
    int64_t jump_s_203499 = futhark_mc_task_235931->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235931->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235931->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235931->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235931->free_s_n_m_203636;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_task_235931->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_task_235931->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219125 = futhark_mc_task_235931->free_bytes_219125;
    int64_t bytes_219144 = futhark_mc_task_235931->free_bytes_219144;
    struct memblock mem_219194 = {.desc ="mem_219194", .mem =
                                  futhark_mc_task_235931->free_mem_219194,
                                  .size =0, .references =NULL};
    int64_t iter_228357;
    struct futhark_mc_segmap_parloop_struct_235933
    futhark_mc_segmap_parloop_struct_235933;
    
    futhark_mc_segmap_parloop_struct_235933.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235933.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235933.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235933.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235933.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235933.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235933.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235933.free_ext_mem_219122 =
        ext_mem_219122.mem;
    futhark_mc_segmap_parloop_struct_235933.free_ext_mem_219123 =
        ext_mem_219123.mem;
    futhark_mc_segmap_parloop_struct_235933.free_bytes_219144 = bytes_219144;
    futhark_mc_segmap_parloop_struct_235933.free_mem_219194 = mem_219194.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235934_task;
    
    futhark_mc_segmap_parloop_235934_task.name =
        "futhark_mc_segmap_parloop_235934";
    futhark_mc_segmap_parloop_235934_task.fn = futhark_mc_segmap_parloop_235934;
    futhark_mc_segmap_parloop_235934_task.args =
        &futhark_mc_segmap_parloop_struct_235933;
    futhark_mc_segmap_parloop_235934_task.iterations = iterations;
    futhark_mc_segmap_parloop_235934_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235934_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235934_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235934_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235934_task);
    
    if (futhark_mc_segmap_parloop_235934_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235934_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235934_total_end -
                 futhark_mc_segmap_parloop_235934_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235934_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235934_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235934_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235932_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235932_end -
                 futhark_mc_segmap_task_235932_start;
        
        ctx->futhark_mc_segmap_task_235932_runs[tid]++;
        ctx->futhark_mc_segmap_task_235932_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235932_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235937 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_partition_sizze_203577;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_bytes_219125;
    int64_t free_bytes_219144;
    unsigned char *free_mem_219194;
};
struct futhark_mc_task_235940 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211679;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_bytes_219125;
    unsigned char *free_mem_219145;
};
struct futhark_mc_segmap_parloop_struct_235942 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211679;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_bytes_219125;
    unsigned char *free_mem_219145;
};
static int futhark_mc_segmap_parloop_235943(void *args, int64_t start,
                                            int64_t end, int flat_tid_228533,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235942
    *futhark_mc_segmap_parloop_struct_235942 =
    (struct futhark_mc_segmap_parloop_struct_235942 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235942->ctx;
    uint64_t futhark_mc_segmap_parloop_235943_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235943_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235942->free_n_p_203492;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235942->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235942->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235942->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235942->free_s_n_m_203636;
    int64_t gtid_211679 =
            futhark_mc_segmap_parloop_struct_235942->free_gtid_211679;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_segmap_parloop_struct_235942->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_segmap_parloop_struct_235942->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219125 =
            futhark_mc_segmap_parloop_struct_235942->free_bytes_219125;
    struct memblock mem_219145 = {.desc ="mem_219145", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_219145,
                                  .size =0, .references =NULL};
    size_t mem_228535_cached_sizze_235944 = 0;
    unsigned char *mem_228535 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228623 = start;
    
    if (mem_228535_cached_sizze_235944 < (size_t) bytes_219125) {
        mem_228535 = realloc(mem_228535, bytes_219125);
        mem_228535_cached_sizze_235944 = bytes_219125;
    }
    for (; iter_228623 < end; iter_228623++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228706 = n_p_203492;
        int64_t gtid_228534 = iter_228623;
        int64_t remnant_228707 = iter_228623 - gtid_228534;
        
        for (int64_t i_228624 = 0; i_228624 < pad_css_len_203632; i_228624++) {
            bool cond_228626 = i_228624 == (int64_t) 0;
            double defunc_0_f_res_228627;
            
            if (cond_228626) {
                bool y_228628 = slt64((int64_t) 0, s_n_m_203636);
                bool index_certs_228629;
                
                if (!y_228628) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) (int64_t) 0,
                                  "] out of bounds for array of shape [",
                                  (long long) s_n_m_203636, "].",
                                  "-> #0  /prelude/array.fut:21:29-32\n   #1  loess.fut:559:12-20\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double head_res_228630;
                
                head_res_228630 = ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                                  (s_n_m_203636 *
                                                                   n_p_203492) +
                                                                  gtid_228534 *
                                                                  s_n_m_203636];
                defunc_0_f_res_228627 = head_res_228630;
            } else {
                int64_t y_228631 = sub64(pad_css_len_203632, (int64_t) 1);
                bool cond_228632 = i_228624 == y_228631;
                double defunc_0_f_res_f_res_228633;
                
                if (cond_228632) {
                    int64_t i_228634 = sub64(s_n_m_203636, (int64_t) 1);
                    bool x_228635 = sle64((int64_t) 0, i_228634);
                    bool y_228636 = slt64(i_228634, s_n_m_203636);
                    bool bounds_check_228637 = x_228635 && y_228636;
                    bool index_certs_228638;
                    
                    if (!bounds_check_228637) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) i_228634,
                                      "] out of bounds for array of shape [",
                                      (long long) s_n_m_203636, "].",
                                      "-> #0  /prelude/array.fut:26:29-34\n   #1  loess.fut:561:12-20\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    double last_res_228639;
                    
                    last_res_228639 =
                        ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                        (s_n_m_203636 *
                                                         n_p_203492) +
                                                        gtid_228534 *
                                                        s_n_m_203636 +
                                                        i_228634];
                    defunc_0_f_res_f_res_228633 = last_res_228639;
                } else {
                    int64_t x_228640 = sub64(i_228624, (int64_t) 1);
                    bool zzero_228641 = jump_s_203499 == (int64_t) 0;
                    bool nonzzero_228642 = !zzero_228641;
                    bool nonzzero_cert_228643;
                    
                    if (!nonzzero_228642) {
                        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                               "division by zero",
                                               "-> #0  loess.fut:563:22-35\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:557:3-566:9\n   #5  stl.fut:220:31-96\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:219:23-221:48\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:218:15-222:44\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t x_228644 = sdiv64(x_228640, jump_s_203499);
                    int64_t m_v_228645 = add64((int64_t) 1, x_228644);
                    int64_t j_228646;
                    
                    if (cond_228626) {
                        j_228646 = (int64_t) 0;
                    } else {
                        int64_t y_228647 = sub64(s_n_m_203636, (int64_t) 1);
                        bool cond_228648 = m_v_228645 == y_228647;
                        int64_t j_f_res_228649;
                        
                        if (cond_228648) {
                            j_f_res_228649 = x_228644;
                        } else {
                            j_f_res_228649 = m_v_228645;
                        }
                        j_228646 = j_f_res_228649;
                    }
                    
                    bool cond_228650 = j_228646 == (int64_t) 0;
                    int64_t defunc_0_m_fun_res_228651;
                    
                    if (cond_228650) {
                        defunc_0_m_fun_res_228651 = (int64_t) 0;
                    } else {
                        int64_t y_228652 = sub64(s_n_m_203636, (int64_t) 1);
                        bool cond_228653 = j_228646 == y_228652;
                        int64_t defunc_0_m_fun_res_f_res_228654;
                        
                        if (cond_228653) {
                            defunc_0_m_fun_res_f_res_228654 = y_228631;
                        } else {
                            int64_t x_228655 = sub64(j_228646, (int64_t) 1);
                            int64_t x_228656 = mul64(jump_s_203499, x_228655);
                            int64_t min_arg_228657 = add64((int64_t) 1,
                                                           x_228656);
                            int64_t min_res_228658 =
                                    smin64(defunc_0_f_res_203631,
                                           min_arg_228657);
                            
                            defunc_0_m_fun_res_f_res_228654 = min_res_228658;
                        }
                        defunc_0_m_fun_res_228651 =
                            defunc_0_m_fun_res_f_res_228654;
                    }
                    
                    int64_t defunc_0_m_fun_arg_228659 = add64((int64_t) 1,
                                                              j_228646);
                    bool cond_228660 = defunc_0_m_fun_arg_228659 == (int64_t) 0;
                    int64_t defunc_0_m_fun_res_228661;
                    
                    if (cond_228660) {
                        defunc_0_m_fun_res_228661 = (int64_t) 0;
                    } else {
                        int64_t y_228662 = sub64(s_n_m_203636, (int64_t) 1);
                        bool cond_228663 = defunc_0_m_fun_arg_228659 ==
                             y_228662;
                        int64_t defunc_0_m_fun_res_f_res_228664;
                        
                        if (cond_228663) {
                            defunc_0_m_fun_res_f_res_228664 = y_228631;
                        } else {
                            int64_t x_228665 = mul64(jump_s_203499, j_228646);
                            int64_t min_arg_228666 = add64((int64_t) 1,
                                                           x_228665);
                            int64_t min_res_228667 =
                                    smin64(defunc_0_f_res_203631,
                                           min_arg_228666);
                            
                            defunc_0_m_fun_res_f_res_228664 = min_res_228667;
                        }
                        defunc_0_m_fun_res_228661 =
                            defunc_0_m_fun_res_f_res_228664;
                    }
                    
                    int64_t i64_arg_228668 = sub64(defunc_0_m_fun_res_228661,
                                                   defunc_0_m_fun_res_228651);
                    double i64_res_228669 = sitofp_i64_f64(i64_arg_228668);
                    int64_t i64_arg_228670 = sub64(i_228624,
                                                   defunc_0_m_fun_res_228651);
                    double i64_res_228671 = sitofp_i64_f64(i64_arg_228670);
                    double u_228672 = i64_res_228671 / i64_res_228669;
                    double u2_228673 = u_228672 * u_228672;
                    double u3_228674 = u_228672 * u2_228673;
                    double x_228675 = 2.0 * u3_228674;
                    double y_228676 = 3.0 * u2_228673;
                    double x_228677 = x_228675 - y_228676;
                    double x_228678 = 1.0 + x_228677;
                    bool x_228679 = sle64((int64_t) 0, j_228646);
                    bool y_228680 = slt64(j_228646, s_n_m_203636);
                    bool bounds_check_228681 = x_228679 && y_228680;
                    bool index_certs_228682;
                    
                    if (!bounds_check_228681) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) j_228646,
                                      "] out of bounds for array of shape [",
                                      (long long) s_n_m_203636, "].",
                                      "-> #0  loess.fut:536:27-33\n   #1  loess.fut:565:15-52\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    double y_228683;
                    
                    y_228683 = ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                               (s_n_m_203636 *
                                                                n_p_203492) +
                                                               gtid_228534 *
                                                               s_n_m_203636 +
                                                               j_228646];
                    
                    double x_228684 = x_228678 * y_228683;
                    double x_228685 = y_228676 - x_228675;
                    bool x_228686 = sle64((int64_t) 0,
                                          defunc_0_m_fun_arg_228659);
                    bool y_228687 = slt64(defunc_0_m_fun_arg_228659,
                                          s_n_m_203636);
                    bool bounds_check_228688 = x_228686 && y_228687;
                    bool index_certs_228689;
                    
                    if (!bounds_check_228688) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [",
                                      (long long) defunc_0_m_fun_arg_228659,
                                      "] out of bounds for array of shape [",
                                      (long long) s_n_m_203636, "].",
                                      "-> #0  loess.fut:537:27-37\n   #1  loess.fut:565:15-52\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                        err = 1;
                        goto cleanup;
                    }
                    
                    double y_228690;
                    
                    y_228690 = ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                               (s_n_m_203636 *
                                                                n_p_203492) +
                                                               gtid_228534 *
                                                               s_n_m_203636 +
                                                               defunc_0_m_fun_arg_228659];
                    
                    double y_228691 = x_228685 * y_228690;
                    double x_228692 = x_228684 + y_228691;
                    double y_228693 = 2.0 * u2_228673;
                    double x_228694 = u3_228674 - y_228693;
                    double x_228695 = u_228672 + x_228694;
                    double y_228696;
                    
                    y_228696 = ((double *) ext_mem_219122.mem)[gtid_211679 *
                                                               (s_n_m_203636 *
                                                                n_p_203492) +
                                                               gtid_228534 *
                                                               s_n_m_203636 +
                                                               j_228646];
                    
                    double x_228697 = x_228695 * y_228696;
                    double y_228698 = i64_res_228669 * x_228697;
                    double x_228699 = x_228692 + y_228698;
                    double x_228700 = u3_228674 - u2_228673;
                    double y_228701;
                    
                    y_228701 = ((double *) ext_mem_219122.mem)[gtid_211679 *
                                                               (s_n_m_203636 *
                                                                n_p_203492) +
                                                               gtid_228534 *
                                                               s_n_m_203636 +
                                                               defunc_0_m_fun_arg_228659];
                    
                    double x_228702 = x_228700 * y_228701;
                    double y_228703 = i64_res_228669 * x_228702;
                    double defunc_4_interpolate_proc_res_228704 = x_228699 +
                           y_228703;
                    
                    defunc_0_f_res_f_res_228633 =
                        defunc_4_interpolate_proc_res_228704;
                }
                defunc_0_f_res_228627 = defunc_0_f_res_f_res_228633;
            }
            ((double *) mem_228535)[i_228624] = defunc_0_f_res_228627;
        }
        if (pad_css_len_203632 * (int64_t) 8 > 0)
            memmove(mem_219145.mem + gtid_228534 * pad_css_len_203632 *
                    (int64_t) 8, mem_228535 + (int64_t) 0, pad_css_len_203632 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_228535);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235943_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235943_end -
                 futhark_mc_segmap_parloop_235943_start;
        
        ctx->futhark_mc_segmap_parloop_235943_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235943_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235943_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235941(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228533 = tid;
    int num_tasks_228622 = info.nsubtasks;
    struct futhark_mc_task_235940 *futhark_mc_task_235940 =
                                  (struct futhark_mc_task_235940 *) args;
    struct futhark_context *ctx = futhark_mc_task_235940->ctx;
    uint64_t futhark_mc_segmap_task_235941_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235941_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235940->free_n_p_203492;
    int64_t jump_s_203499 = futhark_mc_task_235940->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235940->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235940->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235940->free_s_n_m_203636;
    int64_t gtid_211679 = futhark_mc_task_235940->free_gtid_211679;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_task_235940->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_task_235940->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219125 = futhark_mc_task_235940->free_bytes_219125;
    struct memblock mem_219145 = {.desc ="mem_219145", .mem =
                                  futhark_mc_task_235940->free_mem_219145,
                                  .size =0, .references =NULL};
    int64_t iter_228623;
    struct futhark_mc_segmap_parloop_struct_235942
    futhark_mc_segmap_parloop_struct_235942;
    
    futhark_mc_segmap_parloop_struct_235942.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235942.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235942.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235942.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235942.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235942.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235942.free_gtid_211679 = gtid_211679;
    futhark_mc_segmap_parloop_struct_235942.free_ext_mem_219122 =
        ext_mem_219122.mem;
    futhark_mc_segmap_parloop_struct_235942.free_ext_mem_219123 =
        ext_mem_219123.mem;
    futhark_mc_segmap_parloop_struct_235942.free_bytes_219125 = bytes_219125;
    futhark_mc_segmap_parloop_struct_235942.free_mem_219145 = mem_219145.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235943_task;
    
    futhark_mc_segmap_parloop_235943_task.name =
        "futhark_mc_segmap_parloop_235943";
    futhark_mc_segmap_parloop_235943_task.fn = futhark_mc_segmap_parloop_235943;
    futhark_mc_segmap_parloop_235943_task.args =
        &futhark_mc_segmap_parloop_struct_235942;
    futhark_mc_segmap_parloop_235943_task.iterations = iterations;
    futhark_mc_segmap_parloop_235943_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235943_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235943_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235943_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235943_task);
    
    if (futhark_mc_segmap_parloop_235943_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235943_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235943_total_end -
                 futhark_mc_segmap_parloop_235943_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235943_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235943_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235943_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235941_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235941_end -
                 futhark_mc_segmap_task_235941_start;
        
        ctx->futhark_mc_segmap_task_235941_runs[tid]++;
        ctx->futhark_mc_segmap_task_235941_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235941_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235946 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211679;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_bytes_219125;
    unsigned char *free_mem_219145;
};
struct futhark_mc_task_235949 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211679;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_gtid_228449;
    unsigned char *free_mem_228450;
};
struct futhark_mc_segmap_parloop_struct_235951 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_jump_s_203499;
    int64_t free_defunc_0_f_res_203631;
    int64_t free_pad_css_len_203632;
    int64_t free_s_n_m_203636;
    int64_t free_gtid_211679;
    unsigned char *free_ext_mem_219122;
    unsigned char *free_ext_mem_219123;
    int64_t free_gtid_228449;
    unsigned char *free_mem_228450;
};
static int futhark_mc_segmap_parloop_235952(void *args, int64_t start,
                                            int64_t end, int flat_tid_228710,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235951
    *futhark_mc_segmap_parloop_struct_235951 =
    (struct futhark_mc_segmap_parloop_struct_235951 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235951->ctx;
    uint64_t futhark_mc_segmap_parloop_235952_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235952_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235951->free_n_p_203492;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235951->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235951->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235951->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235951->free_s_n_m_203636;
    int64_t gtid_211679 =
            futhark_mc_segmap_parloop_struct_235951->free_gtid_211679;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_segmap_parloop_struct_235951->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_segmap_parloop_struct_235951->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t gtid_228449 =
            futhark_mc_segmap_parloop_struct_235951->free_gtid_228449;
    struct memblock mem_228450 = {.desc ="mem_228450", .mem =
                                  futhark_mc_segmap_parloop_struct_235951->free_mem_228450,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228794 = start;
    
    for (; iter_228794 < end; iter_228794++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228872 = pad_css_len_203632;
        int64_t gtid_228711 = iter_228794;
        int64_t remnant_228873 = iter_228794 - gtid_228711;
        bool cond_228712 = gtid_228711 == (int64_t) 0;
        double defunc_0_f_res_228713;
        
        if (cond_228712) {
            bool y_228795 = slt64((int64_t) 0, s_n_m_203636);
            bool index_certs_228796;
            
            if (!y_228795) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) (int64_t) 0,
                              "] out of bounds for array of shape [",
                              (long long) s_n_m_203636, "].",
                              "-> #0  /prelude/array.fut:21:29-32\n   #1  loess.fut:559:12-20\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double head_res_228797;
            
            head_res_228797 = ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                              (s_n_m_203636 *
                                                               n_p_203492) +
                                                              gtid_228449 *
                                                              s_n_m_203636];
            defunc_0_f_res_228713 = head_res_228797;
        } else {
            int64_t y_228798 = sub64(pad_css_len_203632, (int64_t) 1);
            bool cond_228799 = gtid_228711 == y_228798;
            double defunc_0_f_res_f_res_228800;
            
            if (cond_228799) {
                int64_t i_228801 = sub64(s_n_m_203636, (int64_t) 1);
                bool x_228802 = sle64((int64_t) 0, i_228801);
                bool y_228803 = slt64(i_228801, s_n_m_203636);
                bool bounds_check_228804 = x_228802 && y_228803;
                bool index_certs_228805;
                
                if (!bounds_check_228804) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228801,
                                  "] out of bounds for array of shape [",
                                  (long long) s_n_m_203636, "].",
                                  "-> #0  /prelude/array.fut:26:29-34\n   #1  loess.fut:561:12-20\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double last_res_228806;
                
                last_res_228806 = ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                                  (s_n_m_203636 *
                                                                   n_p_203492) +
                                                                  gtid_228449 *
                                                                  s_n_m_203636 +
                                                                  i_228801];
                defunc_0_f_res_f_res_228800 = last_res_228806;
            } else {
                int64_t x_228807 = sub64(gtid_228711, (int64_t) 1);
                bool zzero_228808 = jump_s_203499 == (int64_t) 0;
                bool nonzzero_228809 = !zzero_228808;
                bool nonzzero_cert_228810;
                
                if (!nonzzero_228809) {
                    ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                           "division by zero",
                                           "-> #0  loess.fut:563:22-35\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:557:3-566:9\n   #5  stl.fut:220:31-96\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:219:23-221:48\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:218:15-222:44\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_228811 = sdiv64(x_228807, jump_s_203499);
                int64_t m_v_228812 = add64((int64_t) 1, x_228811);
                int64_t j_228813;
                
                if (cond_228712) {
                    j_228813 = (int64_t) 0;
                } else {
                    int64_t y_228814 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_228815 = m_v_228812 == y_228814;
                    int64_t j_f_res_228816;
                    
                    if (cond_228815) {
                        j_f_res_228816 = x_228811;
                    } else {
                        j_f_res_228816 = m_v_228812;
                    }
                    j_228813 = j_f_res_228816;
                }
                
                bool cond_228817 = j_228813 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_228818;
                
                if (cond_228817) {
                    defunc_0_m_fun_res_228818 = (int64_t) 0;
                } else {
                    int64_t y_228819 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_228820 = j_228813 == y_228819;
                    int64_t defunc_0_m_fun_res_f_res_228821;
                    
                    if (cond_228820) {
                        defunc_0_m_fun_res_f_res_228821 = y_228798;
                    } else {
                        int64_t x_228822 = sub64(j_228813, (int64_t) 1);
                        int64_t x_228823 = mul64(jump_s_203499, x_228822);
                        int64_t min_arg_228824 = add64((int64_t) 1, x_228823);
                        int64_t min_res_228825 = smin64(defunc_0_f_res_203631,
                                                        min_arg_228824);
                        
                        defunc_0_m_fun_res_f_res_228821 = min_res_228825;
                    }
                    defunc_0_m_fun_res_228818 = defunc_0_m_fun_res_f_res_228821;
                }
                
                int64_t defunc_0_m_fun_arg_228826 = add64((int64_t) 1,
                                                          j_228813);
                bool cond_228827 = defunc_0_m_fun_arg_228826 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_228828;
                
                if (cond_228827) {
                    defunc_0_m_fun_res_228828 = (int64_t) 0;
                } else {
                    int64_t y_228829 = sub64(s_n_m_203636, (int64_t) 1);
                    bool cond_228830 = defunc_0_m_fun_arg_228826 == y_228829;
                    int64_t defunc_0_m_fun_res_f_res_228831;
                    
                    if (cond_228830) {
                        defunc_0_m_fun_res_f_res_228831 = y_228798;
                    } else {
                        int64_t x_228832 = mul64(jump_s_203499, j_228813);
                        int64_t min_arg_228833 = add64((int64_t) 1, x_228832);
                        int64_t min_res_228834 = smin64(defunc_0_f_res_203631,
                                                        min_arg_228833);
                        
                        defunc_0_m_fun_res_f_res_228831 = min_res_228834;
                    }
                    defunc_0_m_fun_res_228828 = defunc_0_m_fun_res_f_res_228831;
                }
                
                int64_t i64_arg_228835 = sub64(defunc_0_m_fun_res_228828,
                                               defunc_0_m_fun_res_228818);
                double i64_res_228836 = sitofp_i64_f64(i64_arg_228835);
                int64_t i64_arg_228837 = sub64(gtid_228711,
                                               defunc_0_m_fun_res_228818);
                double i64_res_228838 = sitofp_i64_f64(i64_arg_228837);
                double u_228839 = i64_res_228838 / i64_res_228836;
                double u2_228840 = u_228839 * u_228839;
                double u3_228841 = u_228839 * u2_228840;
                double x_228842 = 2.0 * u3_228841;
                double y_228843 = 3.0 * u2_228840;
                double x_228844 = x_228842 - y_228843;
                double x_228845 = 1.0 + x_228844;
                bool x_228846 = sle64((int64_t) 0, j_228813);
                bool y_228847 = slt64(j_228813, s_n_m_203636);
                bool bounds_check_228848 = x_228846 && y_228847;
                bool index_certs_228849;
                
                if (!bounds_check_228848) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) j_228813,
                                  "] out of bounds for array of shape [",
                                  (long long) s_n_m_203636, "].",
                                  "-> #0  loess.fut:536:27-33\n   #1  loess.fut:565:15-52\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_228850;
                
                y_228850 = ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                           (s_n_m_203636 *
                                                            n_p_203492) +
                                                           gtid_228449 *
                                                           s_n_m_203636 +
                                                           j_228813];
                
                double x_228851 = x_228845 * y_228850;
                double x_228852 = y_228843 - x_228842;
                bool x_228853 = sle64((int64_t) 0, defunc_0_m_fun_arg_228826);
                bool y_228854 = slt64(defunc_0_m_fun_arg_228826, s_n_m_203636);
                bool bounds_check_228855 = x_228853 && y_228854;
                bool index_certs_228856;
                
                if (!bounds_check_228855) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [",
                                  (long long) defunc_0_m_fun_arg_228826,
                                  "] out of bounds for array of shape [",
                                  (long long) s_n_m_203636, "].",
                                  "-> #0  loess.fut:537:27-37\n   #1  loess.fut:565:15-52\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:557:3-566:9\n   #6  stl.fut:220:31-96\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:219:23-221:48\n   #10 /prelude/soacs.fut:67:19-23\n   #11 /prelude/soacs.fut:67:3-37\n   #12 stl.fut:218:15-222:44\n   #13 stl.fut:415:61-429:75\n   #14 stl.fut:455:3-469:34\n   #15 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_228857;
                
                y_228857 = ((double *) ext_mem_219123.mem)[gtid_211679 *
                                                           (s_n_m_203636 *
                                                            n_p_203492) +
                                                           gtid_228449 *
                                                           s_n_m_203636 +
                                                           defunc_0_m_fun_arg_228826];
                
                double y_228858 = x_228852 * y_228857;
                double x_228859 = x_228851 + y_228858;
                double y_228860 = 2.0 * u2_228840;
                double x_228861 = u3_228841 - y_228860;
                double x_228862 = u_228839 + x_228861;
                double y_228863;
                
                y_228863 = ((double *) ext_mem_219122.mem)[gtid_211679 *
                                                           (s_n_m_203636 *
                                                            n_p_203492) +
                                                           gtid_228449 *
                                                           s_n_m_203636 +
                                                           j_228813];
                
                double x_228864 = x_228862 * y_228863;
                double y_228865 = i64_res_228836 * x_228864;
                double x_228866 = x_228859 + y_228865;
                double x_228867 = u3_228841 - u2_228840;
                double y_228868;
                
                y_228868 = ((double *) ext_mem_219122.mem)[gtid_211679 *
                                                           (s_n_m_203636 *
                                                            n_p_203492) +
                                                           gtid_228449 *
                                                           s_n_m_203636 +
                                                           defunc_0_m_fun_arg_228826];
                
                double x_228869 = x_228867 * y_228868;
                double y_228870 = i64_res_228836 * x_228869;
                double defunc_4_interpolate_proc_res_228871 = x_228866 +
                       y_228870;
                
                defunc_0_f_res_f_res_228800 =
                    defunc_4_interpolate_proc_res_228871;
            }
            defunc_0_f_res_228713 = defunc_0_f_res_f_res_228800;
        }
        ((double *) mem_228450.mem)[gtid_228711] = defunc_0_f_res_228713;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235952_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235952_end -
                 futhark_mc_segmap_parloop_235952_start;
        
        ctx->futhark_mc_segmap_parloop_235952_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235952_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235952_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235950(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228710 = tid;
    int num_tasks_228793 = info.nsubtasks;
    struct futhark_mc_task_235949 *futhark_mc_task_235949 =
                                  (struct futhark_mc_task_235949 *) args;
    struct futhark_context *ctx = futhark_mc_task_235949->ctx;
    uint64_t futhark_mc_segmap_task_235950_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235950_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235949->free_n_p_203492;
    int64_t jump_s_203499 = futhark_mc_task_235949->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235949->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235949->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235949->free_s_n_m_203636;
    int64_t gtid_211679 = futhark_mc_task_235949->free_gtid_211679;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_task_235949->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_task_235949->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t gtid_228449 = futhark_mc_task_235949->free_gtid_228449;
    struct memblock mem_228450 = {.desc ="mem_228450", .mem =
                                  futhark_mc_task_235949->free_mem_228450,
                                  .size =0, .references =NULL};
    int64_t iter_228794;
    struct futhark_mc_segmap_parloop_struct_235951
    futhark_mc_segmap_parloop_struct_235951;
    
    futhark_mc_segmap_parloop_struct_235951.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235951.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235951.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235951.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235951.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235951.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235951.free_gtid_211679 = gtid_211679;
    futhark_mc_segmap_parloop_struct_235951.free_ext_mem_219122 =
        ext_mem_219122.mem;
    futhark_mc_segmap_parloop_struct_235951.free_ext_mem_219123 =
        ext_mem_219123.mem;
    futhark_mc_segmap_parloop_struct_235951.free_gtid_228449 = gtid_228449;
    futhark_mc_segmap_parloop_struct_235951.free_mem_228450 = mem_228450.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235952_task;
    
    futhark_mc_segmap_parloop_235952_task.name =
        "futhark_mc_segmap_parloop_235952";
    futhark_mc_segmap_parloop_235952_task.fn = futhark_mc_segmap_parloop_235952;
    futhark_mc_segmap_parloop_235952_task.args =
        &futhark_mc_segmap_parloop_struct_235951;
    futhark_mc_segmap_parloop_235952_task.iterations = iterations;
    futhark_mc_segmap_parloop_235952_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235952_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235952_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235952_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235952_task);
    
    if (futhark_mc_segmap_parloop_235952_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235952_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235952_total_end -
                 futhark_mc_segmap_parloop_235952_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235952_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235952_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235952_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235950_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235950_end -
                 futhark_mc_segmap_task_235950_start;
        
        ctx->futhark_mc_segmap_task_235950_runs[tid]++;
        ctx->futhark_mc_segmap_task_235950_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235950_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235947(void *args, int64_t start,
                                            int64_t end, int flat_tid_228448,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235946
    *futhark_mc_segmap_parloop_struct_235946 =
    (struct futhark_mc_segmap_parloop_struct_235946 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235946->ctx;
    uint64_t futhark_mc_segmap_parloop_235947_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235947_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235946->free_n_p_203492;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235946->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235946->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235946->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235946->free_s_n_m_203636;
    int64_t gtid_211679 =
            futhark_mc_segmap_parloop_struct_235946->free_gtid_211679;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_segmap_parloop_struct_235946->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_segmap_parloop_struct_235946->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219125 =
            futhark_mc_segmap_parloop_struct_235946->free_bytes_219125;
    struct memblock mem_219145 = {.desc ="mem_219145", .mem =
                                  futhark_mc_segmap_parloop_struct_235946->free_mem_219145,
                                  .size =0, .references =NULL};
    size_t mem_228450_cached_sizze_235948 = 0;
    unsigned char *mem_228450 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228709 = start;
    
    if (mem_228450_cached_sizze_235948 < (size_t) bytes_219125) {
        mem_228450 = realloc(mem_228450, bytes_219125);
        mem_228450_cached_sizze_235948 = bytes_219125;
    }
    for (; iter_228709 < end; iter_228709++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228791 = n_p_203492;
        int64_t gtid_228449 = iter_228709;
        int64_t remnant_228792 = iter_228709 - gtid_228449;
        int64_t flat_tid_228710 = (int64_t) 0;
        int32_t num_tasks_228793;
        struct futhark_mc_task_235949 futhark_mc_task_235949;
        
        futhark_mc_task_235949.ctx = ctx;
        futhark_mc_task_235949.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235949.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235949.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235949.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235949.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235949.free_gtid_211679 = gtid_211679;
        futhark_mc_task_235949.free_ext_mem_219122 = ext_mem_219122.mem;
        futhark_mc_task_235949.free_ext_mem_219123 = ext_mem_219123.mem;
        futhark_mc_task_235949.free_gtid_228449 = gtid_228449;
        futhark_mc_task_235949.free_mem_228450 = mem_228450;
        
        struct scheduler_segop futhark_mc_task_235949_task;
        
        futhark_mc_task_235949_task.args = &futhark_mc_task_235949;
        futhark_mc_task_235949_task.top_level_fn =
            futhark_mc_segmap_task_235950;
        futhark_mc_task_235949_task.name = "futhark_mc_segmap_task_235950";
        futhark_mc_task_235949_task.iterations = pad_css_len_203632;
        futhark_mc_task_235949_task.task_time =
            &ctx->futhark_mc_segmap_task_235950_total_time;
        futhark_mc_task_235949_task.task_iter =
            &ctx->futhark_mc_segmap_task_235950_total_iter;
        futhark_mc_task_235949_task.sched = STATIC;
        futhark_mc_task_235949_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235950_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235949_task);
        
        if (futhark_mc_segmap_task_235950_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (pad_css_len_203632 * (int64_t) 8 > 0)
            memmove(mem_219145.mem + gtid_228449 * pad_css_len_203632 *
                    (int64_t) 8, mem_228450 + (int64_t) 0, pad_css_len_203632 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_228450);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235947_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235947_end -
                 futhark_mc_segmap_parloop_235947_start;
        
        ctx->futhark_mc_segmap_parloop_235947_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235947_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235947_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235945(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228448 = tid;
    int num_tasks_228622 = info.nsubtasks;
    struct futhark_mc_task_235940 *futhark_mc_task_235940 =
                                  (struct futhark_mc_task_235940 *) args;
    struct futhark_context *ctx = futhark_mc_task_235940->ctx;
    uint64_t futhark_mc_segmap_nested_task_235945_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235945_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235940->free_n_p_203492;
    int64_t jump_s_203499 = futhark_mc_task_235940->free_jump_s_203499;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235940->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235940->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235940->free_s_n_m_203636;
    int64_t gtid_211679 = futhark_mc_task_235940->free_gtid_211679;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_task_235940->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_task_235940->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219125 = futhark_mc_task_235940->free_bytes_219125;
    struct memblock mem_219145 = {.desc ="mem_219145", .mem =
                                  futhark_mc_task_235940->free_mem_219145,
                                  .size =0, .references =NULL};
    int64_t iter_228709;
    struct futhark_mc_segmap_parloop_struct_235946
    futhark_mc_segmap_parloop_struct_235946;
    
    futhark_mc_segmap_parloop_struct_235946.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235946.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235946.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235946.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235946.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235946.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235946.free_gtid_211679 = gtid_211679;
    futhark_mc_segmap_parloop_struct_235946.free_ext_mem_219122 =
        ext_mem_219122.mem;
    futhark_mc_segmap_parloop_struct_235946.free_ext_mem_219123 =
        ext_mem_219123.mem;
    futhark_mc_segmap_parloop_struct_235946.free_bytes_219125 = bytes_219125;
    futhark_mc_segmap_parloop_struct_235946.free_mem_219145 = mem_219145.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235947_task;
    
    futhark_mc_segmap_parloop_235947_task.name =
        "futhark_mc_segmap_parloop_235947";
    futhark_mc_segmap_parloop_235947_task.fn = futhark_mc_segmap_parloop_235947;
    futhark_mc_segmap_parloop_235947_task.args =
        &futhark_mc_segmap_parloop_struct_235946;
    futhark_mc_segmap_parloop_235947_task.iterations = iterations;
    futhark_mc_segmap_parloop_235947_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235947_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235947_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235947_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235947_task);
    
    if (futhark_mc_segmap_parloop_235947_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235947_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235947_total_end -
                 futhark_mc_segmap_parloop_235947_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235947_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235947_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235947_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235945_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235945_end -
                 futhark_mc_segmap_nested_task_235945_start;
        
        ctx->futhark_mc_segmap_nested_task_235945_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235945_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235945_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235938(void *args, int64_t start,
                                            int64_t end, int flat_tid_211678,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235937
    *futhark_mc_segmap_parloop_struct_235937 =
    (struct futhark_mc_segmap_parloop_struct_235937 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235937->ctx;
    uint64_t futhark_mc_segmap_parloop_235938_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235938_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235937->free_n_p_203492;
    int64_t jump_s_203499 =
            futhark_mc_segmap_parloop_struct_235937->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235937->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_segmap_parloop_struct_235937->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_segmap_parloop_struct_235937->free_pad_css_len_203632;
    int64_t s_n_m_203636 =
            futhark_mc_segmap_parloop_struct_235937->free_s_n_m_203636;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_segmap_parloop_struct_235937->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_segmap_parloop_struct_235937->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219125 =
            futhark_mc_segmap_parloop_struct_235937->free_bytes_219125;
    int64_t bytes_219144 =
            futhark_mc_segmap_parloop_struct_235937->free_bytes_219144;
    struct memblock mem_219194 = {.desc ="mem_219194", .mem =
                                  futhark_mc_segmap_parloop_struct_235937->free_mem_219194,
                                  .size =0, .references =NULL};
    size_t mem_219145_cached_sizze_235939 = 0;
    unsigned char *mem_219145 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228447 = start;
    
    if (mem_219145_cached_sizze_235939 < (size_t) bytes_219144) {
        mem_219145 = realloc(mem_219145, bytes_219144);
        mem_219145_cached_sizze_235939 = bytes_219144;
    }
    for (; iter_228447 < end; iter_228447++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228620 = partition_sizze_203577;
        int64_t gtid_211679 = iter_228447;
        int64_t remnant_228621 = iter_228447 - gtid_211679;
        int64_t flat_tid_228533 = (int64_t) 0;
        int32_t num_tasks_228622;
        int64_t flat_tid_228448 = (int64_t) 0;
        struct futhark_mc_task_235940 futhark_mc_task_235940;
        
        futhark_mc_task_235940.ctx = ctx;
        futhark_mc_task_235940.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235940.free_jump_s_203499 = jump_s_203499;
        futhark_mc_task_235940.free_defunc_0_f_res_203631 =
            defunc_0_f_res_203631;
        futhark_mc_task_235940.free_pad_css_len_203632 = pad_css_len_203632;
        futhark_mc_task_235940.free_s_n_m_203636 = s_n_m_203636;
        futhark_mc_task_235940.free_gtid_211679 = gtid_211679;
        futhark_mc_task_235940.free_ext_mem_219122 = ext_mem_219122.mem;
        futhark_mc_task_235940.free_ext_mem_219123 = ext_mem_219123.mem;
        futhark_mc_task_235940.free_bytes_219125 = bytes_219125;
        futhark_mc_task_235940.free_mem_219145 = mem_219145;
        
        struct scheduler_segop futhark_mc_task_235940_task;
        
        futhark_mc_task_235940_task.args = &futhark_mc_task_235940;
        futhark_mc_task_235940_task.top_level_fn =
            futhark_mc_segmap_task_235941;
        futhark_mc_task_235940_task.name = "futhark_mc_segmap_task_235941";
        futhark_mc_task_235940_task.iterations = n_p_203492;
        futhark_mc_task_235940_task.task_time =
            &ctx->futhark_mc_segmap_task_235941_total_time;
        futhark_mc_task_235940_task.task_iter =
            &ctx->futhark_mc_segmap_task_235941_total_iter;
        futhark_mc_task_235940_task.sched = STATIC;
        futhark_mc_task_235940_task.nested_fn =
            futhark_mc_segmap_nested_task_235945;
        
        int futhark_mc_segmap_task_235941_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235940_task);
        
        if (futhark_mc_segmap_task_235941_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203492 * pad_css_len_203632 * (int64_t) 8 > 0)
            memmove(mem_219194.mem + gtid_211679 * (pad_css_len_203632 *
                                                    n_p_203492) * (int64_t) 8,
                    mem_219145 + (int64_t) 0, n_p_203492 * pad_css_len_203632 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219145);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235938_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235938_end -
                 futhark_mc_segmap_parloop_235938_start;
        
        ctx->futhark_mc_segmap_parloop_235938_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235938_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235938_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235936(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211678 = tid;
    int num_tasks_228356 = info.nsubtasks;
    struct futhark_mc_task_235931 *futhark_mc_task_235931 =
                                  (struct futhark_mc_task_235931 *) args;
    struct futhark_context *ctx = futhark_mc_task_235931->ctx;
    uint64_t futhark_mc_segmap_nested_task_235936_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235936_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235931->free_n_p_203492;
    int64_t jump_s_203499 = futhark_mc_task_235931->free_jump_s_203499;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235931->free_partition_sizze_203577;
    int64_t defunc_0_f_res_203631 =
            futhark_mc_task_235931->free_defunc_0_f_res_203631;
    int64_t pad_css_len_203632 =
            futhark_mc_task_235931->free_pad_css_len_203632;
    int64_t s_n_m_203636 = futhark_mc_task_235931->free_s_n_m_203636;
    struct memblock ext_mem_219122 = {.desc ="ext_mem_219122", .mem =
                                      futhark_mc_task_235931->free_ext_mem_219122,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219123 = {.desc ="ext_mem_219123", .mem =
                                      futhark_mc_task_235931->free_ext_mem_219123,
                                      .size =0, .references =NULL};
    int64_t bytes_219125 = futhark_mc_task_235931->free_bytes_219125;
    int64_t bytes_219144 = futhark_mc_task_235931->free_bytes_219144;
    struct memblock mem_219194 = {.desc ="mem_219194", .mem =
                                  futhark_mc_task_235931->free_mem_219194,
                                  .size =0, .references =NULL};
    int64_t iter_228447;
    struct futhark_mc_segmap_parloop_struct_235937
    futhark_mc_segmap_parloop_struct_235937;
    
    futhark_mc_segmap_parloop_struct_235937.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235937.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235937.free_jump_s_203499 = jump_s_203499;
    futhark_mc_segmap_parloop_struct_235937.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235937.free_defunc_0_f_res_203631 =
        defunc_0_f_res_203631;
    futhark_mc_segmap_parloop_struct_235937.free_pad_css_len_203632 =
        pad_css_len_203632;
    futhark_mc_segmap_parloop_struct_235937.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_segmap_parloop_struct_235937.free_ext_mem_219122 =
        ext_mem_219122.mem;
    futhark_mc_segmap_parloop_struct_235937.free_ext_mem_219123 =
        ext_mem_219123.mem;
    futhark_mc_segmap_parloop_struct_235937.free_bytes_219125 = bytes_219125;
    futhark_mc_segmap_parloop_struct_235937.free_bytes_219144 = bytes_219144;
    futhark_mc_segmap_parloop_struct_235937.free_mem_219194 = mem_219194.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235938_task;
    
    futhark_mc_segmap_parloop_235938_task.name =
        "futhark_mc_segmap_parloop_235938";
    futhark_mc_segmap_parloop_235938_task.fn = futhark_mc_segmap_parloop_235938;
    futhark_mc_segmap_parloop_235938_task.args =
        &futhark_mc_segmap_parloop_struct_235937;
    futhark_mc_segmap_parloop_235938_task.iterations = iterations;
    futhark_mc_segmap_parloop_235938_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235938_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235938_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235938_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235938_task);
    
    if (futhark_mc_segmap_parloop_235938_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235938_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235938_total_end -
                 futhark_mc_segmap_parloop_235938_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235938_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235938_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235938_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235936_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235936_end -
                 futhark_mc_segmap_nested_task_235936_start;
        
        ctx->futhark_mc_segmap_nested_task_235936_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235936_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235936_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235953 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_css_results_l_204110;
    unsigned char *free_ext_mem_219195;
    int64_t free_bytes_219198;
    unsigned char *free_mem_219218;
};
struct futhark_mc_segmap_parloop_struct_235955 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_css_results_l_204110;
    unsigned char *free_ext_mem_219195;
    int64_t free_bytes_219198;
    unsigned char *free_mem_219218;
};
static int futhark_mc_segmap_parloop_235956(void *args, int64_t start,
                                            int64_t end, int flat_tid_211855,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235955
    *futhark_mc_segmap_parloop_struct_235955 =
    (struct futhark_mc_segmap_parloop_struct_235955 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235955->ctx;
    uint64_t futhark_mc_segmap_parloop_235956_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235956_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235955->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235955->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_235955->free_C_len_203634;
    int64_t css_results_l_204110 =
            futhark_mc_segmap_parloop_struct_235955->free_css_results_l_204110;
    struct memblock ext_mem_219195 = {.desc ="ext_mem_219195", .mem =
                                      futhark_mc_segmap_parloop_struct_235955->free_ext_mem_219195,
                                      .size =0, .references =NULL};
    int64_t bytes_219198 =
            futhark_mc_segmap_parloop_struct_235955->free_bytes_219198;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_235955->free_mem_219218,
                                  .size =0, .references =NULL};
    size_t mem_219202_cached_sizze_235957 = 0;
    unsigned char *mem_219202 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228875 = start;
    
    if (mem_219202_cached_sizze_235957 < (size_t) bytes_219198) {
        mem_219202 = realloc(mem_219202, bytes_219198);
        mem_219202_cached_sizze_235957 = bytes_219198;
    }
    for (; iter_228875 < end; iter_228875++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228890 = partition_sizze_203577;
        int64_t gtid_211856 = iter_228875;
        int64_t remnant_228891 = iter_228875 - gtid_211856;
        
        for (int64_t i_228876 = 0; i_228876 < C_len_203634; i_228876++) {
            int64_t i_228878 = smod64(i_228876, n_p_203492);
            bool x_228879 = sle64((int64_t) 0, i_228878);
            bool y_228880 = slt64(i_228878, n_p_203492);
            bool bounds_check_228881 = x_228879 && y_228880;
            int64_t i_228882 = sdiv64(i_228876, n_p_203492);
            bool x_228883 = sle64((int64_t) 0, i_228882);
            bool y_228884 = slt64(i_228882, css_results_l_204110);
            bool bounds_check_228885 = x_228883 && y_228884;
            bool index_ok_228886 = bounds_check_228881 && bounds_check_228885;
            bool index_certs_228887;
            
            if (!index_ok_228886) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) i_228878, ", ",
                              (long long) i_228882,
                              "] out of bounds for array of shape [",
                              (long long) n_p_203492, "][",
                              (long long) css_results_l_204110, "].",
                              "-> #0  stl.fut:226:39-67\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  stl.fut:226:28-74\n   #5  stl.fut:225:21-227:39\n   #6  stl.fut:415:61-429:75\n   #7  stl.fut:455:3-469:34\n   #8  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            if ((int64_t) 8 > 0)
                memmove(mem_219202 + i_228876 * (int64_t) 8,
                        ext_mem_219195.mem + (gtid_211856 *
                                              (css_results_l_204110 *
                                               n_p_203492) + i_228878 *
                                              css_results_l_204110 + i_228882) *
                        (int64_t) 8, (int64_t) 8);
        }
        if (C_len_203634 * (int64_t) 8 > 0)
            memmove(mem_219218.mem + gtid_211856 * C_len_203634 * (int64_t) 8,
                    mem_219202 + (int64_t) 0, C_len_203634 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219202);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235956_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235956_end -
                 futhark_mc_segmap_parloop_235956_start;
        
        ctx->futhark_mc_segmap_parloop_235956_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235956_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235956_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235954(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211855 = tid;
    int num_tasks_228874 = info.nsubtasks;
    struct futhark_mc_task_235953 *futhark_mc_task_235953 =
                                  (struct futhark_mc_task_235953 *) args;
    struct futhark_context *ctx = futhark_mc_task_235953->ctx;
    uint64_t futhark_mc_segmap_task_235954_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235954_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235953->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235953->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_235953->free_C_len_203634;
    int64_t css_results_l_204110 =
            futhark_mc_task_235953->free_css_results_l_204110;
    struct memblock ext_mem_219195 = {.desc ="ext_mem_219195", .mem =
                                      futhark_mc_task_235953->free_ext_mem_219195,
                                      .size =0, .references =NULL};
    int64_t bytes_219198 = futhark_mc_task_235953->free_bytes_219198;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235953->free_mem_219218,
                                  .size =0, .references =NULL};
    int64_t iter_228875;
    struct futhark_mc_segmap_parloop_struct_235955
    futhark_mc_segmap_parloop_struct_235955;
    
    futhark_mc_segmap_parloop_struct_235955.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235955.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235955.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235955.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_235955.free_css_results_l_204110 =
        css_results_l_204110;
    futhark_mc_segmap_parloop_struct_235955.free_ext_mem_219195 =
        ext_mem_219195.mem;
    futhark_mc_segmap_parloop_struct_235955.free_bytes_219198 = bytes_219198;
    futhark_mc_segmap_parloop_struct_235955.free_mem_219218 = mem_219218.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235956_task;
    
    futhark_mc_segmap_parloop_235956_task.name =
        "futhark_mc_segmap_parloop_235956";
    futhark_mc_segmap_parloop_235956_task.fn = futhark_mc_segmap_parloop_235956;
    futhark_mc_segmap_parloop_235956_task.args =
        &futhark_mc_segmap_parloop_struct_235955;
    futhark_mc_segmap_parloop_235956_task.iterations = iterations;
    futhark_mc_segmap_parloop_235956_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235956_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235956_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235956_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235956_task);
    
    if (futhark_mc_segmap_parloop_235956_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235956_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235956_total_end -
                 futhark_mc_segmap_parloop_235956_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235956_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235956_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235956_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235954_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235954_end -
                 futhark_mc_segmap_task_235954_start;
        
        ctx->futhark_mc_segmap_task_235954_runs[tid]++;
        ctx->futhark_mc_segmap_task_235954_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235954_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235959 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_css_results_l_204110;
    unsigned char *free_ext_mem_219195;
    int64_t free_bytes_219198;
    unsigned char *free_mem_219218;
};
struct futhark_mc_task_235962 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_C_len_203634;
    int64_t free_css_results_l_204110;
    int64_t free_gtid_211862;
    unsigned char *free_ext_mem_219195;
    unsigned char *free_mem_219199;
};
struct futhark_mc_segmap_parloop_struct_235964 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_C_len_203634;
    int64_t free_css_results_l_204110;
    int64_t free_gtid_211862;
    unsigned char *free_ext_mem_219195;
    unsigned char *free_mem_219199;
};
static int futhark_mc_segmap_parloop_235965(void *args, int64_t start,
                                            int64_t end, int flat_tid_228894,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235964
    *futhark_mc_segmap_parloop_struct_235964 =
    (struct futhark_mc_segmap_parloop_struct_235964 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235964->ctx;
    uint64_t futhark_mc_segmap_parloop_235965_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235965_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235964->free_n_p_203492;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_235964->free_C_len_203634;
    int64_t css_results_l_204110 =
            futhark_mc_segmap_parloop_struct_235964->free_css_results_l_204110;
    int64_t gtid_211862 =
            futhark_mc_segmap_parloop_struct_235964->free_gtid_211862;
    struct memblock ext_mem_219195 = {.desc ="ext_mem_219195", .mem =
                                      futhark_mc_segmap_parloop_struct_235964->free_ext_mem_219195,
                                      .size =0, .references =NULL};
    struct memblock mem_219199 = {.desc ="mem_219199", .mem =
                                  futhark_mc_segmap_parloop_struct_235964->free_mem_219199,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228910 = start;
    
    for (; iter_228910 < end; iter_228910++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228911 = C_len_203634;
        int64_t gtid_228895 = iter_228910;
        int64_t remnant_228912 = iter_228910 - gtid_228895;
        int64_t i_228896 = smod64(gtid_228895, n_p_203492);
        bool x_228897 = sle64((int64_t) 0, i_228896);
        bool y_228898 = slt64(i_228896, n_p_203492);
        bool bounds_check_228899 = x_228897 && y_228898;
        int64_t i_228900 = sdiv64(gtid_228895, n_p_203492);
        bool x_228901 = sle64((int64_t) 0, i_228900);
        bool y_228902 = slt64(i_228900, css_results_l_204110);
        bool bounds_check_228903 = x_228901 && y_228902;
        bool index_ok_228904 = bounds_check_228899 && bounds_check_228903;
        bool index_certs_228905;
        
        if (!index_ok_228904) {
            ctx->error =
                msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                          "Index [", (long long) i_228896, ", ",
                          (long long) i_228900,
                          "] out of bounds for array of shape [",
                          (long long) n_p_203492, "][",
                          (long long) css_results_l_204110, "].",
                          "-> #0  stl.fut:226:39-67\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  stl.fut:226:28-74\n   #5  stl.fut:225:21-227:39\n   #6  stl.fut:415:61-429:75\n   #7  stl.fut:455:3-469:34\n   #8  stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        double defunc_0_f_res_228906;
        
        defunc_0_f_res_228906 = ((double *) ext_mem_219195.mem)[gtid_211862 *
                                                                (css_results_l_204110 *
                                                                 n_p_203492) +
                                                                i_228896 *
                                                                css_results_l_204110 +
                                                                i_228900];
        ((double *) mem_219199.mem)[gtid_228895] = defunc_0_f_res_228906;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235965_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235965_end -
                 futhark_mc_segmap_parloop_235965_start;
        
        ctx->futhark_mc_segmap_parloop_235965_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235965_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235965_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235963(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228894 = tid;
    int num_tasks_228909 = info.nsubtasks;
    struct futhark_mc_task_235962 *futhark_mc_task_235962 =
                                  (struct futhark_mc_task_235962 *) args;
    struct futhark_context *ctx = futhark_mc_task_235962->ctx;
    uint64_t futhark_mc_segmap_task_235963_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235963_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235962->free_n_p_203492;
    int64_t C_len_203634 = futhark_mc_task_235962->free_C_len_203634;
    int64_t css_results_l_204110 =
            futhark_mc_task_235962->free_css_results_l_204110;
    int64_t gtid_211862 = futhark_mc_task_235962->free_gtid_211862;
    struct memblock ext_mem_219195 = {.desc ="ext_mem_219195", .mem =
                                      futhark_mc_task_235962->free_ext_mem_219195,
                                      .size =0, .references =NULL};
    struct memblock mem_219199 = {.desc ="mem_219199", .mem =
                                  futhark_mc_task_235962->free_mem_219199,
                                  .size =0, .references =NULL};
    int64_t iter_228910;
    struct futhark_mc_segmap_parloop_struct_235964
    futhark_mc_segmap_parloop_struct_235964;
    
    futhark_mc_segmap_parloop_struct_235964.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235964.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235964.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_235964.free_css_results_l_204110 =
        css_results_l_204110;
    futhark_mc_segmap_parloop_struct_235964.free_gtid_211862 = gtid_211862;
    futhark_mc_segmap_parloop_struct_235964.free_ext_mem_219195 =
        ext_mem_219195.mem;
    futhark_mc_segmap_parloop_struct_235964.free_mem_219199 = mem_219199.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235965_task;
    
    futhark_mc_segmap_parloop_235965_task.name =
        "futhark_mc_segmap_parloop_235965";
    futhark_mc_segmap_parloop_235965_task.fn = futhark_mc_segmap_parloop_235965;
    futhark_mc_segmap_parloop_235965_task.args =
        &futhark_mc_segmap_parloop_struct_235964;
    futhark_mc_segmap_parloop_235965_task.iterations = iterations;
    futhark_mc_segmap_parloop_235965_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235965_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235965_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235965_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235965_task);
    
    if (futhark_mc_segmap_parloop_235965_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235965_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235965_total_end -
                 futhark_mc_segmap_parloop_235965_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235965_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235965_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235965_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235963_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235963_end -
                 futhark_mc_segmap_task_235963_start;
        
        ctx->futhark_mc_segmap_task_235963_runs[tid]++;
        ctx->futhark_mc_segmap_task_235963_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235963_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235960(void *args, int64_t start,
                                            int64_t end, int flat_tid_211861,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235959
    *futhark_mc_segmap_parloop_struct_235959 =
    (struct futhark_mc_segmap_parloop_struct_235959 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235959->ctx;
    uint64_t futhark_mc_segmap_parloop_235960_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235960_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235959->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235959->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_235959->free_C_len_203634;
    int64_t css_results_l_204110 =
            futhark_mc_segmap_parloop_struct_235959->free_css_results_l_204110;
    struct memblock ext_mem_219195 = {.desc ="ext_mem_219195", .mem =
                                      futhark_mc_segmap_parloop_struct_235959->free_ext_mem_219195,
                                      .size =0, .references =NULL};
    int64_t bytes_219198 =
            futhark_mc_segmap_parloop_struct_235959->free_bytes_219198;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_235959->free_mem_219218,
                                  .size =0, .references =NULL};
    size_t mem_219199_cached_sizze_235961 = 0;
    unsigned char *mem_219199 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228893 = start;
    
    if (mem_219199_cached_sizze_235961 < (size_t) bytes_219198) {
        mem_219199 = realloc(mem_219199, bytes_219198);
        mem_219199_cached_sizze_235961 = bytes_219198;
    }
    for (; iter_228893 < end; iter_228893++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228907 = partition_sizze_203577;
        int64_t gtid_211862 = iter_228893;
        int64_t remnant_228908 = iter_228893 - gtid_211862;
        int64_t flat_tid_228894 = (int64_t) 0;
        int32_t num_tasks_228909;
        struct futhark_mc_task_235962 futhark_mc_task_235962;
        
        futhark_mc_task_235962.ctx = ctx;
        futhark_mc_task_235962.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235962.free_C_len_203634 = C_len_203634;
        futhark_mc_task_235962.free_css_results_l_204110 = css_results_l_204110;
        futhark_mc_task_235962.free_gtid_211862 = gtid_211862;
        futhark_mc_task_235962.free_ext_mem_219195 = ext_mem_219195.mem;
        futhark_mc_task_235962.free_mem_219199 = mem_219199;
        
        struct scheduler_segop futhark_mc_task_235962_task;
        
        futhark_mc_task_235962_task.args = &futhark_mc_task_235962;
        futhark_mc_task_235962_task.top_level_fn =
            futhark_mc_segmap_task_235963;
        futhark_mc_task_235962_task.name = "futhark_mc_segmap_task_235963";
        futhark_mc_task_235962_task.iterations = C_len_203634;
        futhark_mc_task_235962_task.task_time =
            &ctx->futhark_mc_segmap_task_235963_total_time;
        futhark_mc_task_235962_task.task_iter =
            &ctx->futhark_mc_segmap_task_235963_total_iter;
        futhark_mc_task_235962_task.sched = STATIC;
        futhark_mc_task_235962_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235963_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235962_task);
        
        if (futhark_mc_segmap_task_235963_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (C_len_203634 * (int64_t) 8 > 0)
            memmove(mem_219218.mem + gtid_211862 * C_len_203634 * (int64_t) 8,
                    mem_219199 + (int64_t) 0, C_len_203634 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219199);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235960_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235960_end -
                 futhark_mc_segmap_parloop_235960_start;
        
        ctx->futhark_mc_segmap_parloop_235960_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235960_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235960_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235958(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211861 = tid;
    int num_tasks_228874 = info.nsubtasks;
    struct futhark_mc_task_235953 *futhark_mc_task_235953 =
                                  (struct futhark_mc_task_235953 *) args;
    struct futhark_context *ctx = futhark_mc_task_235953->ctx;
    uint64_t futhark_mc_segmap_nested_task_235958_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235958_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235953->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235953->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_235953->free_C_len_203634;
    int64_t css_results_l_204110 =
            futhark_mc_task_235953->free_css_results_l_204110;
    struct memblock ext_mem_219195 = {.desc ="ext_mem_219195", .mem =
                                      futhark_mc_task_235953->free_ext_mem_219195,
                                      .size =0, .references =NULL};
    int64_t bytes_219198 = futhark_mc_task_235953->free_bytes_219198;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235953->free_mem_219218,
                                  .size =0, .references =NULL};
    int64_t iter_228893;
    struct futhark_mc_segmap_parloop_struct_235959
    futhark_mc_segmap_parloop_struct_235959;
    
    futhark_mc_segmap_parloop_struct_235959.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235959.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235959.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235959.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_235959.free_css_results_l_204110 =
        css_results_l_204110;
    futhark_mc_segmap_parloop_struct_235959.free_ext_mem_219195 =
        ext_mem_219195.mem;
    futhark_mc_segmap_parloop_struct_235959.free_bytes_219198 = bytes_219198;
    futhark_mc_segmap_parloop_struct_235959.free_mem_219218 = mem_219218.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235960_task;
    
    futhark_mc_segmap_parloop_235960_task.name =
        "futhark_mc_segmap_parloop_235960";
    futhark_mc_segmap_parloop_235960_task.fn = futhark_mc_segmap_parloop_235960;
    futhark_mc_segmap_parloop_235960_task.args =
        &futhark_mc_segmap_parloop_struct_235959;
    futhark_mc_segmap_parloop_235960_task.iterations = iterations;
    futhark_mc_segmap_parloop_235960_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235960_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235960_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235960_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235960_task);
    
    if (futhark_mc_segmap_parloop_235960_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235960_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235960_total_end -
                 futhark_mc_segmap_parloop_235960_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235960_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235960_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235960_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235958_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235958_end -
                 futhark_mc_segmap_nested_task_235958_start;
        
        ctx->futhark_mc_segmap_nested_task_235958_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235958_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235958_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235966 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219221;
};
struct futhark_mc_segmap_parloop_struct_235968 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219221;
};
static int futhark_mc_segmap_parloop_235969(void *args, int64_t start,
                                            int64_t end, int flat_tid_211879,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235968
    *futhark_mc_segmap_parloop_struct_235968 =
    (struct futhark_mc_segmap_parloop_struct_235968 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235968->ctx;
    uint64_t futhark_mc_segmap_parloop_235969_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235969_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235968->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235968->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_235968->free_C_len_203634;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_235968->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_segmap_parloop_struct_235968->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228914 = start;
    
    for (; iter_228914 < end; iter_228914++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228919 = partition_sizze_203577;
        int64_t gtid_211880 = iter_228914;
        int64_t remnant_228920 = iter_228914 - gtid_211880;
        double defunc_2_reduce_res_205083;
        double redout_228916 = 0.0;
        
        for (int64_t i_228915 = 0; i_228915 < n_p_203492; i_228915++) {
            double x_228917;
            
            x_228917 = ((double *) mem_219218.mem)[gtid_211880 * C_len_203634 +
                                                   i_228915];
            
            double defunc_1_op_res_228918 = x_228917 + redout_228916;
            double redout_tmp_228921 = defunc_1_op_res_228918;
            
            redout_228916 = redout_tmp_228921;
        }
        defunc_2_reduce_res_205083 = redout_228916;
        ((double *) mem_219221.mem)[gtid_211880] = defunc_2_reduce_res_205083;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235969_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235969_end -
                 futhark_mc_segmap_parloop_235969_start;
        
        ctx->futhark_mc_segmap_parloop_235969_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235969_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235969_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235967(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211879 = tid;
    int num_tasks_228913 = info.nsubtasks;
    struct futhark_mc_task_235966 *futhark_mc_task_235966 =
                                  (struct futhark_mc_task_235966 *) args;
    struct futhark_context *ctx = futhark_mc_task_235966->ctx;
    uint64_t futhark_mc_segmap_task_235967_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235967_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235966->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235966->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_235966->free_C_len_203634;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235966->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_task_235966->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t iter_228914;
    struct futhark_mc_segmap_parloop_struct_235968
    futhark_mc_segmap_parloop_struct_235968;
    
    futhark_mc_segmap_parloop_struct_235968.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235968.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235968.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235968.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_235968.free_mem_219218 = mem_219218.mem;
    futhark_mc_segmap_parloop_struct_235968.free_mem_219221 = mem_219221.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235969_task;
    
    futhark_mc_segmap_parloop_235969_task.name =
        "futhark_mc_segmap_parloop_235969";
    futhark_mc_segmap_parloop_235969_task.fn = futhark_mc_segmap_parloop_235969;
    futhark_mc_segmap_parloop_235969_task.args =
        &futhark_mc_segmap_parloop_struct_235968;
    futhark_mc_segmap_parloop_235969_task.iterations = iterations;
    futhark_mc_segmap_parloop_235969_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235969_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235969_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235969_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235969_task);
    
    if (futhark_mc_segmap_parloop_235969_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235969_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235969_total_end -
                 futhark_mc_segmap_parloop_235969_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235969_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235969_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235969_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235967_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235967_end -
                 futhark_mc_segmap_task_235967_start;
        
        ctx->futhark_mc_segmap_task_235967_runs[tid]++;
        ctx->futhark_mc_segmap_task_235967_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235967_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235971 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219221;
};
struct futhark_mc_task_235973 {
    struct futhark_context *ctx;
    int64_t free_C_len_203634;
    int64_t free_gtid_211886;
    unsigned char *free_mem_219218;
    double *retval_defunc_2_reduce_res_211888;
};
struct futhark_mc_segred_stage_1_parloop_struct_235976 {
    struct futhark_context *ctx;
    int64_t free_C_len_203634;
    int64_t free_gtid_211886;
    unsigned char *free_mem_219218;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228932;
};
static int futhark_mc_segred_stage_1_parloop_235977(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_228923,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235976
    *futhark_mc_segred_stage_1_parloop_struct_235976 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235976 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235976->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235977_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235977_start = get_wall_time();
    
    int64_t C_len_203634 =
            futhark_mc_segred_stage_1_parloop_struct_235976->free_C_len_203634;
    int64_t gtid_211886 =
            futhark_mc_segred_stage_1_parloop_struct_235976->free_gtid_211886;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235976->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228932 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228932",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235976->free_reduce_stage_1_tid_res_arr_mem_228932,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228934 = start;
    double x_228925;
    double x_228926;
    double local_acc_228935 = 0.0;
    
    for (; iter_228934 < end; iter_228934++) {
        int64_t gtid_228924 = iter_228934;
        double x_228928;
        
        x_228928 = ((double *) mem_219218.mem)[gtid_211886 * C_len_203634 +
                                               gtid_228924];
        // save map-out results
        { }
        // Load accum params
        {
            x_228925 = local_acc_228935;
        }
        // Load next params
        {
            x_228926 = x_228928;
        }
        // Red body
        {
            double defunc_1_op_res_228927 = x_228925 + x_228926;
            
            local_acc_228935 = defunc_1_op_res_228927;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_228932.mem)[flat_tid_228923] =
        local_acc_228935;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235977_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235977_end -
                 futhark_mc_segred_stage_1_parloop_235977_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235977_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235977_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235977_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235974(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228923 = tid;
    int num_tasks_228931 = info.nsubtasks;
    struct futhark_mc_task_235973 *futhark_mc_task_235973 =
                                  (struct futhark_mc_task_235973 *) args;
    struct futhark_context *ctx = futhark_mc_task_235973->ctx;
    uint64_t futhark_mc_segred_task_235974_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235974_start = get_wall_time();
    
    int64_t C_len_203634 = futhark_mc_task_235973->free_C_len_203634;
    int64_t gtid_211886 = futhark_mc_task_235973->free_gtid_211886;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235973->free_mem_219218,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_211888 =
           *futhark_mc_task_235973->retval_defunc_2_reduce_res_211888;
    size_t reduce_stage_1_tid_res_arr_mem_228932_cached_sizze_235975 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228932 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_228932_cached_sizze_235975 <
        (size_t) ((int64_t) 8 * num_tasks_228931)) {
        reduce_stage_1_tid_res_arr_mem_228932 =
            realloc(reduce_stage_1_tid_res_arr_mem_228932, (int64_t) 8 *
                    num_tasks_228931);
        reduce_stage_1_tid_res_arr_mem_228932_cached_sizze_235975 =
            (int64_t) 8 * num_tasks_228931;
    }
    
    int64_t iter_228934;
    struct futhark_mc_segred_stage_1_parloop_struct_235976
    futhark_mc_segred_stage_1_parloop_struct_235976;
    
    futhark_mc_segred_stage_1_parloop_struct_235976.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235976.free_C_len_203634 =
        C_len_203634;
    futhark_mc_segred_stage_1_parloop_struct_235976.free_gtid_211886 =
        gtid_211886;
    futhark_mc_segred_stage_1_parloop_struct_235976.free_mem_219218 =
        mem_219218.mem;
    futhark_mc_segred_stage_1_parloop_struct_235976.free_reduce_stage_1_tid_res_arr_mem_228932 =
        reduce_stage_1_tid_res_arr_mem_228932;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235977_task;
    
    futhark_mc_segred_stage_1_parloop_235977_task.name =
        "futhark_mc_segred_stage_1_parloop_235977";
    futhark_mc_segred_stage_1_parloop_235977_task.fn =
        futhark_mc_segred_stage_1_parloop_235977;
    futhark_mc_segred_stage_1_parloop_235977_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235976;
    futhark_mc_segred_stage_1_parloop_235977_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235977_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235977_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235977_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235977_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235977_task);
    
    if (futhark_mc_segred_stage_1_parloop_235977_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235977_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235977_total_end -
                 futhark_mc_segred_stage_1_parloop_235977_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235977_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235977_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235977_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_211888 = 0.0;
    }
    
    double x_228936;
    double x_228937;
    
    for (int32_t i_228939 = 0; i_228939 < num_tasks_228931; i_228939++) {
        flat_tid_228923 = i_228939;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_228936 = defunc_2_reduce_res_211888;
            }
            // load next params
            {
                x_228937 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228932)[flat_tid_228923];
            }
            // red body
            {
                double defunc_1_op_res_228938 = x_228936 + x_228937;
                
                defunc_2_reduce_res_211888 = defunc_1_op_res_228938;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_228932);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235974_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235974_end -
                 futhark_mc_segred_task_235974_start;
        
        ctx->futhark_mc_segred_task_235974_runs[tid]++;
        ctx->futhark_mc_segred_task_235974_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235974_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235973->retval_defunc_2_reduce_res_211888 =
            defunc_2_reduce_res_211888;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235972(void *args, int64_t start,
                                            int64_t end, int flat_tid_211885,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235971
    *futhark_mc_segmap_parloop_struct_235971 =
    (struct futhark_mc_segmap_parloop_struct_235971 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235971->ctx;
    uint64_t futhark_mc_segmap_parloop_235972_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235972_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235971->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235971->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_235971->free_C_len_203634;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228922 = start;
    
    for (; iter_228922 < end; iter_228922++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228929 = partition_sizze_203577;
        int64_t gtid_211886 = iter_228922;
        int64_t remnant_228930 = iter_228922 - gtid_211886;
        double defunc_2_reduce_res_211888;
        int64_t flat_tid_228923 = (int64_t) 0;
        int32_t num_tasks_228931;
        
        defunc_2_reduce_res_211888 = 0.0;
        
        struct futhark_mc_task_235973 futhark_mc_task_235973;
        
        futhark_mc_task_235973.ctx = ctx;
        futhark_mc_task_235973.free_C_len_203634 = C_len_203634;
        futhark_mc_task_235973.free_gtid_211886 = gtid_211886;
        futhark_mc_task_235973.free_mem_219218 = mem_219218.mem;
        futhark_mc_task_235973.retval_defunc_2_reduce_res_211888 =
            &defunc_2_reduce_res_211888;
        
        struct scheduler_segop futhark_mc_task_235973_task;
        
        futhark_mc_task_235973_task.args = &futhark_mc_task_235973;
        futhark_mc_task_235973_task.top_level_fn =
            futhark_mc_segred_task_235974;
        futhark_mc_task_235973_task.name = "futhark_mc_segred_task_235974";
        futhark_mc_task_235973_task.iterations = n_p_203492;
        futhark_mc_task_235973_task.task_time =
            &ctx->futhark_mc_segred_task_235974_total_time;
        futhark_mc_task_235973_task.task_iter =
            &ctx->futhark_mc_segred_task_235974_total_iter;
        futhark_mc_task_235973_task.sched = STATIC;
        futhark_mc_task_235973_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235974_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235973_task);
        
        if (futhark_mc_segred_task_235974_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219221.mem)[gtid_211886] = defunc_2_reduce_res_211888;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235972_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235972_end -
                 futhark_mc_segmap_parloop_235972_start;
        
        ctx->futhark_mc_segmap_parloop_235972_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235972_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235972_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235970(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211885 = tid;
    int num_tasks_228913 = info.nsubtasks;
    struct futhark_mc_task_235966 *futhark_mc_task_235966 =
                                  (struct futhark_mc_task_235966 *) args;
    struct futhark_context *ctx = futhark_mc_task_235966->ctx;
    uint64_t futhark_mc_segmap_nested_task_235970_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235970_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235966->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235966->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_235966->free_C_len_203634;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235966->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_task_235966->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t iter_228922;
    struct futhark_mc_segmap_parloop_struct_235971
    futhark_mc_segmap_parloop_struct_235971;
    
    futhark_mc_segmap_parloop_struct_235971.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235971.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235971.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235971.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_235971.free_mem_219218 = mem_219218.mem;
    futhark_mc_segmap_parloop_struct_235971.free_mem_219221 = mem_219221.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235972_task;
    
    futhark_mc_segmap_parloop_235972_task.name =
        "futhark_mc_segmap_parloop_235972";
    futhark_mc_segmap_parloop_235972_task.fn = futhark_mc_segmap_parloop_235972;
    futhark_mc_segmap_parloop_235972_task.args =
        &futhark_mc_segmap_parloop_struct_235971;
    futhark_mc_segmap_parloop_235972_task.iterations = iterations;
    futhark_mc_segmap_parloop_235972_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235972_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235972_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235972_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235972_task);
    
    if (futhark_mc_segmap_parloop_235972_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235972_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235972_total_end -
                 futhark_mc_segmap_parloop_235972_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235972_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235972_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235972_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235970_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235970_end -
                 futhark_mc_segmap_nested_task_235970_start;
        
        ctx->futhark_mc_segmap_nested_task_235970_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235970_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235970_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235978 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_lifted_single_ma_l_arg_204134;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219221;
    int64_t free_bytes_219223;
    unsigned char *free_mem_219243;
};
struct futhark_mc_segmap_parloop_struct_235980 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_lifted_single_ma_l_arg_204134;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219221;
    int64_t free_bytes_219223;
    unsigned char *free_mem_219243;
};
static int futhark_mc_segmap_parloop_235981(void *args, int64_t start,
                                            int64_t end, int flat_tid_211895,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235980
    *futhark_mc_segmap_parloop_struct_235980 =
    (struct futhark_mc_segmap_parloop_struct_235980 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235980->ctx;
    uint64_t futhark_mc_segmap_parloop_235981_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235981_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235980->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_segmap_parloop_struct_235980->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235980->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_235980->free_C_len_203634;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_segmap_parloop_struct_235980->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_235980->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_segmap_parloop_struct_235980->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t bytes_219223 =
            futhark_mc_segmap_parloop_struct_235980->free_bytes_219223;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_segmap_parloop_struct_235980->free_mem_219243,
                                  .size =0, .references =NULL};
    size_t mem_219227_cached_sizze_235982 = 0;
    unsigned char *mem_219227 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228941 = start;
    
    if (mem_219227_cached_sizze_235982 < (size_t) bytes_219223) {
        mem_219227 = realloc(mem_219227, bytes_219223);
        mem_219227_cached_sizze_235982 = bytes_219223;
    }
    for (; iter_228941 < end; iter_228941++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228965 = partition_sizze_203577;
        int64_t gtid_211896 = iter_228941;
        int64_t remnant_228966 = iter_228941 - gtid_211896;
        double x_205091;
        
        x_205091 = ((double *) mem_219221.mem)[gtid_211896];
        
        double discard_216473;
        double scanacc_228943 = 0.0;
        
        for (int64_t i_228942 = 0; i_228942 < lifted_single_ma_l_arg_204134;
             i_228942++) {
            bool cond_228945 = i_228942 == (int64_t) 0;
            double defunc_0_f_res_228946;
            
            if (cond_228945) {
                double defunc_0_f_res_t_res_228947 = x_205091 / i64_res_203507;
                
                defunc_0_f_res_228946 = defunc_0_f_res_t_res_228947;
            } else {
                int64_t x_228948 = add64(n_p_203492, i_228942);
                int64_t i_228949 = sub64(x_228948, (int64_t) 1);
                bool x_228950 = sle64((int64_t) 0, i_228949);
                bool y_228951 = slt64(i_228949, C_len_203634);
                bool bounds_check_228952 = x_228950 && y_228951;
                bool index_certs_228953;
                
                if (!bounds_check_228952) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228949,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_228954;
                
                x_228954 = ((double *) mem_219218.mem)[gtid_211896 *
                                                       C_len_203634 + i_228949];
                
                int64_t i_228955 = sub64(i_228942, (int64_t) 1);
                bool x_228956 = sle64((int64_t) 0, i_228955);
                bool y_228957 = slt64(i_228955, C_len_203634);
                bool bounds_check_228958 = x_228956 && y_228957;
                bool index_certs_228959;
                
                if (!bounds_check_228958) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228955,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_228960;
                
                y_228960 = ((double *) mem_219218.mem)[gtid_211896 *
                                                       C_len_203634 + i_228955];
                
                double x_228961 = x_228954 - y_228960;
                double defunc_0_f_res_f_res_228962 = x_228961 / i64_res_203507;
                
                defunc_0_f_res_228946 = defunc_0_f_res_f_res_228962;
            }
            
            double defunc_1_op_res_228963 = defunc_0_f_res_228946 +
                   scanacc_228943;
            
            ((double *) mem_219227)[i_228942] = defunc_1_op_res_228963;
            
            double scanacc_tmp_228967 = defunc_1_op_res_228963;
            
            scanacc_228943 = scanacc_tmp_228967;
        }
        discard_216473 = scanacc_228943;
        if (lifted_single_ma_l_arg_204134 * (int64_t) 8 > 0)
            memmove(mem_219243.mem + gtid_211896 *
                    lifted_single_ma_l_arg_204134 * (int64_t) 8, mem_219227 +
                    (int64_t) 0, lifted_single_ma_l_arg_204134 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219227);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235981_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235981_end -
                 futhark_mc_segmap_parloop_235981_start;
        
        ctx->futhark_mc_segmap_parloop_235981_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235981_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235981_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235979(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211895 = tid;
    int num_tasks_228940 = info.nsubtasks;
    struct futhark_mc_task_235978 *futhark_mc_task_235978 =
                                  (struct futhark_mc_task_235978 *) args;
    struct futhark_context *ctx = futhark_mc_task_235978->ctx;
    uint64_t futhark_mc_segmap_task_235979_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235979_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235978->free_n_p_203492;
    double i64_res_203507 = futhark_mc_task_235978->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235978->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_235978->free_C_len_203634;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_235978->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235978->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_task_235978->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t bytes_219223 = futhark_mc_task_235978->free_bytes_219223;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_235978->free_mem_219243,
                                  .size =0, .references =NULL};
    int64_t iter_228941;
    struct futhark_mc_segmap_parloop_struct_235980
    futhark_mc_segmap_parloop_struct_235980;
    
    futhark_mc_segmap_parloop_struct_235980.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235980.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235980.free_i64_res_203507 =
        i64_res_203507;
    futhark_mc_segmap_parloop_struct_235980.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235980.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_235980.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_segmap_parloop_struct_235980.free_mem_219218 = mem_219218.mem;
    futhark_mc_segmap_parloop_struct_235980.free_mem_219221 = mem_219221.mem;
    futhark_mc_segmap_parloop_struct_235980.free_bytes_219223 = bytes_219223;
    futhark_mc_segmap_parloop_struct_235980.free_mem_219243 = mem_219243.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235981_task;
    
    futhark_mc_segmap_parloop_235981_task.name =
        "futhark_mc_segmap_parloop_235981";
    futhark_mc_segmap_parloop_235981_task.fn = futhark_mc_segmap_parloop_235981;
    futhark_mc_segmap_parloop_235981_task.args =
        &futhark_mc_segmap_parloop_struct_235980;
    futhark_mc_segmap_parloop_235981_task.iterations = iterations;
    futhark_mc_segmap_parloop_235981_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235981_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235981_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235981_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235981_task);
    
    if (futhark_mc_segmap_parloop_235981_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235981_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235981_total_end -
                 futhark_mc_segmap_parloop_235981_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235981_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235981_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235981_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235979_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235979_end -
                 futhark_mc_segmap_task_235979_start;
        
        ctx->futhark_mc_segmap_task_235979_runs[tid]++;
        ctx->futhark_mc_segmap_task_235979_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235979_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235984 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_lifted_single_ma_l_arg_204134;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219221;
    int64_t free_bytes_219223;
    unsigned char *free_mem_219243;
};
struct futhark_mc_task_235987 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_C_len_203634;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_gtid_211902;
    double free_x_211904;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219224;
};
struct futhark_mc_scan_stage_1_parloop_struct_235990 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_C_len_203634;
    int64_t free_gtid_211902;
    double free_x_211904;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219224;
};
static int futhark_mc_scan_stage_1_parloop_235991(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_228970, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_235990
    *futhark_mc_scan_stage_1_parloop_struct_235990 =
    (struct futhark_mc_scan_stage_1_parloop_struct_235990 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_235990->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_235991_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235991_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_scan_stage_1_parloop_struct_235990->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_scan_stage_1_parloop_struct_235990->free_i64_res_203507;
    int64_t C_len_203634 =
            futhark_mc_scan_stage_1_parloop_struct_235990->free_C_len_203634;
    int64_t gtid_211902 =
            futhark_mc_scan_stage_1_parloop_struct_235990->free_gtid_211902;
    double x_211904 =
           futhark_mc_scan_stage_1_parloop_struct_235990->free_x_211904;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235990->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219224 = {.desc ="mem_219224", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235990->free_mem_219224,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228996 = start;
    double x_228972;
    double x_228973;
    
    x_228972 = 0.0;
    for (; iter_228996 < end; iter_228996++) {
        int64_t gtid_228971 = iter_228996;
        
        // stage 1 scan body
        {
            bool cond_228975 = gtid_228971 == (int64_t) 0;
            double defunc_0_f_res_228976;
            
            if (cond_228975) {
                double defunc_0_f_res_t_res_228977 = x_211904 / i64_res_203507;
                
                defunc_0_f_res_228976 = defunc_0_f_res_t_res_228977;
            } else {
                int64_t x_228978 = add64(n_p_203492, gtid_228971);
                int64_t i_228979 = sub64(x_228978, (int64_t) 1);
                bool x_228980 = sle64((int64_t) 0, i_228979);
                bool y_228981 = slt64(i_228979, C_len_203634);
                bool bounds_check_228982 = x_228980 && y_228981;
                bool index_certs_228983;
                
                if (!bounds_check_228982) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228979,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_228984;
                
                x_228984 = ((double *) mem_219218.mem)[gtid_211902 *
                                                       C_len_203634 + i_228979];
                
                int64_t i_228985 = sub64(gtid_228971, (int64_t) 1);
                bool x_228986 = sle64((int64_t) 0, i_228985);
                bool y_228987 = slt64(i_228985, C_len_203634);
                bool bounds_check_228988 = x_228986 && y_228987;
                bool index_certs_228989;
                
                if (!bounds_check_228988) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228985,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_228990;
                
                y_228990 = ((double *) mem_219218.mem)[gtid_211902 *
                                                       C_len_203634 + i_228985];
                
                double x_228991 = x_228984 - y_228990;
                double defunc_0_f_res_f_res_228992 = x_228991 / i64_res_203507;
                
                defunc_0_f_res_228976 = defunc_0_f_res_f_res_228992;
            }
            // write mapped values results to memory
            { }
            x_228972 = x_228972;
            // Read next values
            {
                x_228973 = defunc_0_f_res_228976;
            }
            
            double defunc_1_op_res_228974 = x_228972 + x_228973;
            
            ((double *) mem_219224.mem)[gtid_228971] = defunc_1_op_res_228974;
            x_228972 = defunc_1_op_res_228974;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235991_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235991_end -
                 futhark_mc_scan_stage_1_parloop_235991_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_235991_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_235991_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_235991_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_235992 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_C_len_203634;
    int64_t free_gtid_211902;
    double free_x_211904;
    unsigned char *free_mem_219218;
    unsigned char *free_mem_219224;
};
static int futhark_mc_scan_stage_3_parloop_235993(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_228970, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_235992
    *futhark_mc_scan_stage_3_parloop_struct_235992 =
    (struct futhark_mc_scan_stage_3_parloop_struct_235992 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_235992->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_235993_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_235993_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_scan_stage_3_parloop_struct_235992->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_scan_stage_3_parloop_struct_235992->free_i64_res_203507;
    int64_t C_len_203634 =
            futhark_mc_scan_stage_3_parloop_struct_235992->free_C_len_203634;
    int64_t gtid_211902 =
            futhark_mc_scan_stage_3_parloop_struct_235992->free_gtid_211902;
    double x_211904 =
           futhark_mc_scan_stage_3_parloop_struct_235992->free_x_211904;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235992->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219224 = {.desc ="mem_219224", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235992->free_mem_219224,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229008 = start;
    double x_229005;
    double x_229006;
    
    if (iter_229008 == (int64_t) 0) {
        x_229005 = 0.0;
    } else {
        x_229005 = ((double *) mem_219224.mem)[iter_229008 - (int64_t) 1];
    }
    for (; iter_229008 < end; iter_229008++) {
        int64_t gtid_228971 = iter_229008;
        
        // stage 3 scan body
        {
            bool cond_228975 = gtid_228971 == (int64_t) 0;
            double defunc_0_f_res_228976;
            
            if (cond_228975) {
                double defunc_0_f_res_t_res_228977 = x_211904 / i64_res_203507;
                
                defunc_0_f_res_228976 = defunc_0_f_res_t_res_228977;
            } else {
                int64_t x_228978 = add64(n_p_203492, gtid_228971);
                int64_t i_228979 = sub64(x_228978, (int64_t) 1);
                bool x_228980 = sle64((int64_t) 0, i_228979);
                bool y_228981 = slt64(i_228979, C_len_203634);
                bool bounds_check_228982 = x_228980 && y_228981;
                bool index_certs_228983;
                
                if (!bounds_check_228982) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228979,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_228984;
                
                x_228984 = ((double *) mem_219218.mem)[gtid_211902 *
                                                       C_len_203634 + i_228979];
                
                int64_t i_228985 = sub64(gtid_228971, (int64_t) 1);
                bool x_228986 = sle64((int64_t) 0, i_228985);
                bool y_228987 = slt64(i_228985, C_len_203634);
                bool bounds_check_228988 = x_228986 && y_228987;
                bool index_certs_228989;
                
                if (!bounds_check_228988) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228985,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_228990;
                
                y_228990 = ((double *) mem_219218.mem)[gtid_211902 *
                                                       C_len_203634 + i_228985];
                
                double x_228991 = x_228984 - y_228990;
                double defunc_0_f_res_f_res_228992 = x_228991 / i64_res_203507;
                
                defunc_0_f_res_228976 = defunc_0_f_res_f_res_228992;
            }
            x_229005 = x_229005;
            x_229006 = defunc_0_f_res_228976;
            
            double defunc_1_op_res_229007 = x_229005 + x_229006;
            
            ((double *) mem_219224.mem)[gtid_228971] = defunc_1_op_res_229007;
            x_229005 = defunc_1_op_res_229007;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_235993_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_235993_end -
                 futhark_mc_scan_stage_3_parloop_235993_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_235993_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_235993_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_235993_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_235988(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228970 = tid;
    int num_tasks_228995 = info.nsubtasks;
    struct futhark_mc_task_235987 *futhark_mc_task_235987 =
                                  (struct futhark_mc_task_235987 *) args;
    struct futhark_context *ctx = futhark_mc_task_235987->ctx;
    uint64_t futhark_mc_segscan_task_235988_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_235988_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235987->free_n_p_203492;
    double i64_res_203507 = futhark_mc_task_235987->free_i64_res_203507;
    int64_t C_len_203634 = futhark_mc_task_235987->free_C_len_203634;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_235987->free_lifted_single_ma_l_arg_204134;
    int64_t gtid_211902 = futhark_mc_task_235987->free_gtid_211902;
    double x_211904 = futhark_mc_task_235987->free_x_211904;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235987->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219224 = {.desc ="mem_219224", .mem =
                                  futhark_mc_task_235987->free_mem_219224,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_229002_cached_sizze_235989 = 0;
    unsigned char *scan_stage_2_accum_mem_229002 = NULL;
    int64_t iter_228996;
    struct futhark_mc_scan_stage_1_parloop_struct_235990
    futhark_mc_scan_stage_1_parloop_struct_235990;
    
    futhark_mc_scan_stage_1_parloop_struct_235990.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_235990.free_n_p_203492 = n_p_203492;
    futhark_mc_scan_stage_1_parloop_struct_235990.free_i64_res_203507 =
        i64_res_203507;
    futhark_mc_scan_stage_1_parloop_struct_235990.free_C_len_203634 =
        C_len_203634;
    futhark_mc_scan_stage_1_parloop_struct_235990.free_gtid_211902 =
        gtid_211902;
    futhark_mc_scan_stage_1_parloop_struct_235990.free_x_211904 = x_211904;
    futhark_mc_scan_stage_1_parloop_struct_235990.free_mem_219218 =
        mem_219218.mem;
    futhark_mc_scan_stage_1_parloop_struct_235990.free_mem_219224 =
        mem_219224.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_235991_task;
    
    futhark_mc_scan_stage_1_parloop_235991_task.name =
        "futhark_mc_scan_stage_1_parloop_235991";
    futhark_mc_scan_stage_1_parloop_235991_task.fn =
        futhark_mc_scan_stage_1_parloop_235991;
    futhark_mc_scan_stage_1_parloop_235991_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_235990;
    futhark_mc_scan_stage_1_parloop_235991_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_235991_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_235991_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235991_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_235991_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_235991_task);
    
    if (futhark_mc_scan_stage_1_parloop_235991_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235991_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235991_total_end -
                 futhark_mc_scan_stage_1_parloop_235991_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235991_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235991_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235991_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_228995)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        double x_228997;
        double x_228998;
        int64_t offset_229000 = (int64_t) 0;
        int64_t offset_index_229001 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_229002_cached_sizze_235989 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_229002 =
                realloc(scan_stage_2_accum_mem_229002, (int64_t) 8);
            scan_stage_2_accum_mem_229002_cached_sizze_235989 = (int64_t) 8;
        }
        ((double *) scan_stage_2_accum_mem_229002)[(int64_t) 0] = 0.0;
        for (int32_t i_229004 = 0; i_229004 < num_tasks_228995 - 1;
             i_229004++) {
            offset_229000 = squot64(lifted_single_ma_l_arg_204134,
                                    sext_i32_i64(num_tasks_228995));
            if (slt64(sext_i32_i64(i_229004),
                      srem64(lifted_single_ma_l_arg_204134,
                             sext_i32_i64(num_tasks_228995)))) {
                offset_229000 += (int64_t) 1;
            }
            offset_index_229001 += offset_229000;
            
            int64_t gtid_228971 = offset_index_229001;
            bool cond_228975 = gtid_228971 == (int64_t) 0;
            double defunc_0_f_res_228976;
            
            if (cond_228975) {
                double defunc_0_f_res_t_res_228977 = x_211904 / i64_res_203507;
                
                defunc_0_f_res_228976 = defunc_0_f_res_t_res_228977;
            } else {
                int64_t x_228978 = add64(n_p_203492, gtid_228971);
                int64_t i_228979 = sub64(x_228978, (int64_t) 1);
                bool x_228980 = sle64((int64_t) 0, i_228979);
                bool y_228981 = slt64(i_228979, C_len_203634);
                bool bounds_check_228982 = x_228980 && y_228981;
                bool index_certs_228983;
                
                if (!bounds_check_228982) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228979,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_228984;
                
                x_228984 = ((double *) mem_219218.mem)[gtid_211902 *
                                                       C_len_203634 + i_228979];
                
                int64_t i_228985 = sub64(gtid_228971, (int64_t) 1);
                bool x_228986 = sle64((int64_t) 0, i_228985);
                bool y_228987 = slt64(i_228985, C_len_203634);
                bool bounds_check_228988 = x_228986 && y_228987;
                bool index_certs_228989;
                
                if (!bounds_check_228988) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228985,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203634, "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  stl.fut:38:3-36\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_228990;
                
                y_228990 = ((double *) mem_219218.mem)[gtid_211902 *
                                                       C_len_203634 + i_228985];
                
                double x_228991 = x_228984 - y_228990;
                double defunc_0_f_res_f_res_228992 = x_228991 / i64_res_203507;
                
                defunc_0_f_res_228976 = defunc_0_f_res_f_res_228992;
            }
            // Read carry in
            {
                x_228997 =
                    ((double *) scan_stage_2_accum_mem_229002)[(int64_t) 0];
            }
            // Read next values
            {
                x_228998 = ((double *) mem_219224.mem)[offset_index_229001 -
                                                       (int64_t) 1];
            }
            
            double defunc_1_op_res_228999 = x_228997 + x_228998;
            
            ((double *) mem_219224.mem)[offset_index_229001 - (int64_t) 1] =
                defunc_1_op_res_228999;
            ((double *) scan_stage_2_accum_mem_229002)[(int64_t) 0] =
                defunc_1_op_res_228999;
        }
        
        int64_t iter_229008 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_235992
        futhark_mc_scan_stage_3_parloop_struct_235992;
        
        futhark_mc_scan_stage_3_parloop_struct_235992.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_235992.free_n_p_203492 =
            n_p_203492;
        futhark_mc_scan_stage_3_parloop_struct_235992.free_i64_res_203507 =
            i64_res_203507;
        futhark_mc_scan_stage_3_parloop_struct_235992.free_C_len_203634 =
            C_len_203634;
        futhark_mc_scan_stage_3_parloop_struct_235992.free_gtid_211902 =
            gtid_211902;
        futhark_mc_scan_stage_3_parloop_struct_235992.free_x_211904 = x_211904;
        futhark_mc_scan_stage_3_parloop_struct_235992.free_mem_219218 =
            mem_219218.mem;
        futhark_mc_scan_stage_3_parloop_struct_235992.free_mem_219224 =
            mem_219224.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_235993_task;
        
        futhark_mc_scan_stage_3_parloop_235993_task.name =
            "futhark_mc_scan_stage_3_parloop_235993";
        futhark_mc_scan_stage_3_parloop_235993_task.fn =
            futhark_mc_scan_stage_3_parloop_235993;
        futhark_mc_scan_stage_3_parloop_235993_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_235992;
        futhark_mc_scan_stage_3_parloop_235993_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_235993_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_235993_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_235993_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_235993_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_235993_task);
        
        if (futhark_mc_scan_stage_3_parloop_235993_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_235993_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_235993_total_end -
                     futhark_mc_scan_stage_3_parloop_235993_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235993_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235993_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235993_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_229002);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_235988_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_235988_end -
                 futhark_mc_segscan_task_235988_start;
        
        ctx->futhark_mc_segscan_task_235988_runs[tid]++;
        ctx->futhark_mc_segscan_task_235988_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_235988_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235985(void *args, int64_t start,
                                            int64_t end, int flat_tid_211901,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235984
    *futhark_mc_segmap_parloop_struct_235984 =
    (struct futhark_mc_segmap_parloop_struct_235984 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235984->ctx;
    uint64_t futhark_mc_segmap_parloop_235985_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235985_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235984->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_segmap_parloop_struct_235984->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235984->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_235984->free_C_len_203634;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_segmap_parloop_struct_235984->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_235984->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_segmap_parloop_struct_235984->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t bytes_219223 =
            futhark_mc_segmap_parloop_struct_235984->free_bytes_219223;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_segmap_parloop_struct_235984->free_mem_219243,
                                  .size =0, .references =NULL};
    size_t mem_219224_cached_sizze_235986 = 0;
    unsigned char *mem_219224 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228969 = start;
    
    if (mem_219224_cached_sizze_235986 < (size_t) bytes_219223) {
        mem_219224 = realloc(mem_219224, bytes_219223);
        mem_219224_cached_sizze_235986 = bytes_219223;
    }
    for (; iter_228969 < end; iter_228969++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228993 = partition_sizze_203577;
        int64_t gtid_211902 = iter_228969;
        int64_t remnant_228994 = iter_228969 - gtid_211902;
        double x_211904;
        
        x_211904 = ((double *) mem_219221.mem)[gtid_211902];
        
        int64_t flat_tid_228970 = (int64_t) 0;
        int32_t num_tasks_228995;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_235987 futhark_mc_task_235987;
        
        futhark_mc_task_235987.ctx = ctx;
        futhark_mc_task_235987.free_n_p_203492 = n_p_203492;
        futhark_mc_task_235987.free_i64_res_203507 = i64_res_203507;
        futhark_mc_task_235987.free_C_len_203634 = C_len_203634;
        futhark_mc_task_235987.free_lifted_single_ma_l_arg_204134 =
            lifted_single_ma_l_arg_204134;
        futhark_mc_task_235987.free_gtid_211902 = gtid_211902;
        futhark_mc_task_235987.free_x_211904 = x_211904;
        futhark_mc_task_235987.free_mem_219218 = mem_219218.mem;
        futhark_mc_task_235987.free_mem_219224 = mem_219224;
        
        struct scheduler_segop futhark_mc_task_235987_task;
        
        futhark_mc_task_235987_task.args = &futhark_mc_task_235987;
        futhark_mc_task_235987_task.top_level_fn =
            futhark_mc_segscan_task_235988;
        futhark_mc_task_235987_task.name = "futhark_mc_segscan_task_235988";
        futhark_mc_task_235987_task.iterations = lifted_single_ma_l_arg_204134;
        futhark_mc_task_235987_task.task_time =
            &ctx->futhark_mc_segscan_task_235988_total_time;
        futhark_mc_task_235987_task.task_iter =
            &ctx->futhark_mc_segscan_task_235988_total_iter;
        futhark_mc_task_235987_task.sched = STATIC;
        futhark_mc_task_235987_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_235988_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235987_task);
        
        if (futhark_mc_segscan_task_235988_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (lifted_single_ma_l_arg_204134 * (int64_t) 8 > 0)
            memmove(mem_219243.mem + gtid_211902 *
                    lifted_single_ma_l_arg_204134 * (int64_t) 8, mem_219224 +
                    (int64_t) 0, lifted_single_ma_l_arg_204134 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219224);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235985_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235985_end -
                 futhark_mc_segmap_parloop_235985_start;
        
        ctx->futhark_mc_segmap_parloop_235985_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235985_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235985_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235983(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211901 = tid;
    int num_tasks_228940 = info.nsubtasks;
    struct futhark_mc_task_235978 *futhark_mc_task_235978 =
                                  (struct futhark_mc_task_235978 *) args;
    struct futhark_context *ctx = futhark_mc_task_235978->ctx;
    uint64_t futhark_mc_segmap_nested_task_235983_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235983_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235978->free_n_p_203492;
    double i64_res_203507 = futhark_mc_task_235978->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235978->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_235978->free_C_len_203634;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_235978->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_235978->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock mem_219221 = {.desc ="mem_219221", .mem =
                                  futhark_mc_task_235978->free_mem_219221,
                                  .size =0, .references =NULL};
    int64_t bytes_219223 = futhark_mc_task_235978->free_bytes_219223;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_235978->free_mem_219243,
                                  .size =0, .references =NULL};
    int64_t iter_228969;
    struct futhark_mc_segmap_parloop_struct_235984
    futhark_mc_segmap_parloop_struct_235984;
    
    futhark_mc_segmap_parloop_struct_235984.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235984.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235984.free_i64_res_203507 =
        i64_res_203507;
    futhark_mc_segmap_parloop_struct_235984.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235984.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_235984.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_segmap_parloop_struct_235984.free_mem_219218 = mem_219218.mem;
    futhark_mc_segmap_parloop_struct_235984.free_mem_219221 = mem_219221.mem;
    futhark_mc_segmap_parloop_struct_235984.free_bytes_219223 = bytes_219223;
    futhark_mc_segmap_parloop_struct_235984.free_mem_219243 = mem_219243.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235985_task;
    
    futhark_mc_segmap_parloop_235985_task.name =
        "futhark_mc_segmap_parloop_235985";
    futhark_mc_segmap_parloop_235985_task.fn = futhark_mc_segmap_parloop_235985;
    futhark_mc_segmap_parloop_235985_task.args =
        &futhark_mc_segmap_parloop_struct_235984;
    futhark_mc_segmap_parloop_235985_task.iterations = iterations;
    futhark_mc_segmap_parloop_235985_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235985_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235985_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235985_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235985_task);
    
    if (futhark_mc_segmap_parloop_235985_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235985_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235985_total_end -
                 futhark_mc_segmap_parloop_235985_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235985_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235985_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235985_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235983_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235983_end -
                 futhark_mc_segmap_nested_task_235983_start;
        
        ctx->futhark_mc_segmap_nested_task_235983_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235983_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235983_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235994 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_lifted_single_ma_l_arg_204134;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219246;
};
struct futhark_mc_segmap_parloop_struct_235996 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_lifted_single_ma_l_arg_204134;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219246;
};
static int futhark_mc_segmap_parloop_235997(void *args, int64_t start,
                                            int64_t end, int flat_tid_211930,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235996
    *futhark_mc_segmap_parloop_struct_235996 =
    (struct futhark_mc_segmap_parloop_struct_235996 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235996->ctx;
    uint64_t futhark_mc_segmap_parloop_235997_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235997_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235996->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235996->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_segmap_parloop_struct_235996->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_segmap_parloop_struct_235996->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_segmap_parloop_struct_235996->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229010 = start;
    
    for (; iter_229010 < end; iter_229010++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229015 = partition_sizze_203577;
        int64_t gtid_211931 = iter_229010;
        int64_t remnant_229016 = iter_229010 - gtid_211931;
        double defunc_2_reduce_res_205119;
        double redout_229012 = 0.0;
        
        for (int64_t i_229011 = 0; i_229011 < n_p_203492; i_229011++) {
            double x_229013;
            
            x_229013 = ((double *) mem_219243.mem)[gtid_211931 *
                                                   lifted_single_ma_l_arg_204134 +
                                                   i_229011];
            
            double defunc_1_op_res_229014 = x_229013 + redout_229012;
            double redout_tmp_229017 = defunc_1_op_res_229014;
            
            redout_229012 = redout_tmp_229017;
        }
        defunc_2_reduce_res_205119 = redout_229012;
        ((double *) mem_219246.mem)[gtid_211931] = defunc_2_reduce_res_205119;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235997_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235997_end -
                 futhark_mc_segmap_parloop_235997_start;
        
        ctx->futhark_mc_segmap_parloop_235997_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235997_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235997_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235995(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211930 = tid;
    int num_tasks_229009 = info.nsubtasks;
    struct futhark_mc_task_235994 *futhark_mc_task_235994 =
                                  (struct futhark_mc_task_235994 *) args;
    struct futhark_context *ctx = futhark_mc_task_235994->ctx;
    uint64_t futhark_mc_segmap_task_235995_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235995_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235994->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235994->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_235994->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_235994->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_task_235994->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t iter_229010;
    struct futhark_mc_segmap_parloop_struct_235996
    futhark_mc_segmap_parloop_struct_235996;
    
    futhark_mc_segmap_parloop_struct_235996.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235996.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235996.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235996.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_segmap_parloop_struct_235996.free_mem_219243 = mem_219243.mem;
    futhark_mc_segmap_parloop_struct_235996.free_mem_219246 = mem_219246.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235997_task;
    
    futhark_mc_segmap_parloop_235997_task.name =
        "futhark_mc_segmap_parloop_235997";
    futhark_mc_segmap_parloop_235997_task.fn = futhark_mc_segmap_parloop_235997;
    futhark_mc_segmap_parloop_235997_task.args =
        &futhark_mc_segmap_parloop_struct_235996;
    futhark_mc_segmap_parloop_235997_task.iterations = iterations;
    futhark_mc_segmap_parloop_235997_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235997_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235997_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235997_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235997_task);
    
    if (futhark_mc_segmap_parloop_235997_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235997_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235997_total_end -
                 futhark_mc_segmap_parloop_235997_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235997_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235997_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235997_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235995_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235995_end -
                 futhark_mc_segmap_task_235995_start;
        
        ctx->futhark_mc_segmap_task_235995_runs[tid]++;
        ctx->futhark_mc_segmap_task_235995_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235995_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235999 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_lifted_single_ma_l_arg_204134;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219246;
};
struct futhark_mc_task_236001 {
    struct futhark_context *ctx;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_gtid_211937;
    unsigned char *free_mem_219243;
    double *retval_defunc_2_reduce_res_211939;
};
struct futhark_mc_segred_stage_1_parloop_struct_236004 {
    struct futhark_context *ctx;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_gtid_211937;
    unsigned char *free_mem_219243;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229028;
};
static int futhark_mc_segred_stage_1_parloop_236005(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229019,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236004
    *futhark_mc_segred_stage_1_parloop_struct_236004 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236004 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236004->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236005_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236005_start = get_wall_time();
    
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_segred_stage_1_parloop_struct_236004->free_lifted_single_ma_l_arg_204134;
    int64_t gtid_211937 =
            futhark_mc_segred_stage_1_parloop_struct_236004->free_gtid_211937;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236004->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229028 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229028",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236004->free_reduce_stage_1_tid_res_arr_mem_229028,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229030 = start;
    double x_229021;
    double x_229022;
    double local_acc_229031 = 0.0;
    
    for (; iter_229030 < end; iter_229030++) {
        int64_t gtid_229020 = iter_229030;
        double x_229024;
        
        x_229024 = ((double *) mem_219243.mem)[gtid_211937 *
                                               lifted_single_ma_l_arg_204134 +
                                               gtid_229020];
        // save map-out results
        { }
        // Load accum params
        {
            x_229021 = local_acc_229031;
        }
        // Load next params
        {
            x_229022 = x_229024;
        }
        // Red body
        {
            double defunc_1_op_res_229023 = x_229021 + x_229022;
            
            local_acc_229031 = defunc_1_op_res_229023;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229028.mem)[flat_tid_229019] =
        local_acc_229031;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236005_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236005_end -
                 futhark_mc_segred_stage_1_parloop_236005_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236005_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236005_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236005_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236002(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229019 = tid;
    int num_tasks_229027 = info.nsubtasks;
    struct futhark_mc_task_236001 *futhark_mc_task_236001 =
                                  (struct futhark_mc_task_236001 *) args;
    struct futhark_context *ctx = futhark_mc_task_236001->ctx;
    uint64_t futhark_mc_segred_task_236002_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236002_start = get_wall_time();
    
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_236001->free_lifted_single_ma_l_arg_204134;
    int64_t gtid_211937 = futhark_mc_task_236001->free_gtid_211937;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_236001->free_mem_219243,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_211939 =
           *futhark_mc_task_236001->retval_defunc_2_reduce_res_211939;
    size_t reduce_stage_1_tid_res_arr_mem_229028_cached_sizze_236003 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229028 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229028_cached_sizze_236003 <
        (size_t) ((int64_t) 8 * num_tasks_229027)) {
        reduce_stage_1_tid_res_arr_mem_229028 =
            realloc(reduce_stage_1_tid_res_arr_mem_229028, (int64_t) 8 *
                    num_tasks_229027);
        reduce_stage_1_tid_res_arr_mem_229028_cached_sizze_236003 =
            (int64_t) 8 * num_tasks_229027;
    }
    
    int64_t iter_229030;
    struct futhark_mc_segred_stage_1_parloop_struct_236004
    futhark_mc_segred_stage_1_parloop_struct_236004;
    
    futhark_mc_segred_stage_1_parloop_struct_236004.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236004.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_segred_stage_1_parloop_struct_236004.free_gtid_211937 =
        gtid_211937;
    futhark_mc_segred_stage_1_parloop_struct_236004.free_mem_219243 =
        mem_219243.mem;
    futhark_mc_segred_stage_1_parloop_struct_236004.free_reduce_stage_1_tid_res_arr_mem_229028 =
        reduce_stage_1_tid_res_arr_mem_229028;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236005_task;
    
    futhark_mc_segred_stage_1_parloop_236005_task.name =
        "futhark_mc_segred_stage_1_parloop_236005";
    futhark_mc_segred_stage_1_parloop_236005_task.fn =
        futhark_mc_segred_stage_1_parloop_236005;
    futhark_mc_segred_stage_1_parloop_236005_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236004;
    futhark_mc_segred_stage_1_parloop_236005_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236005_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236005_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236005_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236005_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236005_task);
    
    if (futhark_mc_segred_stage_1_parloop_236005_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236005_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236005_total_end -
                 futhark_mc_segred_stage_1_parloop_236005_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236005_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236005_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236005_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_211939 = 0.0;
    }
    
    double x_229032;
    double x_229033;
    
    for (int32_t i_229035 = 0; i_229035 < num_tasks_229027; i_229035++) {
        flat_tid_229019 = i_229035;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229032 = defunc_2_reduce_res_211939;
            }
            // load next params
            {
                x_229033 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229028)[flat_tid_229019];
            }
            // red body
            {
                double defunc_1_op_res_229034 = x_229032 + x_229033;
                
                defunc_2_reduce_res_211939 = defunc_1_op_res_229034;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229028);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236002_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236002_end -
                 futhark_mc_segred_task_236002_start;
        
        ctx->futhark_mc_segred_task_236002_runs[tid]++;
        ctx->futhark_mc_segred_task_236002_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236002_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236001->retval_defunc_2_reduce_res_211939 =
            defunc_2_reduce_res_211939;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236000(void *args, int64_t start,
                                            int64_t end, int flat_tid_211936,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235999
    *futhark_mc_segmap_parloop_struct_235999 =
    (struct futhark_mc_segmap_parloop_struct_235999 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235999->ctx;
    uint64_t futhark_mc_segmap_parloop_236000_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236000_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_235999->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_235999->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_segmap_parloop_struct_235999->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_segmap_parloop_struct_235999->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_segmap_parloop_struct_235999->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229018 = start;
    
    for (; iter_229018 < end; iter_229018++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229025 = partition_sizze_203577;
        int64_t gtid_211937 = iter_229018;
        int64_t remnant_229026 = iter_229018 - gtid_211937;
        double defunc_2_reduce_res_211939;
        int64_t flat_tid_229019 = (int64_t) 0;
        int32_t num_tasks_229027;
        
        defunc_2_reduce_res_211939 = 0.0;
        
        struct futhark_mc_task_236001 futhark_mc_task_236001;
        
        futhark_mc_task_236001.ctx = ctx;
        futhark_mc_task_236001.free_lifted_single_ma_l_arg_204134 =
            lifted_single_ma_l_arg_204134;
        futhark_mc_task_236001.free_gtid_211937 = gtid_211937;
        futhark_mc_task_236001.free_mem_219243 = mem_219243.mem;
        futhark_mc_task_236001.retval_defunc_2_reduce_res_211939 =
            &defunc_2_reduce_res_211939;
        
        struct scheduler_segop futhark_mc_task_236001_task;
        
        futhark_mc_task_236001_task.args = &futhark_mc_task_236001;
        futhark_mc_task_236001_task.top_level_fn =
            futhark_mc_segred_task_236002;
        futhark_mc_task_236001_task.name = "futhark_mc_segred_task_236002";
        futhark_mc_task_236001_task.iterations = n_p_203492;
        futhark_mc_task_236001_task.task_time =
            &ctx->futhark_mc_segred_task_236002_total_time;
        futhark_mc_task_236001_task.task_iter =
            &ctx->futhark_mc_segred_task_236002_total_iter;
        futhark_mc_task_236001_task.sched = STATIC;
        futhark_mc_task_236001_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236002_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236001_task);
        
        if (futhark_mc_segred_task_236002_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219246.mem)[gtid_211937] = defunc_2_reduce_res_211939;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236000_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236000_end -
                 futhark_mc_segmap_parloop_236000_start;
        
        ctx->futhark_mc_segmap_parloop_236000_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236000_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236000_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235998(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211936 = tid;
    int num_tasks_229009 = info.nsubtasks;
    struct futhark_mc_task_235994 *futhark_mc_task_235994 =
                                  (struct futhark_mc_task_235994 *) args;
    struct futhark_context *ctx = futhark_mc_task_235994->ctx;
    uint64_t futhark_mc_segmap_nested_task_235998_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235998_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_235994->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_235994->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_235994->free_lifted_single_ma_l_arg_204134;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_235994->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_task_235994->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t iter_229018;
    struct futhark_mc_segmap_parloop_struct_235999
    futhark_mc_segmap_parloop_struct_235999;
    
    futhark_mc_segmap_parloop_struct_235999.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235999.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_235999.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_235999.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_segmap_parloop_struct_235999.free_mem_219243 = mem_219243.mem;
    futhark_mc_segmap_parloop_struct_235999.free_mem_219246 = mem_219246.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236000_task;
    
    futhark_mc_segmap_parloop_236000_task.name =
        "futhark_mc_segmap_parloop_236000";
    futhark_mc_segmap_parloop_236000_task.fn = futhark_mc_segmap_parloop_236000;
    futhark_mc_segmap_parloop_236000_task.args =
        &futhark_mc_segmap_parloop_struct_235999;
    futhark_mc_segmap_parloop_236000_task.iterations = iterations;
    futhark_mc_segmap_parloop_236000_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236000_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236000_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236000_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236000_task);
    
    if (futhark_mc_segmap_parloop_236000_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236000_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236000_total_end -
                 futhark_mc_segmap_parloop_236000_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236000_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236000_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236000_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235998_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235998_end -
                 futhark_mc_segmap_nested_task_235998_start;
        
        ctx->futhark_mc_segmap_nested_task_235998_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235998_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235998_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236006 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_partition_sizze_203577;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219246;
    int64_t free_bytes_219248;
    unsigned char *free_mem_219268;
};
struct futhark_mc_segmap_parloop_struct_236008 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_partition_sizze_203577;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219246;
    int64_t free_bytes_219248;
    unsigned char *free_mem_219268;
};
static int futhark_mc_segmap_parloop_236009(void *args, int64_t start,
                                            int64_t end, int flat_tid_211946,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236008
    *futhark_mc_segmap_parloop_struct_236008 =
    (struct futhark_mc_segmap_parloop_struct_236008 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236008->ctx;
    uint64_t futhark_mc_segmap_parloop_236009_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236009_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_236008->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_segmap_parloop_struct_236008->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236008->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_segmap_parloop_struct_236008->free_lifted_single_ma_l_arg_204134;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_segmap_parloop_struct_236008->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_segmap_parloop_struct_236008->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_segmap_parloop_struct_236008->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t bytes_219248 =
            futhark_mc_segmap_parloop_struct_236008->free_bytes_219248;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_segmap_parloop_struct_236008->free_mem_219268,
                                  .size =0, .references =NULL};
    size_t mem_219252_cached_sizze_236010 = 0;
    unsigned char *mem_219252 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229037 = start;
    
    if (mem_219252_cached_sizze_236010 < (size_t) bytes_219248) {
        mem_219252 = realloc(mem_219252, bytes_219248);
        mem_219252_cached_sizze_236010 = bytes_219248;
    }
    for (; iter_229037 < end; iter_229037++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229061 = partition_sizze_203577;
        int64_t gtid_211947 = iter_229037;
        int64_t remnant_229062 = iter_229037 - gtid_211947;
        double x_205127;
        
        x_205127 = ((double *) mem_219246.mem)[gtid_211947];
        
        double discard_216481;
        double scanacc_229039 = 0.0;
        
        for (int64_t i_229038 = 0; i_229038 < dyn_lifted_single_ma_l_arg_204144;
             i_229038++) {
            bool cond_229041 = i_229038 == (int64_t) 0;
            double defunc_0_f_res_229042;
            
            if (cond_229041) {
                double defunc_0_f_res_t_res_229043 = x_205127 / i64_res_203507;
                
                defunc_0_f_res_229042 = defunc_0_f_res_t_res_229043;
            } else {
                int64_t x_229044 = add64(n_p_203492, i_229038);
                int64_t i_229045 = sub64(x_229044, (int64_t) 1);
                bool x_229046 = sle64((int64_t) 0, i_229045);
                bool y_229047 = slt64(i_229045, lifted_single_ma_l_arg_204134);
                bool bounds_check_229048 = x_229046 && y_229047;
                bool index_certs_229049;
                
                if (!bounds_check_229048) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229045,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229050;
                
                x_229050 = ((double *) mem_219243.mem)[gtid_211947 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229045];
                
                int64_t i_229051 = sub64(i_229038, (int64_t) 1);
                bool x_229052 = sle64((int64_t) 0, i_229051);
                bool y_229053 = slt64(i_229051, lifted_single_ma_l_arg_204134);
                bool bounds_check_229054 = x_229052 && y_229053;
                bool index_certs_229055;
                
                if (!bounds_check_229054) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229051,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229056;
                
                y_229056 = ((double *) mem_219243.mem)[gtid_211947 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229051];
                
                double x_229057 = x_229050 - y_229056;
                double defunc_0_f_res_f_res_229058 = x_229057 / i64_res_203507;
                
                defunc_0_f_res_229042 = defunc_0_f_res_f_res_229058;
            }
            
            double defunc_1_op_res_229059 = defunc_0_f_res_229042 +
                   scanacc_229039;
            
            ((double *) mem_219252)[i_229038] = defunc_1_op_res_229059;
            
            double scanacc_tmp_229063 = defunc_1_op_res_229059;
            
            scanacc_229039 = scanacc_tmp_229063;
        }
        discard_216481 = scanacc_229039;
        if (dyn_lifted_single_ma_l_arg_204144 * (int64_t) 8 > 0)
            memmove(mem_219268.mem + gtid_211947 *
                    dyn_lifted_single_ma_l_arg_204144 * (int64_t) 8,
                    mem_219252 + (int64_t) 0,
                    dyn_lifted_single_ma_l_arg_204144 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219252);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236009_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236009_end -
                 futhark_mc_segmap_parloop_236009_start;
        
        ctx->futhark_mc_segmap_parloop_236009_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236009_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236009_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236007(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211946 = tid;
    int num_tasks_229036 = info.nsubtasks;
    struct futhark_mc_task_236006 *futhark_mc_task_236006 =
                                  (struct futhark_mc_task_236006 *) args;
    struct futhark_context *ctx = futhark_mc_task_236006->ctx;
    uint64_t futhark_mc_segmap_task_236007_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236007_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_236006->free_n_p_203492;
    double i64_res_203507 = futhark_mc_task_236006->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236006->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_236006->free_lifted_single_ma_l_arg_204134;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236006->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_236006->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_task_236006->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t bytes_219248 = futhark_mc_task_236006->free_bytes_219248;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236006->free_mem_219268,
                                  .size =0, .references =NULL};
    int64_t iter_229037;
    struct futhark_mc_segmap_parloop_struct_236008
    futhark_mc_segmap_parloop_struct_236008;
    
    futhark_mc_segmap_parloop_struct_236008.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236008.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_236008.free_i64_res_203507 =
        i64_res_203507;
    futhark_mc_segmap_parloop_struct_236008.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236008.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_segmap_parloop_struct_236008.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_segmap_parloop_struct_236008.free_mem_219243 = mem_219243.mem;
    futhark_mc_segmap_parloop_struct_236008.free_mem_219246 = mem_219246.mem;
    futhark_mc_segmap_parloop_struct_236008.free_bytes_219248 = bytes_219248;
    futhark_mc_segmap_parloop_struct_236008.free_mem_219268 = mem_219268.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236009_task;
    
    futhark_mc_segmap_parloop_236009_task.name =
        "futhark_mc_segmap_parloop_236009";
    futhark_mc_segmap_parloop_236009_task.fn = futhark_mc_segmap_parloop_236009;
    futhark_mc_segmap_parloop_236009_task.args =
        &futhark_mc_segmap_parloop_struct_236008;
    futhark_mc_segmap_parloop_236009_task.iterations = iterations;
    futhark_mc_segmap_parloop_236009_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236009_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236009_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236009_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236009_task);
    
    if (futhark_mc_segmap_parloop_236009_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236009_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236009_total_end -
                 futhark_mc_segmap_parloop_236009_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236009_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236009_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236009_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236007_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236007_end -
                 futhark_mc_segmap_task_236007_start;
        
        ctx->futhark_mc_segmap_task_236007_runs[tid]++;
        ctx->futhark_mc_segmap_task_236007_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236007_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236012 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_partition_sizze_203577;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219246;
    int64_t free_bytes_219248;
    unsigned char *free_mem_219268;
};
struct futhark_mc_task_236015 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_gtid_211953;
    double free_x_211955;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219249;
};
struct futhark_mc_scan_stage_1_parloop_struct_236018 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_gtid_211953;
    double free_x_211955;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219249;
};
static int futhark_mc_scan_stage_1_parloop_236019(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229066, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_236018
    *futhark_mc_scan_stage_1_parloop_struct_236018 =
    (struct futhark_mc_scan_stage_1_parloop_struct_236018 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_236018->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_236019_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236019_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_scan_stage_1_parloop_struct_236018->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_scan_stage_1_parloop_struct_236018->free_i64_res_203507;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_scan_stage_1_parloop_struct_236018->free_lifted_single_ma_l_arg_204134;
    int64_t gtid_211953 =
            futhark_mc_scan_stage_1_parloop_struct_236018->free_gtid_211953;
    double x_211955 =
           futhark_mc_scan_stage_1_parloop_struct_236018->free_x_211955;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236018->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219249 = {.desc ="mem_219249", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236018->free_mem_219249,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229092 = start;
    double x_229068;
    double x_229069;
    
    x_229068 = 0.0;
    for (; iter_229092 < end; iter_229092++) {
        int64_t gtid_229067 = iter_229092;
        
        // stage 1 scan body
        {
            bool cond_229071 = gtid_229067 == (int64_t) 0;
            double defunc_0_f_res_229072;
            
            if (cond_229071) {
                double defunc_0_f_res_t_res_229073 = x_211955 / i64_res_203507;
                
                defunc_0_f_res_229072 = defunc_0_f_res_t_res_229073;
            } else {
                int64_t x_229074 = add64(n_p_203492, gtid_229067);
                int64_t i_229075 = sub64(x_229074, (int64_t) 1);
                bool x_229076 = sle64((int64_t) 0, i_229075);
                bool y_229077 = slt64(i_229075, lifted_single_ma_l_arg_204134);
                bool bounds_check_229078 = x_229076 && y_229077;
                bool index_certs_229079;
                
                if (!bounds_check_229078) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229075,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229080;
                
                x_229080 = ((double *) mem_219243.mem)[gtid_211953 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229075];
                
                int64_t i_229081 = sub64(gtid_229067, (int64_t) 1);
                bool x_229082 = sle64((int64_t) 0, i_229081);
                bool y_229083 = slt64(i_229081, lifted_single_ma_l_arg_204134);
                bool bounds_check_229084 = x_229082 && y_229083;
                bool index_certs_229085;
                
                if (!bounds_check_229084) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229081,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229086;
                
                y_229086 = ((double *) mem_219243.mem)[gtid_211953 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229081];
                
                double x_229087 = x_229080 - y_229086;
                double defunc_0_f_res_f_res_229088 = x_229087 / i64_res_203507;
                
                defunc_0_f_res_229072 = defunc_0_f_res_f_res_229088;
            }
            // write mapped values results to memory
            { }
            x_229068 = x_229068;
            // Read next values
            {
                x_229069 = defunc_0_f_res_229072;
            }
            
            double defunc_1_op_res_229070 = x_229068 + x_229069;
            
            ((double *) mem_219249.mem)[gtid_229067] = defunc_1_op_res_229070;
            x_229068 = defunc_1_op_res_229070;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236019_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236019_end -
                 futhark_mc_scan_stage_1_parloop_236019_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_236019_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_236019_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_236019_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_236020 {
    struct futhark_context *ctx;
    int64_t free_n_p_203492;
    double free_i64_res_203507;
    int64_t free_lifted_single_ma_l_arg_204134;
    int64_t free_gtid_211953;
    double free_x_211955;
    unsigned char *free_mem_219243;
    unsigned char *free_mem_219249;
};
static int futhark_mc_scan_stage_3_parloop_236021(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229066, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_236020
    *futhark_mc_scan_stage_3_parloop_struct_236020 =
    (struct futhark_mc_scan_stage_3_parloop_struct_236020 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_236020->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_236021_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_236021_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_scan_stage_3_parloop_struct_236020->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_scan_stage_3_parloop_struct_236020->free_i64_res_203507;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_scan_stage_3_parloop_struct_236020->free_lifted_single_ma_l_arg_204134;
    int64_t gtid_211953 =
            futhark_mc_scan_stage_3_parloop_struct_236020->free_gtid_211953;
    double x_211955 =
           futhark_mc_scan_stage_3_parloop_struct_236020->free_x_211955;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236020->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219249 = {.desc ="mem_219249", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236020->free_mem_219249,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229104 = start;
    double x_229101;
    double x_229102;
    
    if (iter_229104 == (int64_t) 0) {
        x_229101 = 0.0;
    } else {
        x_229101 = ((double *) mem_219249.mem)[iter_229104 - (int64_t) 1];
    }
    for (; iter_229104 < end; iter_229104++) {
        int64_t gtid_229067 = iter_229104;
        
        // stage 3 scan body
        {
            bool cond_229071 = gtid_229067 == (int64_t) 0;
            double defunc_0_f_res_229072;
            
            if (cond_229071) {
                double defunc_0_f_res_t_res_229073 = x_211955 / i64_res_203507;
                
                defunc_0_f_res_229072 = defunc_0_f_res_t_res_229073;
            } else {
                int64_t x_229074 = add64(n_p_203492, gtid_229067);
                int64_t i_229075 = sub64(x_229074, (int64_t) 1);
                bool x_229076 = sle64((int64_t) 0, i_229075);
                bool y_229077 = slt64(i_229075, lifted_single_ma_l_arg_204134);
                bool bounds_check_229078 = x_229076 && y_229077;
                bool index_certs_229079;
                
                if (!bounds_check_229078) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229075,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229080;
                
                x_229080 = ((double *) mem_219243.mem)[gtid_211953 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229075];
                
                int64_t i_229081 = sub64(gtid_229067, (int64_t) 1);
                bool x_229082 = sle64((int64_t) 0, i_229081);
                bool y_229083 = slt64(i_229081, lifted_single_ma_l_arg_204134);
                bool bounds_check_229084 = x_229082 && y_229083;
                bool index_certs_229085;
                
                if (!bounds_check_229084) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229081,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229086;
                
                y_229086 = ((double *) mem_219243.mem)[gtid_211953 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229081];
                
                double x_229087 = x_229080 - y_229086;
                double defunc_0_f_res_f_res_229088 = x_229087 / i64_res_203507;
                
                defunc_0_f_res_229072 = defunc_0_f_res_f_res_229088;
            }
            x_229101 = x_229101;
            x_229102 = defunc_0_f_res_229072;
            
            double defunc_1_op_res_229103 = x_229101 + x_229102;
            
            ((double *) mem_219249.mem)[gtid_229067] = defunc_1_op_res_229103;
            x_229101 = defunc_1_op_res_229103;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_236021_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_236021_end -
                 futhark_mc_scan_stage_3_parloop_236021_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_236021_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_236021_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_236021_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_236016(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229066 = tid;
    int num_tasks_229091 = info.nsubtasks;
    struct futhark_mc_task_236015 *futhark_mc_task_236015 =
                                  (struct futhark_mc_task_236015 *) args;
    struct futhark_context *ctx = futhark_mc_task_236015->ctx;
    uint64_t futhark_mc_segscan_task_236016_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_236016_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_236015->free_n_p_203492;
    double i64_res_203507 = futhark_mc_task_236015->free_i64_res_203507;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_236015->free_lifted_single_ma_l_arg_204134;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236015->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t gtid_211953 = futhark_mc_task_236015->free_gtid_211953;
    double x_211955 = futhark_mc_task_236015->free_x_211955;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_236015->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219249 = {.desc ="mem_219249", .mem =
                                  futhark_mc_task_236015->free_mem_219249,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_229098_cached_sizze_236017 = 0;
    unsigned char *scan_stage_2_accum_mem_229098 = NULL;
    int64_t iter_229092;
    struct futhark_mc_scan_stage_1_parloop_struct_236018
    futhark_mc_scan_stage_1_parloop_struct_236018;
    
    futhark_mc_scan_stage_1_parloop_struct_236018.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_236018.free_n_p_203492 = n_p_203492;
    futhark_mc_scan_stage_1_parloop_struct_236018.free_i64_res_203507 =
        i64_res_203507;
    futhark_mc_scan_stage_1_parloop_struct_236018.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_scan_stage_1_parloop_struct_236018.free_gtid_211953 =
        gtid_211953;
    futhark_mc_scan_stage_1_parloop_struct_236018.free_x_211955 = x_211955;
    futhark_mc_scan_stage_1_parloop_struct_236018.free_mem_219243 =
        mem_219243.mem;
    futhark_mc_scan_stage_1_parloop_struct_236018.free_mem_219249 =
        mem_219249.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_236019_task;
    
    futhark_mc_scan_stage_1_parloop_236019_task.name =
        "futhark_mc_scan_stage_1_parloop_236019";
    futhark_mc_scan_stage_1_parloop_236019_task.fn =
        futhark_mc_scan_stage_1_parloop_236019;
    futhark_mc_scan_stage_1_parloop_236019_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_236018;
    futhark_mc_scan_stage_1_parloop_236019_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_236019_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_236019_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236019_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_236019_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_236019_task);
    
    if (futhark_mc_scan_stage_1_parloop_236019_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236019_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236019_total_end -
                 futhark_mc_scan_stage_1_parloop_236019_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236019_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236019_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236019_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_229091)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        double x_229093;
        double x_229094;
        int64_t offset_229096 = (int64_t) 0;
        int64_t offset_index_229097 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_229098_cached_sizze_236017 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_229098 =
                realloc(scan_stage_2_accum_mem_229098, (int64_t) 8);
            scan_stage_2_accum_mem_229098_cached_sizze_236017 = (int64_t) 8;
        }
        ((double *) scan_stage_2_accum_mem_229098)[(int64_t) 0] = 0.0;
        for (int32_t i_229100 = 0; i_229100 < num_tasks_229091 - 1;
             i_229100++) {
            offset_229096 = squot64(dyn_lifted_single_ma_l_arg_204144,
                                    sext_i32_i64(num_tasks_229091));
            if (slt64(sext_i32_i64(i_229100),
                      srem64(dyn_lifted_single_ma_l_arg_204144,
                             sext_i32_i64(num_tasks_229091)))) {
                offset_229096 += (int64_t) 1;
            }
            offset_index_229097 += offset_229096;
            
            int64_t gtid_229067 = offset_index_229097;
            bool cond_229071 = gtid_229067 == (int64_t) 0;
            double defunc_0_f_res_229072;
            
            if (cond_229071) {
                double defunc_0_f_res_t_res_229073 = x_211955 / i64_res_203507;
                
                defunc_0_f_res_229072 = defunc_0_f_res_t_res_229073;
            } else {
                int64_t x_229074 = add64(n_p_203492, gtid_229067);
                int64_t i_229075 = sub64(x_229074, (int64_t) 1);
                bool x_229076 = sle64((int64_t) 0, i_229075);
                bool y_229077 = slt64(i_229075, lifted_single_ma_l_arg_204134);
                bool bounds_check_229078 = x_229076 && y_229077;
                bool index_certs_229079;
                
                if (!bounds_check_229078) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229075,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229080;
                
                x_229080 = ((double *) mem_219243.mem)[gtid_211953 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229075];
                
                int64_t i_229081 = sub64(gtid_229067, (int64_t) 1);
                bool x_229082 = sle64((int64_t) 0, i_229081);
                bool y_229083 = slt64(i_229081, lifted_single_ma_l_arg_204134);
                bool bounds_check_229084 = x_229082 && y_229083;
                bool index_certs_229085;
                
                if (!bounds_check_229084) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229081,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204134,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-64\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229086;
                
                y_229086 = ((double *) mem_219243.mem)[gtid_211953 *
                                                       lifted_single_ma_l_arg_204134 +
                                                       i_229081];
                
                double x_229087 = x_229080 - y_229086;
                double defunc_0_f_res_f_res_229088 = x_229087 / i64_res_203507;
                
                defunc_0_f_res_229072 = defunc_0_f_res_f_res_229088;
            }
            // Read carry in
            {
                x_229093 =
                    ((double *) scan_stage_2_accum_mem_229098)[(int64_t) 0];
            }
            // Read next values
            {
                x_229094 = ((double *) mem_219249.mem)[offset_index_229097 -
                                                       (int64_t) 1];
            }
            
            double defunc_1_op_res_229095 = x_229093 + x_229094;
            
            ((double *) mem_219249.mem)[offset_index_229097 - (int64_t) 1] =
                defunc_1_op_res_229095;
            ((double *) scan_stage_2_accum_mem_229098)[(int64_t) 0] =
                defunc_1_op_res_229095;
        }
        
        int64_t iter_229104 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_236020
        futhark_mc_scan_stage_3_parloop_struct_236020;
        
        futhark_mc_scan_stage_3_parloop_struct_236020.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_236020.free_n_p_203492 =
            n_p_203492;
        futhark_mc_scan_stage_3_parloop_struct_236020.free_i64_res_203507 =
            i64_res_203507;
        futhark_mc_scan_stage_3_parloop_struct_236020.free_lifted_single_ma_l_arg_204134 =
            lifted_single_ma_l_arg_204134;
        futhark_mc_scan_stage_3_parloop_struct_236020.free_gtid_211953 =
            gtid_211953;
        futhark_mc_scan_stage_3_parloop_struct_236020.free_x_211955 = x_211955;
        futhark_mc_scan_stage_3_parloop_struct_236020.free_mem_219243 =
            mem_219243.mem;
        futhark_mc_scan_stage_3_parloop_struct_236020.free_mem_219249 =
            mem_219249.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_236021_task;
        
        futhark_mc_scan_stage_3_parloop_236021_task.name =
            "futhark_mc_scan_stage_3_parloop_236021";
        futhark_mc_scan_stage_3_parloop_236021_task.fn =
            futhark_mc_scan_stage_3_parloop_236021;
        futhark_mc_scan_stage_3_parloop_236021_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_236020;
        futhark_mc_scan_stage_3_parloop_236021_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_236021_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_236021_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_236021_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_236021_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_236021_task);
        
        if (futhark_mc_scan_stage_3_parloop_236021_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_236021_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_236021_total_end -
                     futhark_mc_scan_stage_3_parloop_236021_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236021_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236021_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236021_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_229098);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_236016_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_236016_end -
                 futhark_mc_segscan_task_236016_start;
        
        ctx->futhark_mc_segscan_task_236016_runs[tid]++;
        ctx->futhark_mc_segscan_task_236016_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_236016_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236013(void *args, int64_t start,
                                            int64_t end, int flat_tid_211952,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236012
    *futhark_mc_segmap_parloop_struct_236012 =
    (struct futhark_mc_segmap_parloop_struct_236012 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236012->ctx;
    uint64_t futhark_mc_segmap_parloop_236013_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236013_start = get_wall_time();
    
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_236012->free_n_p_203492;
    double i64_res_203507 =
           futhark_mc_segmap_parloop_struct_236012->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236012->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_segmap_parloop_struct_236012->free_lifted_single_ma_l_arg_204134;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_segmap_parloop_struct_236012->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_segmap_parloop_struct_236012->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_segmap_parloop_struct_236012->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t bytes_219248 =
            futhark_mc_segmap_parloop_struct_236012->free_bytes_219248;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_segmap_parloop_struct_236012->free_mem_219268,
                                  .size =0, .references =NULL};
    size_t mem_219249_cached_sizze_236014 = 0;
    unsigned char *mem_219249 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229065 = start;
    
    if (mem_219249_cached_sizze_236014 < (size_t) bytes_219248) {
        mem_219249 = realloc(mem_219249, bytes_219248);
        mem_219249_cached_sizze_236014 = bytes_219248;
    }
    for (; iter_229065 < end; iter_229065++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229089 = partition_sizze_203577;
        int64_t gtid_211953 = iter_229065;
        int64_t remnant_229090 = iter_229065 - gtid_211953;
        double x_211955;
        
        x_211955 = ((double *) mem_219246.mem)[gtid_211953];
        
        int64_t flat_tid_229066 = (int64_t) 0;
        int32_t num_tasks_229091;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_236015 futhark_mc_task_236015;
        
        futhark_mc_task_236015.ctx = ctx;
        futhark_mc_task_236015.free_n_p_203492 = n_p_203492;
        futhark_mc_task_236015.free_i64_res_203507 = i64_res_203507;
        futhark_mc_task_236015.free_lifted_single_ma_l_arg_204134 =
            lifted_single_ma_l_arg_204134;
        futhark_mc_task_236015.free_dyn_lifted_single_ma_l_arg_204144 =
            dyn_lifted_single_ma_l_arg_204144;
        futhark_mc_task_236015.free_gtid_211953 = gtid_211953;
        futhark_mc_task_236015.free_x_211955 = x_211955;
        futhark_mc_task_236015.free_mem_219243 = mem_219243.mem;
        futhark_mc_task_236015.free_mem_219249 = mem_219249;
        
        struct scheduler_segop futhark_mc_task_236015_task;
        
        futhark_mc_task_236015_task.args = &futhark_mc_task_236015;
        futhark_mc_task_236015_task.top_level_fn =
            futhark_mc_segscan_task_236016;
        futhark_mc_task_236015_task.name = "futhark_mc_segscan_task_236016";
        futhark_mc_task_236015_task.iterations =
            dyn_lifted_single_ma_l_arg_204144;
        futhark_mc_task_236015_task.task_time =
            &ctx->futhark_mc_segscan_task_236016_total_time;
        futhark_mc_task_236015_task.task_iter =
            &ctx->futhark_mc_segscan_task_236016_total_iter;
        futhark_mc_task_236015_task.sched = STATIC;
        futhark_mc_task_236015_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_236016_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236015_task);
        
        if (futhark_mc_segscan_task_236016_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (dyn_lifted_single_ma_l_arg_204144 * (int64_t) 8 > 0)
            memmove(mem_219268.mem + gtid_211953 *
                    dyn_lifted_single_ma_l_arg_204144 * (int64_t) 8,
                    mem_219249 + (int64_t) 0,
                    dyn_lifted_single_ma_l_arg_204144 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219249);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236013_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236013_end -
                 futhark_mc_segmap_parloop_236013_start;
        
        ctx->futhark_mc_segmap_parloop_236013_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236013_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236013_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236011(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211952 = tid;
    int num_tasks_229036 = info.nsubtasks;
    struct futhark_mc_task_236006 *futhark_mc_task_236006 =
                                  (struct futhark_mc_task_236006 *) args;
    struct futhark_context *ctx = futhark_mc_task_236006->ctx;
    uint64_t futhark_mc_segmap_nested_task_236011_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236011_start = get_wall_time();
    
    int64_t n_p_203492 = futhark_mc_task_236006->free_n_p_203492;
    double i64_res_203507 = futhark_mc_task_236006->free_i64_res_203507;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236006->free_partition_sizze_203577;
    int64_t lifted_single_ma_l_arg_204134 =
            futhark_mc_task_236006->free_lifted_single_ma_l_arg_204134;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236006->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219243 = {.desc ="mem_219243", .mem =
                                  futhark_mc_task_236006->free_mem_219243,
                                  .size =0, .references =NULL};
    struct memblock mem_219246 = {.desc ="mem_219246", .mem =
                                  futhark_mc_task_236006->free_mem_219246,
                                  .size =0, .references =NULL};
    int64_t bytes_219248 = futhark_mc_task_236006->free_bytes_219248;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236006->free_mem_219268,
                                  .size =0, .references =NULL};
    int64_t iter_229065;
    struct futhark_mc_segmap_parloop_struct_236012
    futhark_mc_segmap_parloop_struct_236012;
    
    futhark_mc_segmap_parloop_struct_236012.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236012.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_236012.free_i64_res_203507 =
        i64_res_203507;
    futhark_mc_segmap_parloop_struct_236012.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236012.free_lifted_single_ma_l_arg_204134 =
        lifted_single_ma_l_arg_204134;
    futhark_mc_segmap_parloop_struct_236012.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_segmap_parloop_struct_236012.free_mem_219243 = mem_219243.mem;
    futhark_mc_segmap_parloop_struct_236012.free_mem_219246 = mem_219246.mem;
    futhark_mc_segmap_parloop_struct_236012.free_bytes_219248 = bytes_219248;
    futhark_mc_segmap_parloop_struct_236012.free_mem_219268 = mem_219268.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236013_task;
    
    futhark_mc_segmap_parloop_236013_task.name =
        "futhark_mc_segmap_parloop_236013";
    futhark_mc_segmap_parloop_236013_task.fn = futhark_mc_segmap_parloop_236013;
    futhark_mc_segmap_parloop_236013_task.args =
        &futhark_mc_segmap_parloop_struct_236012;
    futhark_mc_segmap_parloop_236013_task.iterations = iterations;
    futhark_mc_segmap_parloop_236013_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236013_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236013_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236013_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236013_task);
    
    if (futhark_mc_segmap_parloop_236013_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236013_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236013_total_end -
                 futhark_mc_segmap_parloop_236013_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236013_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236013_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236013_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236011_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236011_end -
                 futhark_mc_segmap_nested_task_236011_start;
        
        ctx->futhark_mc_segmap_nested_task_236011_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236011_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236011_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236022 {
    struct futhark_context *ctx;
    int64_t free_partition_sizze_203577;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219271;
};
struct futhark_mc_segmap_parloop_struct_236024 {
    struct futhark_context *ctx;
    int64_t free_partition_sizze_203577;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219271;
};
static int futhark_mc_segmap_parloop_236025(void *args, int64_t start,
                                            int64_t end, int flat_tid_211981,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236024
    *futhark_mc_segmap_parloop_struct_236024 =
    (struct futhark_mc_segmap_parloop_struct_236024 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236024->ctx;
    uint64_t futhark_mc_segmap_parloop_236025_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236025_start = get_wall_time();
    
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236024->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_segmap_parloop_struct_236024->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_segmap_parloop_struct_236024->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_segmap_parloop_struct_236024->free_mem_219271,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229106 = start;
    
    for (; iter_229106 < end; iter_229106++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229112 = partition_sizze_203577;
        int64_t gtid_211982 = iter_229106;
        int64_t remnant_229113 = iter_229106 - gtid_211982;
        double defunc_2_reduce_res_205155;
        double redout_229108 = 0.0;
        
        for (int32_t i_229107 = 0; i_229107 < 3; i_229107++) {
            int64_t i_229109 = sext_i32_i64(i_229107);
            double x_229110;
            
            x_229110 = ((double *) mem_219268.mem)[gtid_211982 *
                                                   dyn_lifted_single_ma_l_arg_204144 +
                                                   i_229109];
            
            double defunc_1_op_res_229111 = x_229110 + redout_229108;
            double redout_tmp_229114 = defunc_1_op_res_229111;
            
            redout_229108 = redout_tmp_229114;
        }
        defunc_2_reduce_res_205155 = redout_229108;
        ((double *) mem_219271.mem)[gtid_211982] = defunc_2_reduce_res_205155;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236025_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236025_end -
                 futhark_mc_segmap_parloop_236025_start;
        
        ctx->futhark_mc_segmap_parloop_236025_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236025_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236025_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236023(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211981 = tid;
    int num_tasks_229105 = info.nsubtasks;
    struct futhark_mc_task_236022 *futhark_mc_task_236022 =
                                  (struct futhark_mc_task_236022 *) args;
    struct futhark_context *ctx = futhark_mc_task_236022->ctx;
    uint64_t futhark_mc_segmap_task_236023_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236023_start = get_wall_time();
    
    int64_t partition_sizze_203577 =
            futhark_mc_task_236022->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236022->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236022->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_task_236022->free_mem_219271,
                                  .size =0, .references =NULL};
    int64_t iter_229106;
    struct futhark_mc_segmap_parloop_struct_236024
    futhark_mc_segmap_parloop_struct_236024;
    
    futhark_mc_segmap_parloop_struct_236024.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236024.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236024.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_segmap_parloop_struct_236024.free_mem_219268 = mem_219268.mem;
    futhark_mc_segmap_parloop_struct_236024.free_mem_219271 = mem_219271.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236025_task;
    
    futhark_mc_segmap_parloop_236025_task.name =
        "futhark_mc_segmap_parloop_236025";
    futhark_mc_segmap_parloop_236025_task.fn = futhark_mc_segmap_parloop_236025;
    futhark_mc_segmap_parloop_236025_task.args =
        &futhark_mc_segmap_parloop_struct_236024;
    futhark_mc_segmap_parloop_236025_task.iterations = iterations;
    futhark_mc_segmap_parloop_236025_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236025_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236025_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236025_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236025_task);
    
    if (futhark_mc_segmap_parloop_236025_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236025_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236025_total_end -
                 futhark_mc_segmap_parloop_236025_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236025_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236025_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236025_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236023_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236023_end -
                 futhark_mc_segmap_task_236023_start;
        
        ctx->futhark_mc_segmap_task_236023_runs[tid]++;
        ctx->futhark_mc_segmap_task_236023_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236023_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236027 {
    struct futhark_context *ctx;
    int64_t free_partition_sizze_203577;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219271;
};
struct futhark_mc_task_236029 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_gtid_211988;
    unsigned char *free_mem_219268;
    double *retval_defunc_2_reduce_res_211990;
};
struct futhark_mc_segred_stage_1_parloop_struct_236032 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_gtid_211988;
    unsigned char *free_mem_219268;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229125;
};
static int futhark_mc_segred_stage_1_parloop_236033(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229116,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236032
    *futhark_mc_segred_stage_1_parloop_struct_236032 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236032 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236032->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236033_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236033_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_segred_stage_1_parloop_struct_236032->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t gtid_211988 =
            futhark_mc_segred_stage_1_parloop_struct_236032->free_gtid_211988;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236032->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229125 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229125",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236032->free_reduce_stage_1_tid_res_arr_mem_229125,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229127 = start;
    double x_229118;
    double x_229119;
    double local_acc_229128 = 0.0;
    
    for (; iter_229127 < end; iter_229127++) {
        int64_t gtid_229117 = iter_229127;
        double x_229121;
        
        x_229121 = ((double *) mem_219268.mem)[gtid_211988 *
                                               dyn_lifted_single_ma_l_arg_204144 +
                                               gtid_229117];
        // save map-out results
        { }
        // Load accum params
        {
            x_229118 = local_acc_229128;
        }
        // Load next params
        {
            x_229119 = x_229121;
        }
        // Red body
        {
            double defunc_1_op_res_229120 = x_229118 + x_229119;
            
            local_acc_229128 = defunc_1_op_res_229120;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229125.mem)[flat_tid_229116] =
        local_acc_229128;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236033_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236033_end -
                 futhark_mc_segred_stage_1_parloop_236033_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236033_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236033_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236033_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236030(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229116 = tid;
    int num_tasks_229124 = info.nsubtasks;
    struct futhark_mc_task_236029 *futhark_mc_task_236029 =
                                  (struct futhark_mc_task_236029 *) args;
    struct futhark_context *ctx = futhark_mc_task_236029->ctx;
    uint64_t futhark_mc_segred_task_236030_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236030_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236029->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t gtid_211988 = futhark_mc_task_236029->free_gtid_211988;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236029->free_mem_219268,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_211990 =
           *futhark_mc_task_236029->retval_defunc_2_reduce_res_211990;
    size_t reduce_stage_1_tid_res_arr_mem_229125_cached_sizze_236031 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229125 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229125_cached_sizze_236031 <
        (size_t) ((int64_t) 8 * num_tasks_229124)) {
        reduce_stage_1_tid_res_arr_mem_229125 =
            realloc(reduce_stage_1_tid_res_arr_mem_229125, (int64_t) 8 *
                    num_tasks_229124);
        reduce_stage_1_tid_res_arr_mem_229125_cached_sizze_236031 =
            (int64_t) 8 * num_tasks_229124;
    }
    
    int64_t iter_229127;
    struct futhark_mc_segred_stage_1_parloop_struct_236032
    futhark_mc_segred_stage_1_parloop_struct_236032;
    
    futhark_mc_segred_stage_1_parloop_struct_236032.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236032.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_segred_stage_1_parloop_struct_236032.free_gtid_211988 =
        gtid_211988;
    futhark_mc_segred_stage_1_parloop_struct_236032.free_mem_219268 =
        mem_219268.mem;
    futhark_mc_segred_stage_1_parloop_struct_236032.free_reduce_stage_1_tid_res_arr_mem_229125 =
        reduce_stage_1_tid_res_arr_mem_229125;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236033_task;
    
    futhark_mc_segred_stage_1_parloop_236033_task.name =
        "futhark_mc_segred_stage_1_parloop_236033";
    futhark_mc_segred_stage_1_parloop_236033_task.fn =
        futhark_mc_segred_stage_1_parloop_236033;
    futhark_mc_segred_stage_1_parloop_236033_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236032;
    futhark_mc_segred_stage_1_parloop_236033_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236033_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236033_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236033_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236033_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236033_task);
    
    if (futhark_mc_segred_stage_1_parloop_236033_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236033_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236033_total_end -
                 futhark_mc_segred_stage_1_parloop_236033_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236033_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236033_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236033_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_211990 = 0.0;
    }
    
    double x_229129;
    double x_229130;
    
    for (int32_t i_229132 = 0; i_229132 < num_tasks_229124; i_229132++) {
        flat_tid_229116 = i_229132;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229129 = defunc_2_reduce_res_211990;
            }
            // load next params
            {
                x_229130 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229125)[flat_tid_229116];
            }
            // red body
            {
                double defunc_1_op_res_229131 = x_229129 + x_229130;
                
                defunc_2_reduce_res_211990 = defunc_1_op_res_229131;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229125);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236030_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236030_end -
                 futhark_mc_segred_task_236030_start;
        
        ctx->futhark_mc_segred_task_236030_runs[tid]++;
        ctx->futhark_mc_segred_task_236030_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236030_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236029->retval_defunc_2_reduce_res_211990 =
            defunc_2_reduce_res_211990;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236028(void *args, int64_t start,
                                            int64_t end, int flat_tid_211987,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236027
    *futhark_mc_segmap_parloop_struct_236027 =
    (struct futhark_mc_segmap_parloop_struct_236027 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236027->ctx;
    uint64_t futhark_mc_segmap_parloop_236028_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236028_start = get_wall_time();
    
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236027->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_segmap_parloop_struct_236027->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_segmap_parloop_struct_236027->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_segmap_parloop_struct_236027->free_mem_219271,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229115 = start;
    
    for (; iter_229115 < end; iter_229115++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229122 = partition_sizze_203577;
        int64_t gtid_211988 = iter_229115;
        int64_t remnant_229123 = iter_229115 - gtid_211988;
        double defunc_2_reduce_res_211990;
        int64_t flat_tid_229116 = (int64_t) 0;
        int32_t num_tasks_229124;
        
        defunc_2_reduce_res_211990 = 0.0;
        
        struct futhark_mc_task_236029 futhark_mc_task_236029;
        
        futhark_mc_task_236029.ctx = ctx;
        futhark_mc_task_236029.free_dyn_lifted_single_ma_l_arg_204144 =
            dyn_lifted_single_ma_l_arg_204144;
        futhark_mc_task_236029.free_gtid_211988 = gtid_211988;
        futhark_mc_task_236029.free_mem_219268 = mem_219268.mem;
        futhark_mc_task_236029.retval_defunc_2_reduce_res_211990 =
            &defunc_2_reduce_res_211990;
        
        struct scheduler_segop futhark_mc_task_236029_task;
        
        futhark_mc_task_236029_task.args = &futhark_mc_task_236029;
        futhark_mc_task_236029_task.top_level_fn =
            futhark_mc_segred_task_236030;
        futhark_mc_task_236029_task.name = "futhark_mc_segred_task_236030";
        futhark_mc_task_236029_task.iterations = (int64_t) 3;
        futhark_mc_task_236029_task.task_time =
            &ctx->futhark_mc_segred_task_236030_total_time;
        futhark_mc_task_236029_task.task_iter =
            &ctx->futhark_mc_segred_task_236030_total_iter;
        futhark_mc_task_236029_task.sched = STATIC;
        futhark_mc_task_236029_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236030_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236029_task);
        
        if (futhark_mc_segred_task_236030_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219271.mem)[gtid_211988] = defunc_2_reduce_res_211990;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236028_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236028_end -
                 futhark_mc_segmap_parloop_236028_start;
        
        ctx->futhark_mc_segmap_parloop_236028_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236028_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236028_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236026(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211987 = tid;
    int num_tasks_229105 = info.nsubtasks;
    struct futhark_mc_task_236022 *futhark_mc_task_236022 =
                                  (struct futhark_mc_task_236022 *) args;
    struct futhark_context *ctx = futhark_mc_task_236022->ctx;
    uint64_t futhark_mc_segmap_nested_task_236026_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236026_start = get_wall_time();
    
    int64_t partition_sizze_203577 =
            futhark_mc_task_236022->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236022->free_dyn_lifted_single_ma_l_arg_204144;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236022->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_task_236022->free_mem_219271,
                                  .size =0, .references =NULL};
    int64_t iter_229115;
    struct futhark_mc_segmap_parloop_struct_236027
    futhark_mc_segmap_parloop_struct_236027;
    
    futhark_mc_segmap_parloop_struct_236027.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236027.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236027.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_segmap_parloop_struct_236027.free_mem_219268 = mem_219268.mem;
    futhark_mc_segmap_parloop_struct_236027.free_mem_219271 = mem_219271.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236028_task;
    
    futhark_mc_segmap_parloop_236028_task.name =
        "futhark_mc_segmap_parloop_236028";
    futhark_mc_segmap_parloop_236028_task.fn = futhark_mc_segmap_parloop_236028;
    futhark_mc_segmap_parloop_236028_task.args =
        &futhark_mc_segmap_parloop_struct_236027;
    futhark_mc_segmap_parloop_236028_task.iterations = iterations;
    futhark_mc_segmap_parloop_236028_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236028_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236028_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236028_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236028_task);
    
    if (futhark_mc_segmap_parloop_236028_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236028_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236028_total_end -
                 futhark_mc_segmap_parloop_236028_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236028_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236028_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236028_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236026_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236026_end -
                 futhark_mc_segmap_nested_task_236026_start;
        
        ctx->futhark_mc_segmap_nested_task_236026_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236026_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236026_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236034 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_bytes_217302;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219271;
    unsigned char *free_mem_219293;
};
struct futhark_mc_segmap_parloop_struct_236036 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_bytes_217302;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219271;
    unsigned char *free_mem_219293;
};
static int futhark_mc_segmap_parloop_236037(void *args, int64_t start,
                                            int64_t end, int flat_tid_211997,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236036
    *futhark_mc_segmap_parloop_struct_236036 =
    (struct futhark_mc_segmap_parloop_struct_236036 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236036->ctx;
    uint64_t futhark_mc_segmap_parloop_236037_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236037_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236036->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236036->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_segmap_parloop_struct_236036->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236036->free_bytes_217302;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_segmap_parloop_struct_236036->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_segmap_parloop_struct_236036->free_mem_219271,
                                  .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236036->free_mem_219293,
                                  .size =0, .references =NULL};
    size_t mem_219277_cached_sizze_236038 = 0;
    unsigned char *mem_219277 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229134 = start;
    
    if (mem_219277_cached_sizze_236038 < (size_t) bytes_217302) {
        mem_219277 = realloc(mem_219277, bytes_217302);
        mem_219277_cached_sizze_236038 = bytes_217302;
    }
    for (; iter_229134 < end; iter_229134++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229158 = partition_sizze_203577;
        int64_t gtid_211998 = iter_229134;
        int64_t remnant_229159 = iter_229134 - gtid_211998;
        double x_205163;
        
        x_205163 = ((double *) mem_219271.mem)[gtid_211998];
        
        double discard_216489;
        double scanacc_229136 = 0.0;
        
        for (int64_t i_229135 = 0; i_229135 < n_203490; i_229135++) {
            bool cond_229138 = i_229135 == (int64_t) 0;
            double defunc_0_f_res_229139;
            
            if (cond_229138) {
                double defunc_0_f_res_t_res_229140 = x_205163 / 3.0;
                
                defunc_0_f_res_229139 = defunc_0_f_res_t_res_229140;
            } else {
                int64_t x_229141 = add64((int64_t) 3, i_229135);
                int64_t i_229142 = sub64(x_229141, (int64_t) 1);
                bool x_229143 = sle64((int64_t) 0, i_229142);
                bool y_229144 = slt64(i_229142,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229145 = x_229143 && y_229144;
                bool index_certs_229146;
                
                if (!bounds_check_229145) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229142,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229147;
                
                x_229147 = ((double *) mem_219268.mem)[gtid_211998 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229142];
                
                int64_t i_229148 = sub64(i_229135, (int64_t) 1);
                bool x_229149 = sle64((int64_t) 0, i_229148);
                bool y_229150 = slt64(i_229148,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229151 = x_229149 && y_229150;
                bool index_certs_229152;
                
                if (!bounds_check_229151) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229148,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229153;
                
                y_229153 = ((double *) mem_219268.mem)[gtid_211998 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229148];
                
                double x_229154 = x_229147 - y_229153;
                double defunc_0_f_res_f_res_229155 = x_229154 / 3.0;
                
                defunc_0_f_res_229139 = defunc_0_f_res_f_res_229155;
            }
            
            double defunc_1_op_res_229156 = defunc_0_f_res_229139 +
                   scanacc_229136;
            
            ((double *) mem_219277)[i_229135] = defunc_1_op_res_229156;
            
            double scanacc_tmp_229160 = defunc_1_op_res_229156;
            
            scanacc_229136 = scanacc_tmp_229160;
        }
        discard_216489 = scanacc_229136;
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_219293.mem + gtid_211998 * n_203490 * (int64_t) 8,
                    mem_219277 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219277);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236037_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236037_end -
                 futhark_mc_segmap_parloop_236037_start;
        
        ctx->futhark_mc_segmap_parloop_236037_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236037_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236037_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236035(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211997 = tid;
    int num_tasks_229133 = info.nsubtasks;
    struct futhark_mc_task_236034 *futhark_mc_task_236034 =
                                  (struct futhark_mc_task_236034 *) args;
    struct futhark_context *ctx = futhark_mc_task_236034->ctx;
    uint64_t futhark_mc_segmap_task_236035_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236035_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236034->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236034->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236034->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t bytes_217302 = futhark_mc_task_236034->free_bytes_217302;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236034->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_task_236034->free_mem_219271,
                                  .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236034->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t iter_229134;
    struct futhark_mc_segmap_parloop_struct_236036
    futhark_mc_segmap_parloop_struct_236036;
    
    futhark_mc_segmap_parloop_struct_236036.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236036.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236036.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236036.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_segmap_parloop_struct_236036.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236036.free_mem_219268 = mem_219268.mem;
    futhark_mc_segmap_parloop_struct_236036.free_mem_219271 = mem_219271.mem;
    futhark_mc_segmap_parloop_struct_236036.free_mem_219293 = mem_219293.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236037_task;
    
    futhark_mc_segmap_parloop_236037_task.name =
        "futhark_mc_segmap_parloop_236037";
    futhark_mc_segmap_parloop_236037_task.fn = futhark_mc_segmap_parloop_236037;
    futhark_mc_segmap_parloop_236037_task.args =
        &futhark_mc_segmap_parloop_struct_236036;
    futhark_mc_segmap_parloop_236037_task.iterations = iterations;
    futhark_mc_segmap_parloop_236037_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236037_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236037_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236037_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236037_task);
    
    if (futhark_mc_segmap_parloop_236037_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236037_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236037_total_end -
                 futhark_mc_segmap_parloop_236037_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236037_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236037_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236037_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236035_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236035_end -
                 futhark_mc_segmap_task_236035_start;
        
        ctx->futhark_mc_segmap_task_236035_runs[tid]++;
        ctx->futhark_mc_segmap_task_236035_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236035_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236040 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_bytes_217302;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219271;
    unsigned char *free_mem_219293;
};
struct futhark_mc_task_236043 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_gtid_212004;
    double free_x_212006;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219274;
};
struct futhark_mc_scan_stage_1_parloop_struct_236046 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_gtid_212004;
    double free_x_212006;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219274;
};
static int futhark_mc_scan_stage_1_parloop_236047(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229163, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_236046
    *futhark_mc_scan_stage_1_parloop_struct_236046 =
    (struct futhark_mc_scan_stage_1_parloop_struct_236046 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_236046->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_236047_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236047_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_scan_stage_1_parloop_struct_236046->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t gtid_212004 =
            futhark_mc_scan_stage_1_parloop_struct_236046->free_gtid_212004;
    double x_212006 =
           futhark_mc_scan_stage_1_parloop_struct_236046->free_x_212006;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236046->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219274 = {.desc ="mem_219274", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236046->free_mem_219274,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229189 = start;
    double x_229165;
    double x_229166;
    
    x_229165 = 0.0;
    for (; iter_229189 < end; iter_229189++) {
        int64_t gtid_229164 = iter_229189;
        
        // stage 1 scan body
        {
            bool cond_229168 = gtid_229164 == (int64_t) 0;
            double defunc_0_f_res_229169;
            
            if (cond_229168) {
                double defunc_0_f_res_t_res_229170 = x_212006 / 3.0;
                
                defunc_0_f_res_229169 = defunc_0_f_res_t_res_229170;
            } else {
                int64_t x_229171 = add64((int64_t) 3, gtid_229164);
                int64_t i_229172 = sub64(x_229171, (int64_t) 1);
                bool x_229173 = sle64((int64_t) 0, i_229172);
                bool y_229174 = slt64(i_229172,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229175 = x_229173 && y_229174;
                bool index_certs_229176;
                
                if (!bounds_check_229175) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229172,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229177;
                
                x_229177 = ((double *) mem_219268.mem)[gtid_212004 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229172];
                
                int64_t i_229178 = sub64(gtid_229164, (int64_t) 1);
                bool x_229179 = sle64((int64_t) 0, i_229178);
                bool y_229180 = slt64(i_229178,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229181 = x_229179 && y_229180;
                bool index_certs_229182;
                
                if (!bounds_check_229181) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229178,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229183;
                
                y_229183 = ((double *) mem_219268.mem)[gtid_212004 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229178];
                
                double x_229184 = x_229177 - y_229183;
                double defunc_0_f_res_f_res_229185 = x_229184 / 3.0;
                
                defunc_0_f_res_229169 = defunc_0_f_res_f_res_229185;
            }
            // write mapped values results to memory
            { }
            x_229165 = x_229165;
            // Read next values
            {
                x_229166 = defunc_0_f_res_229169;
            }
            
            double defunc_1_op_res_229167 = x_229165 + x_229166;
            
            ((double *) mem_219274.mem)[gtid_229164] = defunc_1_op_res_229167;
            x_229165 = defunc_1_op_res_229167;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236047_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236047_end -
                 futhark_mc_scan_stage_1_parloop_236047_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_236047_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_236047_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_236047_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_236048 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204144;
    int64_t free_gtid_212004;
    double free_x_212006;
    unsigned char *free_mem_219268;
    unsigned char *free_mem_219274;
};
static int futhark_mc_scan_stage_3_parloop_236049(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229163, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_236048
    *futhark_mc_scan_stage_3_parloop_struct_236048 =
    (struct futhark_mc_scan_stage_3_parloop_struct_236048 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_236048->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_236049_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_236049_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_scan_stage_3_parloop_struct_236048->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t gtid_212004 =
            futhark_mc_scan_stage_3_parloop_struct_236048->free_gtid_212004;
    double x_212006 =
           futhark_mc_scan_stage_3_parloop_struct_236048->free_x_212006;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236048->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219274 = {.desc ="mem_219274", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236048->free_mem_219274,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229201 = start;
    double x_229198;
    double x_229199;
    
    if (iter_229201 == (int64_t) 0) {
        x_229198 = 0.0;
    } else {
        x_229198 = ((double *) mem_219274.mem)[iter_229201 - (int64_t) 1];
    }
    for (; iter_229201 < end; iter_229201++) {
        int64_t gtid_229164 = iter_229201;
        
        // stage 3 scan body
        {
            bool cond_229168 = gtid_229164 == (int64_t) 0;
            double defunc_0_f_res_229169;
            
            if (cond_229168) {
                double defunc_0_f_res_t_res_229170 = x_212006 / 3.0;
                
                defunc_0_f_res_229169 = defunc_0_f_res_t_res_229170;
            } else {
                int64_t x_229171 = add64((int64_t) 3, gtid_229164);
                int64_t i_229172 = sub64(x_229171, (int64_t) 1);
                bool x_229173 = sle64((int64_t) 0, i_229172);
                bool y_229174 = slt64(i_229172,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229175 = x_229173 && y_229174;
                bool index_certs_229176;
                
                if (!bounds_check_229175) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229172,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229177;
                
                x_229177 = ((double *) mem_219268.mem)[gtid_212004 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229172];
                
                int64_t i_229178 = sub64(gtid_229164, (int64_t) 1);
                bool x_229179 = sle64((int64_t) 0, i_229178);
                bool y_229180 = slt64(i_229178,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229181 = x_229179 && y_229180;
                bool index_certs_229182;
                
                if (!bounds_check_229181) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229178,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229183;
                
                y_229183 = ((double *) mem_219268.mem)[gtid_212004 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229178];
                
                double x_229184 = x_229177 - y_229183;
                double defunc_0_f_res_f_res_229185 = x_229184 / 3.0;
                
                defunc_0_f_res_229169 = defunc_0_f_res_f_res_229185;
            }
            x_229198 = x_229198;
            x_229199 = defunc_0_f_res_229169;
            
            double defunc_1_op_res_229200 = x_229198 + x_229199;
            
            ((double *) mem_219274.mem)[gtid_229164] = defunc_1_op_res_229200;
            x_229198 = defunc_1_op_res_229200;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_236049_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_236049_end -
                 futhark_mc_scan_stage_3_parloop_236049_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_236049_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_236049_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_236049_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_236044(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229163 = tid;
    int num_tasks_229188 = info.nsubtasks;
    struct futhark_mc_task_236043 *futhark_mc_task_236043 =
                                  (struct futhark_mc_task_236043 *) args;
    struct futhark_context *ctx = futhark_mc_task_236043->ctx;
    uint64_t futhark_mc_segscan_task_236044_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_236044_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236043->free_n_203490;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236043->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t gtid_212004 = futhark_mc_task_236043->free_gtid_212004;
    double x_212006 = futhark_mc_task_236043->free_x_212006;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236043->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219274 = {.desc ="mem_219274", .mem =
                                  futhark_mc_task_236043->free_mem_219274,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_229195_cached_sizze_236045 = 0;
    unsigned char *scan_stage_2_accum_mem_229195 = NULL;
    int64_t iter_229189;
    struct futhark_mc_scan_stage_1_parloop_struct_236046
    futhark_mc_scan_stage_1_parloop_struct_236046;
    
    futhark_mc_scan_stage_1_parloop_struct_236046.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_236046.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_scan_stage_1_parloop_struct_236046.free_gtid_212004 =
        gtid_212004;
    futhark_mc_scan_stage_1_parloop_struct_236046.free_x_212006 = x_212006;
    futhark_mc_scan_stage_1_parloop_struct_236046.free_mem_219268 =
        mem_219268.mem;
    futhark_mc_scan_stage_1_parloop_struct_236046.free_mem_219274 =
        mem_219274.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_236047_task;
    
    futhark_mc_scan_stage_1_parloop_236047_task.name =
        "futhark_mc_scan_stage_1_parloop_236047";
    futhark_mc_scan_stage_1_parloop_236047_task.fn =
        futhark_mc_scan_stage_1_parloop_236047;
    futhark_mc_scan_stage_1_parloop_236047_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_236046;
    futhark_mc_scan_stage_1_parloop_236047_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_236047_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_236047_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236047_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_236047_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_236047_task);
    
    if (futhark_mc_scan_stage_1_parloop_236047_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236047_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236047_total_end -
                 futhark_mc_scan_stage_1_parloop_236047_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236047_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236047_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236047_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_229188)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        double x_229190;
        double x_229191;
        int64_t offset_229193 = (int64_t) 0;
        int64_t offset_index_229194 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_229195_cached_sizze_236045 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_229195 =
                realloc(scan_stage_2_accum_mem_229195, (int64_t) 8);
            scan_stage_2_accum_mem_229195_cached_sizze_236045 = (int64_t) 8;
        }
        ((double *) scan_stage_2_accum_mem_229195)[(int64_t) 0] = 0.0;
        for (int32_t i_229197 = 0; i_229197 < num_tasks_229188 - 1;
             i_229197++) {
            offset_229193 = squot64(n_203490, sext_i32_i64(num_tasks_229188));
            if (slt64(sext_i32_i64(i_229197), srem64(n_203490,
                                                     sext_i32_i64(num_tasks_229188)))) {
                offset_229193 += (int64_t) 1;
            }
            offset_index_229194 += offset_229193;
            
            int64_t gtid_229164 = offset_index_229194;
            bool cond_229168 = gtid_229164 == (int64_t) 0;
            double defunc_0_f_res_229169;
            
            if (cond_229168) {
                double defunc_0_f_res_t_res_229170 = x_212006 / 3.0;
                
                defunc_0_f_res_229169 = defunc_0_f_res_t_res_229170;
            } else {
                int64_t x_229171 = add64((int64_t) 3, gtid_229164);
                int64_t i_229172 = sub64(x_229171, (int64_t) 1);
                bool x_229173 = sle64((int64_t) 0, i_229172);
                bool y_229174 = slt64(i_229172,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229175 = x_229173 && y_229174;
                bool index_certs_229176;
                
                if (!bounds_check_229175) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229172,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:23-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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double x_229177;
                
                x_229177 = ((double *) mem_219268.mem)[gtid_212004 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229172];
                
                int64_t i_229178 = sub64(gtid_229164, (int64_t) 1);
                bool x_229179 = sle64((int64_t) 0, i_229178);
                bool y_229180 = slt64(i_229178,
                                      dyn_lifted_single_ma_l_arg_204144);
                bool bounds_check_229181 = x_229179 && y_229180;
                bool index_certs_229182;
                
                if (!bounds_check_229181) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229178,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204144,
                                  "].",
                                  "-> #0  stl.fut:32:40-47\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  stl.fut:27:13-33:19\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:26:5-34:23\n   #8  /prelude/functional.fut:9:42-44\n   #9  stl.fut:38:3-84\n   #10 stl.fut:231:23-47\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double y_229183;
                
                y_229183 = ((double *) mem_219268.mem)[gtid_212004 *
                                                       dyn_lifted_single_ma_l_arg_204144 +
                                                       i_229178];
                
                double x_229184 = x_229177 - y_229183;
                double defunc_0_f_res_f_res_229185 = x_229184 / 3.0;
                
                defunc_0_f_res_229169 = defunc_0_f_res_f_res_229185;
            }
            // Read carry in
            {
                x_229190 =
                    ((double *) scan_stage_2_accum_mem_229195)[(int64_t) 0];
            }
            // Read next values
            {
                x_229191 = ((double *) mem_219274.mem)[offset_index_229194 -
                                                       (int64_t) 1];
            }
            
            double defunc_1_op_res_229192 = x_229190 + x_229191;
            
            ((double *) mem_219274.mem)[offset_index_229194 - (int64_t) 1] =
                defunc_1_op_res_229192;
            ((double *) scan_stage_2_accum_mem_229195)[(int64_t) 0] =
                defunc_1_op_res_229192;
        }
        
        int64_t iter_229201 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_236048
        futhark_mc_scan_stage_3_parloop_struct_236048;
        
        futhark_mc_scan_stage_3_parloop_struct_236048.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_236048.free_dyn_lifted_single_ma_l_arg_204144 =
            dyn_lifted_single_ma_l_arg_204144;
        futhark_mc_scan_stage_3_parloop_struct_236048.free_gtid_212004 =
            gtid_212004;
        futhark_mc_scan_stage_3_parloop_struct_236048.free_x_212006 = x_212006;
        futhark_mc_scan_stage_3_parloop_struct_236048.free_mem_219268 =
            mem_219268.mem;
        futhark_mc_scan_stage_3_parloop_struct_236048.free_mem_219274 =
            mem_219274.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_236049_task;
        
        futhark_mc_scan_stage_3_parloop_236049_task.name =
            "futhark_mc_scan_stage_3_parloop_236049";
        futhark_mc_scan_stage_3_parloop_236049_task.fn =
            futhark_mc_scan_stage_3_parloop_236049;
        futhark_mc_scan_stage_3_parloop_236049_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_236048;
        futhark_mc_scan_stage_3_parloop_236049_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_236049_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_236049_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_236049_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_236049_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_236049_task);
        
        if (futhark_mc_scan_stage_3_parloop_236049_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_236049_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_236049_total_end -
                     futhark_mc_scan_stage_3_parloop_236049_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236049_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236049_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236049_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_229195);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_236044_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_236044_end -
                 futhark_mc_segscan_task_236044_start;
        
        ctx->futhark_mc_segscan_task_236044_runs[tid]++;
        ctx->futhark_mc_segscan_task_236044_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_236044_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236041(void *args, int64_t start,
                                            int64_t end, int flat_tid_212003,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236040
    *futhark_mc_segmap_parloop_struct_236040 =
    (struct futhark_mc_segmap_parloop_struct_236040 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236040->ctx;
    uint64_t futhark_mc_segmap_parloop_236041_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236041_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236040->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236040->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_segmap_parloop_struct_236040->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236040->free_bytes_217302;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_segmap_parloop_struct_236040->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_segmap_parloop_struct_236040->free_mem_219271,
                                  .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236040->free_mem_219293,
                                  .size =0, .references =NULL};
    size_t mem_219274_cached_sizze_236042 = 0;
    unsigned char *mem_219274 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229162 = start;
    
    if (mem_219274_cached_sizze_236042 < (size_t) bytes_217302) {
        mem_219274 = realloc(mem_219274, bytes_217302);
        mem_219274_cached_sizze_236042 = bytes_217302;
    }
    for (; iter_229162 < end; iter_229162++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229186 = partition_sizze_203577;
        int64_t gtid_212004 = iter_229162;
        int64_t remnant_229187 = iter_229162 - gtid_212004;
        double x_212006;
        
        x_212006 = ((double *) mem_219271.mem)[gtid_212004];
        
        int64_t flat_tid_229163 = (int64_t) 0;
        int32_t num_tasks_229188;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_236043 futhark_mc_task_236043;
        
        futhark_mc_task_236043.ctx = ctx;
        futhark_mc_task_236043.free_n_203490 = n_203490;
        futhark_mc_task_236043.free_dyn_lifted_single_ma_l_arg_204144 =
            dyn_lifted_single_ma_l_arg_204144;
        futhark_mc_task_236043.free_gtid_212004 = gtid_212004;
        futhark_mc_task_236043.free_x_212006 = x_212006;
        futhark_mc_task_236043.free_mem_219268 = mem_219268.mem;
        futhark_mc_task_236043.free_mem_219274 = mem_219274;
        
        struct scheduler_segop futhark_mc_task_236043_task;
        
        futhark_mc_task_236043_task.args = &futhark_mc_task_236043;
        futhark_mc_task_236043_task.top_level_fn =
            futhark_mc_segscan_task_236044;
        futhark_mc_task_236043_task.name = "futhark_mc_segscan_task_236044";
        futhark_mc_task_236043_task.iterations = n_203490;
        futhark_mc_task_236043_task.task_time =
            &ctx->futhark_mc_segscan_task_236044_total_time;
        futhark_mc_task_236043_task.task_iter =
            &ctx->futhark_mc_segscan_task_236044_total_iter;
        futhark_mc_task_236043_task.sched = STATIC;
        futhark_mc_task_236043_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_236044_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236043_task);
        
        if (futhark_mc_segscan_task_236044_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_219293.mem + gtid_212004 * n_203490 * (int64_t) 8,
                    mem_219274 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219274);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236041_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236041_end -
                 futhark_mc_segmap_parloop_236041_start;
        
        ctx->futhark_mc_segmap_parloop_236041_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236041_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236041_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236039(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212003 = tid;
    int num_tasks_229133 = info.nsubtasks;
    struct futhark_mc_task_236034 *futhark_mc_task_236034 =
                                  (struct futhark_mc_task_236034 *) args;
    struct futhark_context *ctx = futhark_mc_task_236034->ctx;
    uint64_t futhark_mc_segmap_nested_task_236039_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236039_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236034->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236034->free_partition_sizze_203577;
    int64_t dyn_lifted_single_ma_l_arg_204144 =
            futhark_mc_task_236034->free_dyn_lifted_single_ma_l_arg_204144;
    int64_t bytes_217302 = futhark_mc_task_236034->free_bytes_217302;
    struct memblock mem_219268 = {.desc ="mem_219268", .mem =
                                  futhark_mc_task_236034->free_mem_219268,
                                  .size =0, .references =NULL};
    struct memblock mem_219271 = {.desc ="mem_219271", .mem =
                                  futhark_mc_task_236034->free_mem_219271,
                                  .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236034->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t iter_229162;
    struct futhark_mc_segmap_parloop_struct_236040
    futhark_mc_segmap_parloop_struct_236040;
    
    futhark_mc_segmap_parloop_struct_236040.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236040.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236040.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236040.free_dyn_lifted_single_ma_l_arg_204144 =
        dyn_lifted_single_ma_l_arg_204144;
    futhark_mc_segmap_parloop_struct_236040.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236040.free_mem_219268 = mem_219268.mem;
    futhark_mc_segmap_parloop_struct_236040.free_mem_219271 = mem_219271.mem;
    futhark_mc_segmap_parloop_struct_236040.free_mem_219293 = mem_219293.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236041_task;
    
    futhark_mc_segmap_parloop_236041_task.name =
        "futhark_mc_segmap_parloop_236041";
    futhark_mc_segmap_parloop_236041_task.fn = futhark_mc_segmap_parloop_236041;
    futhark_mc_segmap_parloop_236041_task.args =
        &futhark_mc_segmap_parloop_struct_236040;
    futhark_mc_segmap_parloop_236041_task.iterations = iterations;
    futhark_mc_segmap_parloop_236041_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236041_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236041_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236041_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236041_task);
    
    if (futhark_mc_segmap_parloop_236041_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236041_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236041_total_end -
                 futhark_mc_segmap_parloop_236041_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236041_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236041_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236041_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236039_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236039_end -
                 futhark_mc_segmap_nested_task_236039_start;
        
        ctx->futhark_mc_segmap_nested_task_236039_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236039_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236039_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236050 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219319;
};
struct futhark_mc_segmap_parloop_struct_236052 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219319;
};
static int futhark_mc_segmap_parloop_236053(void *args, int64_t start,
                                            int64_t end, int flat_tid_212032,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236052
    *futhark_mc_segmap_parloop_struct_236052 =
    (struct futhark_mc_segmap_parloop_struct_236052 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236052->ctx;
    uint64_t futhark_mc_segmap_parloop_236053_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236053_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236052->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236052->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236052->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236052->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236052->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236052->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236052->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236052->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236052->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236052->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236052->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236052->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236052->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236052->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219319 = {.desc ="mem_219319", .mem =
                                  futhark_mc_segmap_parloop_struct_236052->free_mem_219319,
                                  .size =0, .references =NULL};
    size_t mem_219303_cached_sizze_236054 = 0;
    unsigned char *mem_219303 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229205 = start;
    
    if (mem_219303_cached_sizze_236054 < (size_t) bytes_217720) {
        mem_219303 = realloc(mem_219303, bytes_217720);
        mem_219303_cached_sizze_236054 = bytes_217720;
    }
    for (; iter_229205 < end; iter_229205++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229262 = partition_sizze_203577;
        int64_t gtid_212033 = iter_229205;
        int64_t remnant_229263 = iter_229205 - gtid_212033;
        
        for (int64_t i_229206 = 0; i_229206 < l_n_m_203643; i_229206++) {
            int64_t x_229208;
            
            x_229208 = ((int64_t *) mem_217773.mem)[gtid_212033 * l_n_m_203643 +
                                                    i_229206];
            
            double x_229209;
            
            x_229209 = ((double *) mem_217777.mem)[gtid_212033 * l_n_m_203643 +
                                                   i_229206];
            
            int64_t min_arg_229210 = mul64(jump_t_203500, i_229206);
            int64_t min_res_229211 = smin64(i_203670, min_arg_229210);
            int64_t defunc_0_g_res_229212 = add64((int64_t) 1, min_res_229211);
            double defunc_2_reduce_res_229213;
            double redout_229215 = 0.0;
            
            for (int64_t i_229214 = 0; i_229214 < q_l_203495; i_229214++) {
                bool cond_229216 = sle64(n_203490, i_229214);
                int64_t defunc_0_f_res_229217;
                
                if (cond_229216) {
                    defunc_0_f_res_229217 = (int64_t) 0;
                } else {
                    int64_t i_229218 = add64(x_229208, i_229214);
                    int64_t defunc_1_add_res_229219 = add64((int64_t) 1,
                                                            i_229218);
                    
                    defunc_0_f_res_229217 = defunc_1_add_res_229219;
                }
                
                double defunc_0_f_res_229220;
                
                if (cond_229216) {
                    defunc_0_f_res_229220 = 0.0;
                } else {
                    int64_t i_229221 = add64(x_229208, i_229214);
                    double defunc_0_add_arg_229222;
                    
                    defunc_0_add_arg_229222 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_212033 *
                                                           ctx_param_ext_217867 +
                                                           i_229221 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_229220 = defunc_0_add_arg_229222;
                }
                
                int64_t binop_p_229223 = sub64(defunc_0_f_res_229217,
                                               defunc_0_g_res_229212);
                double defunc_0_f_res_229224 = sitofp_i64_f64(binop_p_229223);
                double abs_res_229225 = fabs(defunc_0_f_res_229224);
                double tmp1_229226 = abs_res_229225 / x_229209;
                double x_229227 = tmp1_229226 * tmp1_229226;
                double y_229228 = tmp1_229226 * x_229227;
                double tmp2_229229 = 1.0 - y_229228;
                double x_229230 = tmp2_229229 * tmp2_229229;
                double tmp3_229231 = tmp2_229229 * x_229230;
                double w_j_229232 = defunc_0_f_res_229220 * tmp3_229231;
                double defunc_1_op_res_229233 = w_j_229232 + redout_229215;
                double redout_tmp_229265 = defunc_1_op_res_229233;
                
                redout_229215 = redout_tmp_229265;
            }
            defunc_2_reduce_res_229213 = redout_229215;
            
            double a0_229234 = 1.0 / defunc_2_reduce_res_229213;
            double defunc_2_reduce_res_229235;
            double redout_229237 = 0.0;
            
            for (int64_t i_229236 = 0; i_229236 < q_l_203495; i_229236++) {
                bool cond_229238 = sle64(n_203490, i_229236);
                int64_t defunc_0_f_res_229239;
                
                if (cond_229238) {
                    defunc_0_f_res_229239 = (int64_t) 0;
                } else {
                    int64_t i_229240 = add64(x_229208, i_229236);
                    int64_t defunc_1_add_res_229241 = add64((int64_t) 1,
                                                            i_229240);
                    
                    defunc_0_f_res_229239 = defunc_1_add_res_229241;
                }
                
                double defunc_0_f_res_229242;
                
                if (cond_229238) {
                    defunc_0_f_res_229242 = 0.0;
                } else {
                    int64_t i_229243 = add64(x_229208, i_229236);
                    double defunc_0_add_arg_229244;
                    
                    defunc_0_add_arg_229244 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_212033 *
                                                           ctx_param_ext_217867 +
                                                           i_229243 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_229242 = defunc_0_add_arg_229244;
                }
                
                int64_t binop_p_229245 = sub64(defunc_0_f_res_229239,
                                               defunc_0_g_res_229212);
                double defunc_0_f_res_229246 = sitofp_i64_f64(binop_p_229245);
                double abs_res_229247 = fabs(defunc_0_f_res_229246);
                double tmp1_229248 = abs_res_229247 / x_229209;
                double x_229249 = tmp1_229248 * tmp1_229248;
                double y_229250 = tmp1_229248 * x_229249;
                double tmp2_229251 = 1.0 - y_229250;
                double x_229252 = tmp2_229251 * tmp2_229251;
                double tmp3_229253 = tmp2_229251 * x_229252;
                double tmp4_229254 = defunc_0_f_res_229242 * tmp3_229253;
                double defunc_0_f_res_229255;
                
                if (cond_229238) {
                    defunc_0_f_res_229255 = 0.0;
                } else {
                    int64_t i_229256 = add64(x_229208, i_229236);
                    double defunc_0_add_arg_229257;
                    
                    defunc_0_add_arg_229257 =
                        ((double *) mem_219293.mem)[gtid_212033 * n_203490 +
                                                    i_229256];
                    defunc_0_f_res_229255 = defunc_0_add_arg_229257;
                }
                
                double x_229258 = a0_229234 * tmp4_229254;
                double defunc_9_fit_fun_res_229259 = defunc_0_f_res_229255 *
                       x_229258;
                double defunc_1_op_res_229260 = defunc_9_fit_fun_res_229259 +
                       redout_229237;
                double redout_tmp_229266 = defunc_1_op_res_229260;
                
                redout_229237 = redout_tmp_229266;
            }
            defunc_2_reduce_res_229235 = redout_229237;
            ((double *) mem_219303)[i_229206] = defunc_2_reduce_res_229235;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219319.mem + gtid_212033 * l_n_m_203643 * (int64_t) 8,
                    mem_219303 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219303);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236053_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236053_end -
                 futhark_mc_segmap_parloop_236053_start;
        
        ctx->futhark_mc_segmap_parloop_236053_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236053_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236053_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236051(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212032 = tid;
    int num_tasks_229204 = info.nsubtasks;
    struct futhark_mc_task_236050 *futhark_mc_task_236050 =
                                  (struct futhark_mc_task_236050 *) args;
    struct futhark_context *ctx = futhark_mc_task_236050->ctx;
    uint64_t futhark_mc_segmap_task_236051_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236051_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236050->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236050->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236050->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236050->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236050->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236050->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236050->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236050->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236050->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236050->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236050->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236050->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236050->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236050->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219319 = {.desc ="mem_219319", .mem =
                                  futhark_mc_task_236050->free_mem_219319,
                                  .size =0, .references =NULL};
    int64_t iter_229205;
    struct futhark_mc_segmap_parloop_struct_236052
    futhark_mc_segmap_parloop_struct_236052;
    
    futhark_mc_segmap_parloop_struct_236052.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236052.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236052.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236052.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236052.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236052.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236052.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236052.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236052.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236052.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236052.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236052.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236052.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236052.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236052.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236052.free_mem_219319 = mem_219319.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236053_task;
    
    futhark_mc_segmap_parloop_236053_task.name =
        "futhark_mc_segmap_parloop_236053";
    futhark_mc_segmap_parloop_236053_task.fn = futhark_mc_segmap_parloop_236053;
    futhark_mc_segmap_parloop_236053_task.args =
        &futhark_mc_segmap_parloop_struct_236052;
    futhark_mc_segmap_parloop_236053_task.iterations = iterations;
    futhark_mc_segmap_parloop_236053_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236053_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236053_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236053_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236053_task);
    
    if (futhark_mc_segmap_parloop_236053_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236053_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236053_total_end -
                 futhark_mc_segmap_parloop_236053_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236053_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236053_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236053_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236051_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236051_end -
                 futhark_mc_segmap_task_236051_start;
        
        ctx->futhark_mc_segmap_task_236051_runs[tid]++;
        ctx->futhark_mc_segmap_task_236051_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236051_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236056 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219319;
};
struct futhark_mc_task_236059 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212107;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219300;
};
struct futhark_mc_segmap_parloop_struct_236061 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212107;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219300;
};
static int futhark_mc_segmap_parloop_236062(void *args, int64_t start,
                                            int64_t end, int flat_tid_229327,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236061
    *futhark_mc_segmap_parloop_struct_236061 =
    (struct futhark_mc_segmap_parloop_struct_236061 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236061->ctx;
    uint64_t futhark_mc_segmap_parloop_236062_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236062_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236061->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236061->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236061->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236061->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236061->free_i_203670;
    int64_t gtid_212107 =
            futhark_mc_segmap_parloop_struct_236061->free_gtid_212107;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236061->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236061->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236061->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236061->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236061->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236061->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236061->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219300 = {.desc ="mem_219300", .mem =
                                  futhark_mc_segmap_parloop_struct_236061->free_mem_219300,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229385 = start;
    
    for (; iter_229385 < end; iter_229385++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229431 = l_n_m_203643;
        int64_t gtid_229328 = iter_229385;
        int64_t remnant_229432 = iter_229385 - gtid_229328;
        int64_t x_229329;
        
        x_229329 = ((int64_t *) mem_217773.mem)[gtid_212107 * l_n_m_203643 +
                                                gtid_229328];
        
        double x_229330;
        
        x_229330 = ((double *) mem_217777.mem)[gtid_212107 * l_n_m_203643 +
                                               gtid_229328];
        
        int64_t min_arg_229331 = mul64(jump_t_203500, gtid_229328);
        int64_t min_res_229332 = smin64(i_203670, min_arg_229331);
        int64_t defunc_0_g_res_229333 = add64((int64_t) 1, min_res_229332);
        double defunc_2_reduce_res_229334;
        double redout_229387 = 0.0;
        
        for (int64_t i_229386 = 0; i_229386 < q_l_203495; i_229386++) {
            bool cond_229388 = sle64(n_203490, i_229386);
            int64_t defunc_0_f_res_229389;
            
            if (cond_229388) {
                defunc_0_f_res_229389 = (int64_t) 0;
            } else {
                int64_t i_229390 = add64(x_229329, i_229386);
                int64_t defunc_1_add_res_229391 = add64((int64_t) 1, i_229390);
                
                defunc_0_f_res_229389 = defunc_1_add_res_229391;
            }
            
            double defunc_0_f_res_229392;
            
            if (cond_229388) {
                defunc_0_f_res_229392 = 0.0;
            } else {
                int64_t i_229393 = add64(x_229329, i_229386);
                double defunc_0_add_arg_229394;
                
                defunc_0_add_arg_229394 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_212107 *
                                                       ctx_param_ext_217867 +
                                                       i_229393 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_229392 = defunc_0_add_arg_229394;
            }
            
            int64_t binop_p_229395 = sub64(defunc_0_f_res_229389,
                                           defunc_0_g_res_229333);
            double defunc_0_f_res_229396 = sitofp_i64_f64(binop_p_229395);
            double abs_res_229397 = fabs(defunc_0_f_res_229396);
            double tmp1_229398 = abs_res_229397 / x_229330;
            double x_229399 = tmp1_229398 * tmp1_229398;
            double y_229400 = tmp1_229398 * x_229399;
            double tmp2_229401 = 1.0 - y_229400;
            double x_229402 = tmp2_229401 * tmp2_229401;
            double tmp3_229403 = tmp2_229401 * x_229402;
            double w_j_229404 = defunc_0_f_res_229392 * tmp3_229403;
            double defunc_1_op_res_229405 = w_j_229404 + redout_229387;
            double redout_tmp_229433 = defunc_1_op_res_229405;
            
            redout_229387 = redout_tmp_229433;
        }
        defunc_2_reduce_res_229334 = redout_229387;
        
        double a0_229355 = 1.0 / defunc_2_reduce_res_229334;
        double defunc_2_reduce_res_229356;
        double redout_229407 = 0.0;
        
        for (int64_t i_229406 = 0; i_229406 < q_l_203495; i_229406++) {
            bool cond_229408 = sle64(n_203490, i_229406);
            int64_t defunc_0_f_res_229409;
            
            if (cond_229408) {
                defunc_0_f_res_229409 = (int64_t) 0;
            } else {
                int64_t i_229410 = add64(x_229329, i_229406);
                int64_t defunc_1_add_res_229411 = add64((int64_t) 1, i_229410);
                
                defunc_0_f_res_229409 = defunc_1_add_res_229411;
            }
            
            double defunc_0_f_res_229412;
            
            if (cond_229408) {
                defunc_0_f_res_229412 = 0.0;
            } else {
                int64_t i_229413 = add64(x_229329, i_229406);
                double defunc_0_add_arg_229414;
                
                defunc_0_add_arg_229414 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_212107 *
                                                       ctx_param_ext_217867 +
                                                       i_229413 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_229412 = defunc_0_add_arg_229414;
            }
            
            int64_t binop_p_229415 = sub64(defunc_0_f_res_229409,
                                           defunc_0_g_res_229333);
            double defunc_0_f_res_229416 = sitofp_i64_f64(binop_p_229415);
            double abs_res_229417 = fabs(defunc_0_f_res_229416);
            double tmp1_229418 = abs_res_229417 / x_229330;
            double x_229419 = tmp1_229418 * tmp1_229418;
            double y_229420 = tmp1_229418 * x_229419;
            double tmp2_229421 = 1.0 - y_229420;
            double x_229422 = tmp2_229421 * tmp2_229421;
            double tmp3_229423 = tmp2_229421 * x_229422;
            double tmp4_229424 = defunc_0_f_res_229412 * tmp3_229423;
            double defunc_0_f_res_229425;
            
            if (cond_229408) {
                defunc_0_f_res_229425 = 0.0;
            } else {
                int64_t i_229426 = add64(x_229329, i_229406);
                double defunc_0_add_arg_229427;
                
                defunc_0_add_arg_229427 =
                    ((double *) mem_219293.mem)[gtid_212107 * n_203490 +
                                                i_229426];
                defunc_0_f_res_229425 = defunc_0_add_arg_229427;
            }
            
            double x_229428 = a0_229355 * tmp4_229424;
            double defunc_9_fit_fun_res_229429 = defunc_0_f_res_229425 *
                   x_229428;
            double defunc_1_op_res_229430 = defunc_9_fit_fun_res_229429 +
                   redout_229407;
            double redout_tmp_229434 = defunc_1_op_res_229430;
            
            redout_229407 = redout_tmp_229434;
        }
        defunc_2_reduce_res_229356 = redout_229407;
        ((double *) mem_219300.mem)[gtid_229328] = defunc_2_reduce_res_229356;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236062_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236062_end -
                 futhark_mc_segmap_parloop_236062_start;
        
        ctx->futhark_mc_segmap_parloop_236062_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236062_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236062_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236060(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229327 = tid;
    int num_tasks_229384 = info.nsubtasks;
    struct futhark_mc_task_236059 *futhark_mc_task_236059 =
                                  (struct futhark_mc_task_236059 *) args;
    struct futhark_context *ctx = futhark_mc_task_236059->ctx;
    uint64_t futhark_mc_segmap_task_236060_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236060_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236059->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236059->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236059->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236059->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236059->free_i_203670;
    int64_t gtid_212107 = futhark_mc_task_236059->free_gtid_212107;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236059->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236059->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236059->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236059->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236059->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236059->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236059->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219300 = {.desc ="mem_219300", .mem =
                                  futhark_mc_task_236059->free_mem_219300,
                                  .size =0, .references =NULL};
    int64_t iter_229385;
    struct futhark_mc_segmap_parloop_struct_236061
    futhark_mc_segmap_parloop_struct_236061;
    
    futhark_mc_segmap_parloop_struct_236061.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236061.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236061.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236061.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236061.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236061.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236061.free_gtid_212107 = gtid_212107;
    futhark_mc_segmap_parloop_struct_236061.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236061.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236061.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236061.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236061.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236061.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236061.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236061.free_mem_219300 = mem_219300.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236062_task;
    
    futhark_mc_segmap_parloop_236062_task.name =
        "futhark_mc_segmap_parloop_236062";
    futhark_mc_segmap_parloop_236062_task.fn = futhark_mc_segmap_parloop_236062;
    futhark_mc_segmap_parloop_236062_task.args =
        &futhark_mc_segmap_parloop_struct_236061;
    futhark_mc_segmap_parloop_236062_task.iterations = iterations;
    futhark_mc_segmap_parloop_236062_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236062_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236062_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236062_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236062_task);
    
    if (futhark_mc_segmap_parloop_236062_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236062_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236062_total_end -
                 futhark_mc_segmap_parloop_236062_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236062_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236062_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236062_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236060_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236060_end -
                 futhark_mc_segmap_task_236060_start;
        
        ctx->futhark_mc_segmap_task_236060_runs[tid]++;
        ctx->futhark_mc_segmap_task_236060_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236060_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236064 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212107;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219300;
};
struct futhark_mc_task_236066 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212107;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_229270;
    double free_x_229271;
    int64_t free_defunc_0_g_res_229274;
    double *retval_defunc_2_reduce_res_229275;
};
struct futhark_mc_segred_stage_1_parloop_struct_236069 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212107;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_229270;
    double free_x_229271;
    int64_t free_defunc_0_g_res_229274;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229488;
};
static int futhark_mc_segred_stage_1_parloop_236070(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229436,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236069
    *futhark_mc_segred_stage_1_parloop_struct_236069 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236069 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236069->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236070_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236070_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236069->free_n_203490;
    int64_t gtid_212107 =
            futhark_mc_segred_stage_1_parloop_struct_236069->free_gtid_212107;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236069->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236069->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236069->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236069->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_229270 =
            futhark_mc_segred_stage_1_parloop_struct_236069->free_x_229270;
    double x_229271 =
           futhark_mc_segred_stage_1_parloop_struct_236069->free_x_229271;
    int64_t defunc_0_g_res_229274 =
            futhark_mc_segred_stage_1_parloop_struct_236069->free_defunc_0_g_res_229274;
    struct memblock reduce_stage_1_tid_res_arr_mem_229488 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229488",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236069->free_reduce_stage_1_tid_res_arr_mem_229488,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229490 = start;
    double x_229438;
    double x_229439;
    double local_acc_229491 = 0.0;
    
    for (; iter_229490 < end; iter_229490++) {
        int64_t gtid_229437 = iter_229490;
        bool cond_229441 = sle64(n_203490, gtid_229437);
        int64_t defunc_0_f_res_229442;
        
        if (cond_229441) {
            defunc_0_f_res_229442 = (int64_t) 0;
        } else {
            int64_t i_229443 = add64(x_229270, gtid_229437);
            int64_t defunc_1_add_res_229444 = add64((int64_t) 1, i_229443);
            
            defunc_0_f_res_229442 = defunc_1_add_res_229444;
        }
        
        double defunc_0_f_res_229445;
        
        if (cond_229441) {
            defunc_0_f_res_229445 = 0.0;
        } else {
            int64_t i_229446 = add64(x_229270, gtid_229437);
            double defunc_0_add_arg_229447;
            
            defunc_0_add_arg_229447 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_212107 *
                                                   ctx_param_ext_217867 +
                                                   i_229446 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_229445 = defunc_0_add_arg_229447;
        }
        
        int64_t binop_p_229448 = sub64(defunc_0_f_res_229442,
                                       defunc_0_g_res_229274);
        double defunc_0_f_res_229449 = sitofp_i64_f64(binop_p_229448);
        double abs_res_229450 = fabs(defunc_0_f_res_229449);
        double tmp1_229451 = abs_res_229450 / x_229271;
        double x_229452 = tmp1_229451 * tmp1_229451;
        double y_229453 = tmp1_229451 * x_229452;
        double tmp2_229454 = 1.0 - y_229453;
        double x_229455 = tmp2_229454 * tmp2_229454;
        double tmp3_229456 = tmp2_229454 * x_229455;
        double w_j_229457 = defunc_0_f_res_229445 * tmp3_229456;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_229438 = local_acc_229491;
        }
        // Load next params
        {
            x_229439 = w_j_229457;
        }
        // Red body
        {
            double defunc_1_op_res_229440 = x_229438 + x_229439;
            
            local_acc_229491 = defunc_1_op_res_229440;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229488.mem)[flat_tid_229436] =
        local_acc_229491;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236070_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236070_end -
                 futhark_mc_segred_stage_1_parloop_236070_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236070_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236070_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236070_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236067(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229436 = tid;
    int num_tasks_229487 = info.nsubtasks;
    struct futhark_mc_task_236066 *futhark_mc_task_236066 =
                                  (struct futhark_mc_task_236066 *) args;
    struct futhark_context *ctx = futhark_mc_task_236066->ctx;
    uint64_t futhark_mc_segred_task_236067_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236067_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236066->free_n_203490;
    int64_t gtid_212107 = futhark_mc_task_236066->free_gtid_212107;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236066->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236066->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236066->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236066->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_229270 = futhark_mc_task_236066->free_x_229270;
    double x_229271 = futhark_mc_task_236066->free_x_229271;
    int64_t defunc_0_g_res_229274 =
            futhark_mc_task_236066->free_defunc_0_g_res_229274;
    double defunc_2_reduce_res_229275 =
           *futhark_mc_task_236066->retval_defunc_2_reduce_res_229275;
    size_t reduce_stage_1_tid_res_arr_mem_229488_cached_sizze_236068 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229488 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229488_cached_sizze_236068 <
        (size_t) ((int64_t) 8 * num_tasks_229487)) {
        reduce_stage_1_tid_res_arr_mem_229488 =
            realloc(reduce_stage_1_tid_res_arr_mem_229488, (int64_t) 8 *
                    num_tasks_229487);
        reduce_stage_1_tid_res_arr_mem_229488_cached_sizze_236068 =
            (int64_t) 8 * num_tasks_229487;
    }
    
    int64_t iter_229490;
    struct futhark_mc_segred_stage_1_parloop_struct_236069
    futhark_mc_segred_stage_1_parloop_struct_236069;
    
    futhark_mc_segred_stage_1_parloop_struct_236069.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_gtid_212107 =
        gtid_212107;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_x_229270 = x_229270;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_x_229271 = x_229271;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_defunc_0_g_res_229274 =
        defunc_0_g_res_229274;
    futhark_mc_segred_stage_1_parloop_struct_236069.free_reduce_stage_1_tid_res_arr_mem_229488 =
        reduce_stage_1_tid_res_arr_mem_229488;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236070_task;
    
    futhark_mc_segred_stage_1_parloop_236070_task.name =
        "futhark_mc_segred_stage_1_parloop_236070";
    futhark_mc_segred_stage_1_parloop_236070_task.fn =
        futhark_mc_segred_stage_1_parloop_236070;
    futhark_mc_segred_stage_1_parloop_236070_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236069;
    futhark_mc_segred_stage_1_parloop_236070_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236070_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236070_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236070_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236070_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236070_task);
    
    if (futhark_mc_segred_stage_1_parloop_236070_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236070_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236070_total_end -
                 futhark_mc_segred_stage_1_parloop_236070_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236070_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236070_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236070_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229275 = 0.0;
    }
    
    double x_229492;
    double x_229493;
    
    for (int32_t i_229495 = 0; i_229495 < num_tasks_229487; i_229495++) {
        flat_tid_229436 = i_229495;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229492 = defunc_2_reduce_res_229275;
            }
            // load next params
            {
                x_229493 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229488)[flat_tid_229436];
            }
            // red body
            {
                double defunc_1_op_res_229494 = x_229492 + x_229493;
                
                defunc_2_reduce_res_229275 = defunc_1_op_res_229494;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229488);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236067_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236067_end -
                 futhark_mc_segred_task_236067_start;
        
        ctx->futhark_mc_segred_task_236067_runs[tid]++;
        ctx->futhark_mc_segred_task_236067_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236067_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236066->retval_defunc_2_reduce_res_229275 =
            defunc_2_reduce_res_229275;
    }
    return err;
}
struct futhark_mc_task_236071 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212107;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_x_229270;
    double free_x_229271;
    int64_t free_defunc_0_g_res_229274;
    double free_a0_229298;
    double *retval_defunc_2_reduce_res_229299;
};
struct futhark_mc_segred_stage_1_parloop_struct_236074 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212107;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_x_229270;
    double free_x_229271;
    int64_t free_defunc_0_g_res_229274;
    double free_a0_229298;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229497;
};
static int futhark_mc_segred_stage_1_parloop_236075(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229458,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236074
    *futhark_mc_segred_stage_1_parloop_struct_236074 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236074 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236074->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236075_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236075_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236074->free_n_203490;
    int64_t gtid_212107 =
            futhark_mc_segred_stage_1_parloop_struct_236074->free_gtid_212107;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236074->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236074->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236074->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236074->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236074->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_229270 =
            futhark_mc_segred_stage_1_parloop_struct_236074->free_x_229270;
    double x_229271 =
           futhark_mc_segred_stage_1_parloop_struct_236074->free_x_229271;
    int64_t defunc_0_g_res_229274 =
            futhark_mc_segred_stage_1_parloop_struct_236074->free_defunc_0_g_res_229274;
    double a0_229298 =
           futhark_mc_segred_stage_1_parloop_struct_236074->free_a0_229298;
    struct memblock reduce_stage_1_tid_res_arr_mem_229497 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229497",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236074->free_reduce_stage_1_tid_res_arr_mem_229497,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229499 = start;
    double x_229460;
    double x_229461;
    double local_acc_229500 = 0.0;
    
    for (; iter_229499 < end; iter_229499++) {
        int64_t gtid_229459 = iter_229499;
        bool cond_229463 = sle64(n_203490, gtid_229459);
        int64_t defunc_0_f_res_229464;
        
        if (cond_229463) {
            defunc_0_f_res_229464 = (int64_t) 0;
        } else {
            int64_t i_229465 = add64(x_229270, gtid_229459);
            int64_t defunc_1_add_res_229466 = add64((int64_t) 1, i_229465);
            
            defunc_0_f_res_229464 = defunc_1_add_res_229466;
        }
        
        double defunc_0_f_res_229467;
        
        if (cond_229463) {
            defunc_0_f_res_229467 = 0.0;
        } else {
            int64_t i_229468 = add64(x_229270, gtid_229459);
            double defunc_0_add_arg_229469;
            
            defunc_0_add_arg_229469 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_212107 *
                                                   ctx_param_ext_217867 +
                                                   i_229468 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_229467 = defunc_0_add_arg_229469;
        }
        
        int64_t binop_p_229470 = sub64(defunc_0_f_res_229464,
                                       defunc_0_g_res_229274);
        double defunc_0_f_res_229471 = sitofp_i64_f64(binop_p_229470);
        double abs_res_229472 = fabs(defunc_0_f_res_229471);
        double tmp1_229473 = abs_res_229472 / x_229271;
        double x_229474 = tmp1_229473 * tmp1_229473;
        double y_229475 = tmp1_229473 * x_229474;
        double tmp2_229476 = 1.0 - y_229475;
        double x_229477 = tmp2_229476 * tmp2_229476;
        double tmp3_229478 = tmp2_229476 * x_229477;
        double tmp4_229479 = defunc_0_f_res_229467 * tmp3_229478;
        double defunc_0_f_res_229480;
        
        if (cond_229463) {
            defunc_0_f_res_229480 = 0.0;
        } else {
            int64_t i_229481 = add64(x_229270, gtid_229459);
            double defunc_0_add_arg_229482;
            
            defunc_0_add_arg_229482 = ((double *) mem_219293.mem)[gtid_212107 *
                                                                  n_203490 +
                                                                  i_229481];
            defunc_0_f_res_229480 = defunc_0_add_arg_229482;
        }
        
        double x_229483 = a0_229298 * tmp4_229479;
        double defunc_9_fit_fun_res_229484 = defunc_0_f_res_229480 * x_229483;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_229460 = local_acc_229500;
        }
        // Load next params
        {
            x_229461 = defunc_9_fit_fun_res_229484;
        }
        // Red body
        {
            double defunc_1_op_res_229462 = x_229460 + x_229461;
            
            local_acc_229500 = defunc_1_op_res_229462;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229497.mem)[flat_tid_229458] =
        local_acc_229500;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236075_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236075_end -
                 futhark_mc_segred_stage_1_parloop_236075_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236075_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236075_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236075_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236072(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229458 = tid;
    int num_tasks_229496 = info.nsubtasks;
    struct futhark_mc_task_236071 *futhark_mc_task_236071 =
                                  (struct futhark_mc_task_236071 *) args;
    struct futhark_context *ctx = futhark_mc_task_236071->ctx;
    uint64_t futhark_mc_segred_task_236072_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236072_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236071->free_n_203490;
    int64_t gtid_212107 = futhark_mc_task_236071->free_gtid_212107;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236071->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236071->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236071->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236071->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236071->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_229270 = futhark_mc_task_236071->free_x_229270;
    double x_229271 = futhark_mc_task_236071->free_x_229271;
    int64_t defunc_0_g_res_229274 =
            futhark_mc_task_236071->free_defunc_0_g_res_229274;
    double a0_229298 = futhark_mc_task_236071->free_a0_229298;
    double defunc_2_reduce_res_229299 =
           *futhark_mc_task_236071->retval_defunc_2_reduce_res_229299;
    size_t reduce_stage_1_tid_res_arr_mem_229497_cached_sizze_236073 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229497 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229497_cached_sizze_236073 <
        (size_t) ((int64_t) 8 * num_tasks_229496)) {
        reduce_stage_1_tid_res_arr_mem_229497 =
            realloc(reduce_stage_1_tid_res_arr_mem_229497, (int64_t) 8 *
                    num_tasks_229496);
        reduce_stage_1_tid_res_arr_mem_229497_cached_sizze_236073 =
            (int64_t) 8 * num_tasks_229496;
    }
    
    int64_t iter_229499;
    struct futhark_mc_segred_stage_1_parloop_struct_236074
    futhark_mc_segred_stage_1_parloop_struct_236074;
    
    futhark_mc_segred_stage_1_parloop_struct_236074.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_gtid_212107 =
        gtid_212107;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_mem_219293 =
        mem_219293.mem;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_x_229270 = x_229270;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_x_229271 = x_229271;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_defunc_0_g_res_229274 =
        defunc_0_g_res_229274;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_a0_229298 = a0_229298;
    futhark_mc_segred_stage_1_parloop_struct_236074.free_reduce_stage_1_tid_res_arr_mem_229497 =
        reduce_stage_1_tid_res_arr_mem_229497;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236075_task;
    
    futhark_mc_segred_stage_1_parloop_236075_task.name =
        "futhark_mc_segred_stage_1_parloop_236075";
    futhark_mc_segred_stage_1_parloop_236075_task.fn =
        futhark_mc_segred_stage_1_parloop_236075;
    futhark_mc_segred_stage_1_parloop_236075_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236074;
    futhark_mc_segred_stage_1_parloop_236075_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236075_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236075_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236075_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236075_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236075_task);
    
    if (futhark_mc_segred_stage_1_parloop_236075_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236075_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236075_total_end -
                 futhark_mc_segred_stage_1_parloop_236075_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236075_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236075_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236075_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229299 = 0.0;
    }
    
    double x_229501;
    double x_229502;
    
    for (int32_t i_229504 = 0; i_229504 < num_tasks_229496; i_229504++) {
        flat_tid_229458 = i_229504;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229501 = defunc_2_reduce_res_229299;
            }
            // load next params
            {
                x_229502 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229497)[flat_tid_229458];
            }
            // red body
            {
                double defunc_1_op_res_229503 = x_229501 + x_229502;
                
                defunc_2_reduce_res_229299 = defunc_1_op_res_229503;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229497);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236072_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236072_end -
                 futhark_mc_segred_task_236072_start;
        
        ctx->futhark_mc_segred_task_236072_runs[tid]++;
        ctx->futhark_mc_segred_task_236072_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236072_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236071->retval_defunc_2_reduce_res_229299 =
            defunc_2_reduce_res_229299;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236065(void *args, int64_t start,
                                            int64_t end, int flat_tid_229268,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236064
    *futhark_mc_segmap_parloop_struct_236064 =
    (struct futhark_mc_segmap_parloop_struct_236064 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236064->ctx;
    uint64_t futhark_mc_segmap_parloop_236065_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236065_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236064->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236064->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236064->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236064->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236064->free_i_203670;
    int64_t gtid_212107 =
            futhark_mc_segmap_parloop_struct_236064->free_gtid_212107;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236064->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236064->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236064->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236064->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236064->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236064->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236064->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219300 = {.desc ="mem_219300", .mem =
                                  futhark_mc_segmap_parloop_struct_236064->free_mem_219300,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229435 = start;
    
    for (; iter_229435 < end; iter_229435++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229485 = l_n_m_203643;
        int64_t gtid_229269 = iter_229435;
        int64_t remnant_229486 = iter_229435 - gtid_229269;
        int64_t x_229270;
        
        x_229270 = ((int64_t *) mem_217773.mem)[gtid_212107 * l_n_m_203643 +
                                                gtid_229269];
        
        double x_229271;
        
        x_229271 = ((double *) mem_217777.mem)[gtid_212107 * l_n_m_203643 +
                                               gtid_229269];
        
        int64_t min_arg_229272 = mul64(jump_t_203500, gtid_229269);
        int64_t min_res_229273 = smin64(i_203670, min_arg_229272);
        int64_t defunc_0_g_res_229274 = add64((int64_t) 1, min_res_229273);
        double defunc_2_reduce_res_229275;
        int64_t flat_tid_229436 = (int64_t) 0;
        int32_t num_tasks_229487;
        
        defunc_2_reduce_res_229275 = 0.0;
        
        struct futhark_mc_task_236066 futhark_mc_task_236066;
        
        futhark_mc_task_236066.ctx = ctx;
        futhark_mc_task_236066.free_n_203490 = n_203490;
        futhark_mc_task_236066.free_gtid_212107 = gtid_212107;
        futhark_mc_task_236066.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236066.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236066.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236066.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236066.free_x_229270 = x_229270;
        futhark_mc_task_236066.free_x_229271 = x_229271;
        futhark_mc_task_236066.free_defunc_0_g_res_229274 =
            defunc_0_g_res_229274;
        futhark_mc_task_236066.retval_defunc_2_reduce_res_229275 =
            &defunc_2_reduce_res_229275;
        
        struct scheduler_segop futhark_mc_task_236066_task;
        
        futhark_mc_task_236066_task.args = &futhark_mc_task_236066;
        futhark_mc_task_236066_task.top_level_fn =
            futhark_mc_segred_task_236067;
        futhark_mc_task_236066_task.name = "futhark_mc_segred_task_236067";
        futhark_mc_task_236066_task.iterations = q_l_203495;
        futhark_mc_task_236066_task.task_time =
            &ctx->futhark_mc_segred_task_236067_total_time;
        futhark_mc_task_236066_task.task_iter =
            &ctx->futhark_mc_segred_task_236067_total_iter;
        futhark_mc_task_236066_task.sched = STATIC;
        futhark_mc_task_236066_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236067_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236066_task);
        
        if (futhark_mc_segred_task_236067_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_229298 = 1.0 / defunc_2_reduce_res_229275;
        double defunc_2_reduce_res_229299;
        int64_t flat_tid_229458 = (int64_t) 0;
        int32_t num_tasks_229496;
        
        defunc_2_reduce_res_229299 = 0.0;
        
        struct futhark_mc_task_236071 futhark_mc_task_236071;
        
        futhark_mc_task_236071.ctx = ctx;
        futhark_mc_task_236071.free_n_203490 = n_203490;
        futhark_mc_task_236071.free_gtid_212107 = gtid_212107;
        futhark_mc_task_236071.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236071.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236071.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236071.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236071.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236071.free_x_229270 = x_229270;
        futhark_mc_task_236071.free_x_229271 = x_229271;
        futhark_mc_task_236071.free_defunc_0_g_res_229274 =
            defunc_0_g_res_229274;
        futhark_mc_task_236071.free_a0_229298 = a0_229298;
        futhark_mc_task_236071.retval_defunc_2_reduce_res_229299 =
            &defunc_2_reduce_res_229299;
        
        struct scheduler_segop futhark_mc_task_236071_task;
        
        futhark_mc_task_236071_task.args = &futhark_mc_task_236071;
        futhark_mc_task_236071_task.top_level_fn =
            futhark_mc_segred_task_236072;
        futhark_mc_task_236071_task.name = "futhark_mc_segred_task_236072";
        futhark_mc_task_236071_task.iterations = q_l_203495;
        futhark_mc_task_236071_task.task_time =
            &ctx->futhark_mc_segred_task_236072_total_time;
        futhark_mc_task_236071_task.task_iter =
            &ctx->futhark_mc_segred_task_236072_total_iter;
        futhark_mc_task_236071_task.sched = STATIC;
        futhark_mc_task_236071_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236072_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236071_task);
        
        if (futhark_mc_segred_task_236072_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219300.mem)[gtid_229269] = defunc_2_reduce_res_229299;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236065_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236065_end -
                 futhark_mc_segmap_parloop_236065_start;
        
        ctx->futhark_mc_segmap_parloop_236065_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236065_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236065_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236063(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229268 = tid;
    int num_tasks_229384 = info.nsubtasks;
    struct futhark_mc_task_236059 *futhark_mc_task_236059 =
                                  (struct futhark_mc_task_236059 *) args;
    struct futhark_context *ctx = futhark_mc_task_236059->ctx;
    uint64_t futhark_mc_segmap_nested_task_236063_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236063_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236059->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236059->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236059->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236059->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236059->free_i_203670;
    int64_t gtid_212107 = futhark_mc_task_236059->free_gtid_212107;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236059->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236059->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236059->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236059->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236059->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236059->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236059->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219300 = {.desc ="mem_219300", .mem =
                                  futhark_mc_task_236059->free_mem_219300,
                                  .size =0, .references =NULL};
    int64_t iter_229435;
    struct futhark_mc_segmap_parloop_struct_236064
    futhark_mc_segmap_parloop_struct_236064;
    
    futhark_mc_segmap_parloop_struct_236064.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236064.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236064.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236064.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236064.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236064.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236064.free_gtid_212107 = gtid_212107;
    futhark_mc_segmap_parloop_struct_236064.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236064.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236064.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236064.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236064.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236064.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236064.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236064.free_mem_219300 = mem_219300.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236065_task;
    
    futhark_mc_segmap_parloop_236065_task.name =
        "futhark_mc_segmap_parloop_236065";
    futhark_mc_segmap_parloop_236065_task.fn = futhark_mc_segmap_parloop_236065;
    futhark_mc_segmap_parloop_236065_task.args =
        &futhark_mc_segmap_parloop_struct_236064;
    futhark_mc_segmap_parloop_236065_task.iterations = iterations;
    futhark_mc_segmap_parloop_236065_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236065_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236065_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236065_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236065_task);
    
    if (futhark_mc_segmap_parloop_236065_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236065_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236065_total_end -
                 futhark_mc_segmap_parloop_236065_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236065_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236065_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236065_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236063_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236063_end -
                 futhark_mc_segmap_nested_task_236063_start;
        
        ctx->futhark_mc_segmap_nested_task_236063_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236063_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236063_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236057(void *args, int64_t start,
                                            int64_t end, int flat_tid_212106,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236056
    *futhark_mc_segmap_parloop_struct_236056 =
    (struct futhark_mc_segmap_parloop_struct_236056 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236056->ctx;
    uint64_t futhark_mc_segmap_parloop_236057_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236057_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236056->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236056->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236056->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236056->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236056->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236056->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236056->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236056->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236056->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236056->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236056->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236056->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236056->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236056->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219319 = {.desc ="mem_219319", .mem =
                                  futhark_mc_segmap_parloop_struct_236056->free_mem_219319,
                                  .size =0, .references =NULL};
    size_t mem_219300_cached_sizze_236058 = 0;
    unsigned char *mem_219300 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229267 = start;
    
    if (mem_219300_cached_sizze_236058 < (size_t) bytes_217720) {
        mem_219300 = realloc(mem_219300, bytes_217720);
        mem_219300_cached_sizze_236058 = bytes_217720;
    }
    for (; iter_229267 < end; iter_229267++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229382 = partition_sizze_203577;
        int64_t gtid_212107 = iter_229267;
        int64_t remnant_229383 = iter_229267 - gtid_212107;
        int64_t flat_tid_229327 = (int64_t) 0;
        int32_t num_tasks_229384;
        int64_t flat_tid_229268 = (int64_t) 0;
        struct futhark_mc_task_236059 futhark_mc_task_236059;
        
        futhark_mc_task_236059.ctx = ctx;
        futhark_mc_task_236059.free_n_203490 = n_203490;
        futhark_mc_task_236059.free_q_l_203495 = q_l_203495;
        futhark_mc_task_236059.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236059.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_236059.free_i_203670 = i_203670;
        futhark_mc_task_236059.free_gtid_212107 = gtid_212107;
        futhark_mc_task_236059.free_mem_217773 = mem_217773.mem;
        futhark_mc_task_236059.free_mem_217777 = mem_217777.mem;
        futhark_mc_task_236059.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236059.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236059.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236059.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236059.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236059.free_mem_219300 = mem_219300;
        
        struct scheduler_segop futhark_mc_task_236059_task;
        
        futhark_mc_task_236059_task.args = &futhark_mc_task_236059;
        futhark_mc_task_236059_task.top_level_fn =
            futhark_mc_segmap_task_236060;
        futhark_mc_task_236059_task.name = "futhark_mc_segmap_task_236060";
        futhark_mc_task_236059_task.iterations = l_n_m_203643;
        futhark_mc_task_236059_task.task_time =
            &ctx->futhark_mc_segmap_task_236060_total_time;
        futhark_mc_task_236059_task.task_iter =
            &ctx->futhark_mc_segmap_task_236060_total_iter;
        futhark_mc_task_236059_task.sched = STATIC;
        futhark_mc_task_236059_task.nested_fn =
            futhark_mc_segmap_nested_task_236063;
        
        int futhark_mc_segmap_task_236060_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236059_task);
        
        if (futhark_mc_segmap_task_236060_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219319.mem + gtid_212107 * l_n_m_203643 * (int64_t) 8,
                    mem_219300 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219300);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236057_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236057_end -
                 futhark_mc_segmap_parloop_236057_start;
        
        ctx->futhark_mc_segmap_parloop_236057_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236057_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236057_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236055(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212106 = tid;
    int num_tasks_229204 = info.nsubtasks;
    struct futhark_mc_task_236050 *futhark_mc_task_236050 =
                                  (struct futhark_mc_task_236050 *) args;
    struct futhark_context *ctx = futhark_mc_task_236050->ctx;
    uint64_t futhark_mc_segmap_nested_task_236055_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236055_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236050->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236050->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236050->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236050->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236050->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236050->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236050->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236050->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236050->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236050->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236050->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236050->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236050->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236050->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219319 = {.desc ="mem_219319", .mem =
                                  futhark_mc_task_236050->free_mem_219319,
                                  .size =0, .references =NULL};
    int64_t iter_229267;
    struct futhark_mc_segmap_parloop_struct_236056
    futhark_mc_segmap_parloop_struct_236056;
    
    futhark_mc_segmap_parloop_struct_236056.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236056.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236056.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236056.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236056.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236056.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236056.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236056.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236056.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236056.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236056.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236056.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236056.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236056.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236056.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236056.free_mem_219319 = mem_219319.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236057_task;
    
    futhark_mc_segmap_parloop_236057_task.name =
        "futhark_mc_segmap_parloop_236057";
    futhark_mc_segmap_parloop_236057_task.fn = futhark_mc_segmap_parloop_236057;
    futhark_mc_segmap_parloop_236057_task.args =
        &futhark_mc_segmap_parloop_struct_236056;
    futhark_mc_segmap_parloop_236057_task.iterations = iterations;
    futhark_mc_segmap_parloop_236057_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236057_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236057_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236057_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236057_task);
    
    if (futhark_mc_segmap_parloop_236057_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236057_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236057_total_end -
                 futhark_mc_segmap_parloop_236057_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236057_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236057_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236057_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236055_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236055_end -
                 futhark_mc_segmap_nested_task_236055_start;
        
        ctx->futhark_mc_segmap_nested_task_236055_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236055_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236055_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236076 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219359;
    unsigned char *free_mem_219363;
};
struct futhark_mc_segmap_parloop_struct_236078 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219359;
    unsigned char *free_mem_219363;
};
static int futhark_mc_segmap_parloop_236079(void *args, int64_t start,
                                            int64_t end, int flat_tid_212233,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236078
    *futhark_mc_segmap_parloop_struct_236078 =
    (struct futhark_mc_segmap_parloop_struct_236078 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236078->ctx;
    uint64_t futhark_mc_segmap_parloop_236079_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236079_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236078->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236078->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236078->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236078->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236078->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236078->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236078->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236078->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236078->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236078->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236078->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236078->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236078->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236078->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219359 = {.desc ="mem_219359", .mem =
                                  futhark_mc_segmap_parloop_struct_236078->free_mem_219359,
                                  .size =0, .references =NULL};
    struct memblock mem_219363 = {.desc ="mem_219363", .mem =
                                  futhark_mc_segmap_parloop_struct_236078->free_mem_219363,
                                  .size =0, .references =NULL};
    size_t mem_219328_cached_sizze_236080 = 0;
    unsigned char *mem_219328 = NULL;
    size_t mem_219331_cached_sizze_236081 = 0;
    unsigned char *mem_219331 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229506 = start;
    
    if (mem_219328_cached_sizze_236080 < (size_t) bytes_217720) {
        mem_219328 = realloc(mem_219328, bytes_217720);
        mem_219328_cached_sizze_236080 = bytes_217720;
    }
    if (mem_219331_cached_sizze_236081 < (size_t) bytes_217720) {
        mem_219331 = realloc(mem_219331, bytes_217720);
        mem_219331_cached_sizze_236081 = bytes_217720;
    }
    for (; iter_229506 < end; iter_229506++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229590 = partition_sizze_203577;
        int64_t gtid_212234 = iter_229506;
        int64_t remnant_229591 = iter_229506 - gtid_212234;
        
        for (int64_t i_229507 = 0; i_229507 < l_n_m_203643; i_229507++) {
            int64_t x_229510;
            
            x_229510 = ((int64_t *) mem_217773.mem)[gtid_212234 * l_n_m_203643 +
                                                    i_229507];
            
            double x_229511;
            
            x_229511 = ((double *) mem_217777.mem)[gtid_212234 * l_n_m_203643 +
                                                   i_229507];
            
            int64_t min_arg_229512 = mul64(jump_t_203500, i_229507);
            int64_t min_res_229513 = smin64(i_203670, min_arg_229512);
            int64_t defunc_0_g_res_229514 = add64((int64_t) 1, min_res_229513);
            double defunc_2_reduce_res_229515;
            double defunc_2_reduce_res_229516;
            double defunc_2_reduce_res_229517;
            double redout_229519;
            double redout_229520;
            double redout_229521;
            
            redout_229519 = 0.0;
            redout_229520 = 0.0;
            redout_229521 = 0.0;
            for (int64_t i_229518 = 0; i_229518 < q_l_203495; i_229518++) {
                bool cond_229522 = sle64(n_203490, i_229518);
                int64_t defunc_0_f_res_229523;
                
                if (cond_229522) {
                    defunc_0_f_res_229523 = (int64_t) 0;
                } else {
                    int64_t i_229524 = add64(x_229510, i_229518);
                    int64_t defunc_1_add_res_229525 = add64((int64_t) 1,
                                                            i_229524);
                    
                    defunc_0_f_res_229523 = defunc_1_add_res_229525;
                }
                
                double defunc_0_f_res_229526;
                
                if (cond_229522) {
                    defunc_0_f_res_229526 = 0.0;
                } else {
                    int64_t i_229527 = add64(x_229510, i_229518);
                    double defunc_0_add_arg_229528;
                    
                    defunc_0_add_arg_229528 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_212234 *
                                                           ctx_param_ext_217867 +
                                                           i_229527 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_229526 = defunc_0_add_arg_229528;
                }
                
                int64_t binop_p_229529 = sub64(defunc_0_f_res_229523,
                                               defunc_0_g_res_229514);
                double defunc_0_f_res_229530 = sitofp_i64_f64(binop_p_229529);
                double abs_res_229531 = fabs(defunc_0_f_res_229530);
                double tmp1_229532 = abs_res_229531 / x_229511;
                double x_229533 = tmp1_229532 * tmp1_229532;
                double y_229534 = tmp1_229532 * x_229533;
                double tmp2_229535 = 1.0 - y_229534;
                double x_229536 = tmp2_229535 * tmp2_229535;
                double tmp3_229537 = tmp2_229535 * x_229536;
                double w_j_229538 = defunc_0_f_res_229526 * tmp3_229537;
                double xw_j_229539 = defunc_0_f_res_229530 * w_j_229538;
                double x2w_j_229540 = defunc_0_f_res_229530 * xw_j_229539;
                double defunc_1_op_res_229541 = w_j_229538 + redout_229519;
                double defunc_1_op_res_229542 = xw_j_229539 + redout_229520;
                double defunc_1_op_res_229543 = x2w_j_229540 + redout_229521;
                double redout_tmp_229594 = defunc_1_op_res_229541;
                double redout_tmp_229595 = defunc_1_op_res_229542;
                double redout_tmp_229596 = defunc_1_op_res_229543;
                
                redout_229519 = redout_tmp_229594;
                redout_229520 = redout_tmp_229595;
                redout_229521 = redout_tmp_229596;
            }
            defunc_2_reduce_res_229515 = redout_229519;
            defunc_2_reduce_res_229516 = redout_229520;
            defunc_2_reduce_res_229517 = redout_229521;
            
            double x_229544 = defunc_2_reduce_res_229515 *
                   defunc_2_reduce_res_229517;
            double y_229545 = defunc_2_reduce_res_229516 *
                   defunc_2_reduce_res_229516;
            double y_229546 = x_229544 - y_229545;
            double det1_229547 = 1.0 / y_229546;
            double a11_229548 = defunc_2_reduce_res_229517 * det1_229547;
            double x_229549 = 0.0 - defunc_2_reduce_res_229516;
            double b11_229550 = det1_229547 * x_229549;
            double c11_229551 = defunc_2_reduce_res_229515 * det1_229547;
            double defunc_2_reduce_res_229552;
            double defunc_2_reduce_res_229553;
            double redout_229555;
            double redout_229556;
            
            redout_229555 = 0.0;
            redout_229556 = 0.0;
            for (int64_t i_229554 = 0; i_229554 < q_l_203495; i_229554++) {
                bool cond_229557 = sle64(n_203490, i_229554);
                int64_t defunc_0_f_res_229558;
                
                if (cond_229557) {
                    defunc_0_f_res_229558 = (int64_t) 0;
                } else {
                    int64_t i_229559 = add64(x_229510, i_229554);
                    int64_t defunc_1_add_res_229560 = add64((int64_t) 1,
                                                            i_229559);
                    
                    defunc_0_f_res_229558 = defunc_1_add_res_229560;
                }
                
                double defunc_0_f_res_229561;
                
                if (cond_229557) {
                    defunc_0_f_res_229561 = 0.0;
                } else {
                    int64_t i_229562 = add64(x_229510, i_229554);
                    double defunc_0_add_arg_229563;
                    
                    defunc_0_add_arg_229563 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_212234 *
                                                           ctx_param_ext_217867 +
                                                           i_229562 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_229561 = defunc_0_add_arg_229563;
                }
                
                int64_t binop_p_229564 = sub64(defunc_0_f_res_229558,
                                               defunc_0_g_res_229514);
                double defunc_0_f_res_229565 = sitofp_i64_f64(binop_p_229564);
                double abs_res_229566 = fabs(defunc_0_f_res_229565);
                double tmp1_229567 = abs_res_229566 / x_229511;
                double x_229568 = tmp1_229567 * tmp1_229567;
                double y_229569 = tmp1_229567 * x_229568;
                double tmp2_229570 = 1.0 - y_229569;
                double x_229571 = tmp2_229570 * tmp2_229570;
                double tmp3_229572 = tmp2_229570 * x_229571;
                double tmp4_229573 = defunc_0_f_res_229561 * tmp3_229572;
                double defunc_1_f_res_229574 = defunc_0_f_res_229565 *
                       tmp4_229573;
                double defunc_0_f_res_229575;
                
                if (cond_229557) {
                    defunc_0_f_res_229575 = 0.0;
                } else {
                    int64_t i_229576 = add64(x_229510, i_229554);
                    double defunc_0_add_arg_229577;
                    
                    defunc_0_add_arg_229577 =
                        ((double *) mem_219293.mem)[gtid_212234 * n_203490 +
                                                    i_229576];
                    defunc_0_f_res_229575 = defunc_0_add_arg_229577;
                }
                
                double x_229578 = a11_229548 * tmp4_229573;
                double y_229579 = b11_229550 * defunc_1_f_res_229574;
                double x_229580 = x_229578 + y_229579;
                double defunc_9_fit_fun_res_229581 = defunc_0_f_res_229575 *
                       x_229580;
                double x_229582 = b11_229550 * tmp4_229573;
                double y_229583 = c11_229551 * defunc_1_f_res_229574;
                double x_229584 = x_229582 + y_229583;
                double defunc_9_slope_fun_res_229585 = defunc_0_f_res_229575 *
                       x_229584;
                double defunc_1_op_res_229586 = defunc_9_fit_fun_res_229581 +
                       redout_229555;
                double defunc_1_op_res_229587 = defunc_9_slope_fun_res_229585 +
                       redout_229556;
                double redout_tmp_229597 = defunc_1_op_res_229586;
                double redout_tmp_229598 = defunc_1_op_res_229587;
                
                redout_229555 = redout_tmp_229597;
                redout_229556 = redout_tmp_229598;
            }
            defunc_2_reduce_res_229552 = redout_229555;
            defunc_2_reduce_res_229553 = redout_229556;
            ((double *) mem_219328)[i_229507] = defunc_2_reduce_res_229552;
            ((double *) mem_219331)[i_229507] = defunc_2_reduce_res_229553;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219359.mem + gtid_212234 * l_n_m_203643 * (int64_t) 8,
                    mem_219328 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219363.mem + gtid_212234 * l_n_m_203643 * (int64_t) 8,
                    mem_219331 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219328);
    free(mem_219331);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236079_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236079_end -
                 futhark_mc_segmap_parloop_236079_start;
        
        ctx->futhark_mc_segmap_parloop_236079_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236079_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236079_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236077(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212233 = tid;
    int num_tasks_229505 = info.nsubtasks;
    struct futhark_mc_task_236076 *futhark_mc_task_236076 =
                                  (struct futhark_mc_task_236076 *) args;
    struct futhark_context *ctx = futhark_mc_task_236076->ctx;
    uint64_t futhark_mc_segmap_task_236077_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236077_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236076->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236076->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236076->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236076->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236076->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236076->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236076->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236076->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236076->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236076->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236076->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236076->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236076->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236076->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219359 = {.desc ="mem_219359", .mem =
                                  futhark_mc_task_236076->free_mem_219359,
                                  .size =0, .references =NULL};
    struct memblock mem_219363 = {.desc ="mem_219363", .mem =
                                  futhark_mc_task_236076->free_mem_219363,
                                  .size =0, .references =NULL};
    int64_t iter_229506;
    struct futhark_mc_segmap_parloop_struct_236078
    futhark_mc_segmap_parloop_struct_236078;
    
    futhark_mc_segmap_parloop_struct_236078.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236078.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236078.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236078.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236078.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236078.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236078.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236078.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236078.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236078.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236078.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236078.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236078.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236078.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236078.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236078.free_mem_219359 = mem_219359.mem;
    futhark_mc_segmap_parloop_struct_236078.free_mem_219363 = mem_219363.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236079_task;
    
    futhark_mc_segmap_parloop_236079_task.name =
        "futhark_mc_segmap_parloop_236079";
    futhark_mc_segmap_parloop_236079_task.fn = futhark_mc_segmap_parloop_236079;
    futhark_mc_segmap_parloop_236079_task.args =
        &futhark_mc_segmap_parloop_struct_236078;
    futhark_mc_segmap_parloop_236079_task.iterations = iterations;
    futhark_mc_segmap_parloop_236079_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236079_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236079_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236079_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236079_task);
    
    if (futhark_mc_segmap_parloop_236079_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236079_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236079_total_end -
                 futhark_mc_segmap_parloop_236079_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236079_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236079_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236079_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236077_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236077_end -
                 futhark_mc_segmap_task_236077_start;
        
        ctx->futhark_mc_segmap_task_236077_runs[tid]++;
        ctx->futhark_mc_segmap_task_236077_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236077_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236083 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219359;
    unsigned char *free_mem_219363;
};
struct futhark_mc_task_236087 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212336;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219322;
    unsigned char *free_mem_219325;
};
struct futhark_mc_segmap_parloop_struct_236089 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212336;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219322;
    unsigned char *free_mem_219325;
};
static int futhark_mc_segmap_parloop_236090(void *args, int64_t start,
                                            int64_t end, int flat_tid_229687,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236089
    *futhark_mc_segmap_parloop_struct_236089 =
    (struct futhark_mc_segmap_parloop_struct_236089 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236089->ctx;
    uint64_t futhark_mc_segmap_parloop_236090_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236090_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236089->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236089->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236089->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236089->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236089->free_i_203670;
    int64_t gtid_212336 =
            futhark_mc_segmap_parloop_struct_236089->free_gtid_212336;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236089->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236089->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236089->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236089->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236089->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236089->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236089->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219322 = {.desc ="mem_219322", .mem =
                                  futhark_mc_segmap_parloop_struct_236089->free_mem_219322,
                                  .size =0, .references =NULL};
    struct memblock mem_219325 = {.desc ="mem_219325", .mem =
                                  futhark_mc_segmap_parloop_struct_236089->free_mem_219325,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229770 = start;
    
    for (; iter_229770 < end; iter_229770++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229831 = l_n_m_203643;
        int64_t gtid_229688 = iter_229770;
        int64_t remnant_229832 = iter_229770 - gtid_229688;
        int64_t x_229689;
        
        x_229689 = ((int64_t *) mem_217773.mem)[gtid_212336 * l_n_m_203643 +
                                                gtid_229688];
        
        double x_229690;
        
        x_229690 = ((double *) mem_217777.mem)[gtid_212336 * l_n_m_203643 +
                                               gtid_229688];
        
        int64_t min_arg_229691 = mul64(jump_t_203500, gtid_229688);
        int64_t min_res_229692 = smin64(i_203670, min_arg_229691);
        int64_t defunc_0_g_res_229693 = add64((int64_t) 1, min_res_229692);
        double defunc_2_reduce_res_229694;
        double defunc_2_reduce_res_229695;
        double defunc_2_reduce_res_229696;
        double redout_229772;
        double redout_229773;
        double redout_229774;
        
        redout_229772 = 0.0;
        redout_229773 = 0.0;
        redout_229774 = 0.0;
        for (int64_t i_229771 = 0; i_229771 < q_l_203495; i_229771++) {
            bool cond_229775 = sle64(n_203490, i_229771);
            int64_t defunc_0_f_res_229776;
            
            if (cond_229775) {
                defunc_0_f_res_229776 = (int64_t) 0;
            } else {
                int64_t i_229777 = add64(x_229689, i_229771);
                int64_t defunc_1_add_res_229778 = add64((int64_t) 1, i_229777);
                
                defunc_0_f_res_229776 = defunc_1_add_res_229778;
            }
            
            double defunc_0_f_res_229779;
            
            if (cond_229775) {
                defunc_0_f_res_229779 = 0.0;
            } else {
                int64_t i_229780 = add64(x_229689, i_229771);
                double defunc_0_add_arg_229781;
                
                defunc_0_add_arg_229781 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_212336 *
                                                       ctx_param_ext_217867 +
                                                       i_229780 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_229779 = defunc_0_add_arg_229781;
            }
            
            int64_t binop_p_229782 = sub64(defunc_0_f_res_229776,
                                           defunc_0_g_res_229693);
            double defunc_0_f_res_229783 = sitofp_i64_f64(binop_p_229782);
            double abs_res_229784 = fabs(defunc_0_f_res_229783);
            double tmp1_229785 = abs_res_229784 / x_229690;
            double x_229786 = tmp1_229785 * tmp1_229785;
            double y_229787 = tmp1_229785 * x_229786;
            double tmp2_229788 = 1.0 - y_229787;
            double x_229789 = tmp2_229788 * tmp2_229788;
            double tmp3_229790 = tmp2_229788 * x_229789;
            double w_j_229791 = defunc_0_f_res_229779 * tmp3_229790;
            double xw_j_229792 = defunc_0_f_res_229783 * w_j_229791;
            double x2w_j_229793 = defunc_0_f_res_229783 * xw_j_229792;
            double defunc_1_op_res_229794 = w_j_229791 + redout_229772;
            double defunc_1_op_res_229795 = xw_j_229792 + redout_229773;
            double defunc_1_op_res_229796 = x2w_j_229793 + redout_229774;
            double redout_tmp_229833 = defunc_1_op_res_229794;
            double redout_tmp_229834 = defunc_1_op_res_229795;
            double redout_tmp_229835 = defunc_1_op_res_229796;
            
            redout_229772 = redout_tmp_229833;
            redout_229773 = redout_tmp_229834;
            redout_229774 = redout_tmp_229835;
        }
        defunc_2_reduce_res_229694 = redout_229772;
        defunc_2_reduce_res_229695 = redout_229773;
        defunc_2_reduce_res_229696 = redout_229774;
        
        double x_229723 = defunc_2_reduce_res_229694 *
               defunc_2_reduce_res_229696;
        double y_229724 = defunc_2_reduce_res_229695 *
               defunc_2_reduce_res_229695;
        double y_229725 = x_229723 - y_229724;
        double det1_229726 = 1.0 / y_229725;
        double a11_229727 = defunc_2_reduce_res_229696 * det1_229726;
        double x_229728 = 0.0 - defunc_2_reduce_res_229695;
        double b11_229729 = det1_229726 * x_229728;
        double c11_229730 = defunc_2_reduce_res_229694 * det1_229726;
        double defunc_2_reduce_res_229731;
        double defunc_2_reduce_res_229732;
        double redout_229798;
        double redout_229799;
        
        redout_229798 = 0.0;
        redout_229799 = 0.0;
        for (int64_t i_229797 = 0; i_229797 < q_l_203495; i_229797++) {
            bool cond_229800 = sle64(n_203490, i_229797);
            int64_t defunc_0_f_res_229801;
            
            if (cond_229800) {
                defunc_0_f_res_229801 = (int64_t) 0;
            } else {
                int64_t i_229802 = add64(x_229689, i_229797);
                int64_t defunc_1_add_res_229803 = add64((int64_t) 1, i_229802);
                
                defunc_0_f_res_229801 = defunc_1_add_res_229803;
            }
            
            double defunc_0_f_res_229804;
            
            if (cond_229800) {
                defunc_0_f_res_229804 = 0.0;
            } else {
                int64_t i_229805 = add64(x_229689, i_229797);
                double defunc_0_add_arg_229806;
                
                defunc_0_add_arg_229806 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_212336 *
                                                       ctx_param_ext_217867 +
                                                       i_229805 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_229804 = defunc_0_add_arg_229806;
            }
            
            int64_t binop_p_229807 = sub64(defunc_0_f_res_229801,
                                           defunc_0_g_res_229693);
            double defunc_0_f_res_229808 = sitofp_i64_f64(binop_p_229807);
            double abs_res_229809 = fabs(defunc_0_f_res_229808);
            double tmp1_229810 = abs_res_229809 / x_229690;
            double x_229811 = tmp1_229810 * tmp1_229810;
            double y_229812 = tmp1_229810 * x_229811;
            double tmp2_229813 = 1.0 - y_229812;
            double x_229814 = tmp2_229813 * tmp2_229813;
            double tmp3_229815 = tmp2_229813 * x_229814;
            double tmp4_229816 = defunc_0_f_res_229804 * tmp3_229815;
            double defunc_1_f_res_229817 = defunc_0_f_res_229808 * tmp4_229816;
            double defunc_0_f_res_229818;
            
            if (cond_229800) {
                defunc_0_f_res_229818 = 0.0;
            } else {
                int64_t i_229819 = add64(x_229689, i_229797);
                double defunc_0_add_arg_229820;
                
                defunc_0_add_arg_229820 =
                    ((double *) mem_219293.mem)[gtid_212336 * n_203490 +
                                                i_229819];
                defunc_0_f_res_229818 = defunc_0_add_arg_229820;
            }
            
            double x_229821 = a11_229727 * tmp4_229816;
            double y_229822 = b11_229729 * defunc_1_f_res_229817;
            double x_229823 = x_229821 + y_229822;
            double defunc_9_fit_fun_res_229824 = defunc_0_f_res_229818 *
                   x_229823;
            double x_229825 = b11_229729 * tmp4_229816;
            double y_229826 = c11_229730 * defunc_1_f_res_229817;
            double x_229827 = x_229825 + y_229826;
            double defunc_9_slope_fun_res_229828 = defunc_0_f_res_229818 *
                   x_229827;
            double defunc_1_op_res_229829 = defunc_9_fit_fun_res_229824 +
                   redout_229798;
            double defunc_1_op_res_229830 = defunc_9_slope_fun_res_229828 +
                   redout_229799;
            double redout_tmp_229836 = defunc_1_op_res_229829;
            double redout_tmp_229837 = defunc_1_op_res_229830;
            
            redout_229798 = redout_tmp_229836;
            redout_229799 = redout_tmp_229837;
        }
        defunc_2_reduce_res_229731 = redout_229798;
        defunc_2_reduce_res_229732 = redout_229799;
        ((double *) mem_219322.mem)[gtid_229688] = defunc_2_reduce_res_229731;
        ((double *) mem_219325.mem)[gtid_229688] = defunc_2_reduce_res_229732;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236090_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236090_end -
                 futhark_mc_segmap_parloop_236090_start;
        
        ctx->futhark_mc_segmap_parloop_236090_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236090_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236090_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236088(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229687 = tid;
    int num_tasks_229769 = info.nsubtasks;
    struct futhark_mc_task_236087 *futhark_mc_task_236087 =
                                  (struct futhark_mc_task_236087 *) args;
    struct futhark_context *ctx = futhark_mc_task_236087->ctx;
    uint64_t futhark_mc_segmap_task_236088_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236088_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236087->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236087->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236087->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236087->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236087->free_i_203670;
    int64_t gtid_212336 = futhark_mc_task_236087->free_gtid_212336;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236087->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236087->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236087->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236087->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236087->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236087->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236087->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219322 = {.desc ="mem_219322", .mem =
                                  futhark_mc_task_236087->free_mem_219322,
                                  .size =0, .references =NULL};
    struct memblock mem_219325 = {.desc ="mem_219325", .mem =
                                  futhark_mc_task_236087->free_mem_219325,
                                  .size =0, .references =NULL};
    int64_t iter_229770;
    struct futhark_mc_segmap_parloop_struct_236089
    futhark_mc_segmap_parloop_struct_236089;
    
    futhark_mc_segmap_parloop_struct_236089.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236089.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236089.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236089.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236089.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236089.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236089.free_gtid_212336 = gtid_212336;
    futhark_mc_segmap_parloop_struct_236089.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236089.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236089.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236089.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236089.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236089.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236089.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236089.free_mem_219322 = mem_219322.mem;
    futhark_mc_segmap_parloop_struct_236089.free_mem_219325 = mem_219325.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236090_task;
    
    futhark_mc_segmap_parloop_236090_task.name =
        "futhark_mc_segmap_parloop_236090";
    futhark_mc_segmap_parloop_236090_task.fn = futhark_mc_segmap_parloop_236090;
    futhark_mc_segmap_parloop_236090_task.args =
        &futhark_mc_segmap_parloop_struct_236089;
    futhark_mc_segmap_parloop_236090_task.iterations = iterations;
    futhark_mc_segmap_parloop_236090_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236090_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236090_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236090_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236090_task);
    
    if (futhark_mc_segmap_parloop_236090_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236090_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236090_total_end -
                 futhark_mc_segmap_parloop_236090_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236090_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236090_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236090_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236088_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236088_end -
                 futhark_mc_segmap_task_236088_start;
        
        ctx->futhark_mc_segmap_task_236088_runs[tid]++;
        ctx->futhark_mc_segmap_task_236088_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236088_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236092 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212336;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219322;
    unsigned char *free_mem_219325;
};
struct futhark_mc_task_236094 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212336;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_229602;
    double free_x_229603;
    int64_t free_defunc_0_g_res_229606;
    double *retval_defunc_2_reduce_res_229607;
    double *retval_defunc_2_reduce_res_229608;
    double *retval_defunc_2_reduce_res_229609;
};
struct futhark_mc_segred_stage_1_parloop_struct_236099 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212336;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_229602;
    double free_x_229603;
    int64_t free_defunc_0_g_res_229606;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229909;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229911;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229913;
};
static int futhark_mc_segred_stage_1_parloop_236100(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229839,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236099
    *futhark_mc_segred_stage_1_parloop_struct_236099 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236099 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236099->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236100_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236100_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236099->free_n_203490;
    int64_t gtid_212336 =
            futhark_mc_segred_stage_1_parloop_struct_236099->free_gtid_212336;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236099->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236099->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236099->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236099->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_229602 =
            futhark_mc_segred_stage_1_parloop_struct_236099->free_x_229602;
    double x_229603 =
           futhark_mc_segred_stage_1_parloop_struct_236099->free_x_229603;
    int64_t defunc_0_g_res_229606 =
            futhark_mc_segred_stage_1_parloop_struct_236099->free_defunc_0_g_res_229606;
    struct memblock reduce_stage_1_tid_res_arr_mem_229909 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229909",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236099->free_reduce_stage_1_tid_res_arr_mem_229909,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229911 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229911",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236099->free_reduce_stage_1_tid_res_arr_mem_229911,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229913 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229913",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236099->free_reduce_stage_1_tid_res_arr_mem_229913,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229915 = start;
    double x_229841;
    double x_229842;
    double x_229844;
    double x_229845;
    double x_229847;
    double x_229848;
    double local_acc_229916 = 0.0;
    double local_acc_229917 = 0.0;
    double local_acc_229918 = 0.0;
    
    for (; iter_229915 < end; iter_229915++) {
        int64_t gtid_229840 = iter_229915;
        bool cond_229850 = sle64(n_203490, gtid_229840);
        int64_t defunc_0_f_res_229851;
        
        if (cond_229850) {
            defunc_0_f_res_229851 = (int64_t) 0;
        } else {
            int64_t i_229852 = add64(x_229602, gtid_229840);
            int64_t defunc_1_add_res_229853 = add64((int64_t) 1, i_229852);
            
            defunc_0_f_res_229851 = defunc_1_add_res_229853;
        }
        
        double defunc_0_f_res_229854;
        
        if (cond_229850) {
            defunc_0_f_res_229854 = 0.0;
        } else {
            int64_t i_229855 = add64(x_229602, gtid_229840);
            double defunc_0_add_arg_229856;
            
            defunc_0_add_arg_229856 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_212336 *
                                                   ctx_param_ext_217867 +
                                                   i_229855 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_229854 = defunc_0_add_arg_229856;
        }
        
        int64_t binop_p_229857 = sub64(defunc_0_f_res_229851,
                                       defunc_0_g_res_229606);
        double defunc_0_f_res_229858 = sitofp_i64_f64(binop_p_229857);
        double abs_res_229859 = fabs(defunc_0_f_res_229858);
        double tmp1_229860 = abs_res_229859 / x_229603;
        double x_229861 = tmp1_229860 * tmp1_229860;
        double y_229862 = tmp1_229860 * x_229861;
        double tmp2_229863 = 1.0 - y_229862;
        double x_229864 = tmp2_229863 * tmp2_229863;
        double tmp3_229865 = tmp2_229863 * x_229864;
        double w_j_229866 = defunc_0_f_res_229854 * tmp3_229865;
        double xw_j_229867 = defunc_0_f_res_229858 * w_j_229866;
        double x2w_j_229868 = defunc_0_f_res_229858 * xw_j_229867;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_229841 = local_acc_229916;
        }
        // Load next params
        {
            x_229842 = w_j_229866;
        }
        // Red body
        {
            double defunc_1_op_res_229843 = x_229841 + x_229842;
            
            local_acc_229916 = defunc_1_op_res_229843;
        }
        // Load accum params
        {
            x_229844 = local_acc_229917;
        }
        // Load next params
        {
            x_229845 = xw_j_229867;
        }
        // Red body
        {
            double defunc_1_op_res_229846 = x_229844 + x_229845;
            
            local_acc_229917 = defunc_1_op_res_229846;
        }
        // Load accum params
        {
            x_229847 = local_acc_229918;
        }
        // Load next params
        {
            x_229848 = x2w_j_229868;
        }
        // Red body
        {
            double defunc_1_op_res_229849 = x_229847 + x_229848;
            
            local_acc_229918 = defunc_1_op_res_229849;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229909.mem)[flat_tid_229839] =
        local_acc_229916;
    ((double *) reduce_stage_1_tid_res_arr_mem_229911.mem)[flat_tid_229839] =
        local_acc_229917;
    ((double *) reduce_stage_1_tid_res_arr_mem_229913.mem)[flat_tid_229839] =
        local_acc_229918;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236100_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236100_end -
                 futhark_mc_segred_stage_1_parloop_236100_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236100_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236100_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236100_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236095(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229839 = tid;
    int num_tasks_229908 = info.nsubtasks;
    struct futhark_mc_task_236094 *futhark_mc_task_236094 =
                                  (struct futhark_mc_task_236094 *) args;
    struct futhark_context *ctx = futhark_mc_task_236094->ctx;
    uint64_t futhark_mc_segred_task_236095_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236095_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236094->free_n_203490;
    int64_t gtid_212336 = futhark_mc_task_236094->free_gtid_212336;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236094->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236094->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236094->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236094->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_229602 = futhark_mc_task_236094->free_x_229602;
    double x_229603 = futhark_mc_task_236094->free_x_229603;
    int64_t defunc_0_g_res_229606 =
            futhark_mc_task_236094->free_defunc_0_g_res_229606;
    double defunc_2_reduce_res_229607 =
           *futhark_mc_task_236094->retval_defunc_2_reduce_res_229607;
    double defunc_2_reduce_res_229608 =
           *futhark_mc_task_236094->retval_defunc_2_reduce_res_229608;
    double defunc_2_reduce_res_229609 =
           *futhark_mc_task_236094->retval_defunc_2_reduce_res_229609;
    size_t reduce_stage_1_tid_res_arr_mem_229909_cached_sizze_236096 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229909 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_229911_cached_sizze_236097 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229911 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_229913_cached_sizze_236098 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229913 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229909_cached_sizze_236096 <
        (size_t) ((int64_t) 8 * num_tasks_229908)) {
        reduce_stage_1_tid_res_arr_mem_229909 =
            realloc(reduce_stage_1_tid_res_arr_mem_229909, (int64_t) 8 *
                    num_tasks_229908);
        reduce_stage_1_tid_res_arr_mem_229909_cached_sizze_236096 =
            (int64_t) 8 * num_tasks_229908;
    }
    if (reduce_stage_1_tid_res_arr_mem_229911_cached_sizze_236097 <
        (size_t) ((int64_t) 8 * num_tasks_229908)) {
        reduce_stage_1_tid_res_arr_mem_229911 =
            realloc(reduce_stage_1_tid_res_arr_mem_229911, (int64_t) 8 *
                    num_tasks_229908);
        reduce_stage_1_tid_res_arr_mem_229911_cached_sizze_236097 =
            (int64_t) 8 * num_tasks_229908;
    }
    if (reduce_stage_1_tid_res_arr_mem_229913_cached_sizze_236098 <
        (size_t) ((int64_t) 8 * num_tasks_229908)) {
        reduce_stage_1_tid_res_arr_mem_229913 =
            realloc(reduce_stage_1_tid_res_arr_mem_229913, (int64_t) 8 *
                    num_tasks_229908);
        reduce_stage_1_tid_res_arr_mem_229913_cached_sizze_236098 =
            (int64_t) 8 * num_tasks_229908;
    }
    
    int64_t iter_229915;
    struct futhark_mc_segred_stage_1_parloop_struct_236099
    futhark_mc_segred_stage_1_parloop_struct_236099;
    
    futhark_mc_segred_stage_1_parloop_struct_236099.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_gtid_212336 =
        gtid_212336;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_x_229602 = x_229602;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_x_229603 = x_229603;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_defunc_0_g_res_229606 =
        defunc_0_g_res_229606;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_reduce_stage_1_tid_res_arr_mem_229909 =
        reduce_stage_1_tid_res_arr_mem_229909;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_reduce_stage_1_tid_res_arr_mem_229911 =
        reduce_stage_1_tid_res_arr_mem_229911;
    futhark_mc_segred_stage_1_parloop_struct_236099.free_reduce_stage_1_tid_res_arr_mem_229913 =
        reduce_stage_1_tid_res_arr_mem_229913;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236100_task;
    
    futhark_mc_segred_stage_1_parloop_236100_task.name =
        "futhark_mc_segred_stage_1_parloop_236100";
    futhark_mc_segred_stage_1_parloop_236100_task.fn =
        futhark_mc_segred_stage_1_parloop_236100;
    futhark_mc_segred_stage_1_parloop_236100_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236099;
    futhark_mc_segred_stage_1_parloop_236100_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236100_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236100_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236100_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236100_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236100_task);
    
    if (futhark_mc_segred_stage_1_parloop_236100_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236100_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236100_total_end -
                 futhark_mc_segred_stage_1_parloop_236100_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236100_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236100_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236100_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229607 = 0.0;
        defunc_2_reduce_res_229608 = 0.0;
        defunc_2_reduce_res_229609 = 0.0;
    }
    
    double x_229919;
    double x_229920;
    double x_229922;
    double x_229923;
    double x_229925;
    double x_229926;
    
    for (int32_t i_229928 = 0; i_229928 < num_tasks_229908; i_229928++) {
        flat_tid_229839 = i_229928;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229919 = defunc_2_reduce_res_229607;
            }
            // load next params
            {
                x_229920 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229909)[flat_tid_229839];
            }
            // red body
            {
                double defunc_1_op_res_229921 = x_229919 + x_229920;
                
                defunc_2_reduce_res_229607 = defunc_1_op_res_229921;
            }
            // load acc params
            {
                x_229922 = defunc_2_reduce_res_229608;
            }
            // load next params
            {
                x_229923 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229911)[flat_tid_229839];
            }
            // red body
            {
                double defunc_1_op_res_229924 = x_229922 + x_229923;
                
                defunc_2_reduce_res_229608 = defunc_1_op_res_229924;
            }
            // load acc params
            {
                x_229925 = defunc_2_reduce_res_229609;
            }
            // load next params
            {
                x_229926 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229913)[flat_tid_229839];
            }
            // red body
            {
                double defunc_1_op_res_229927 = x_229925 + x_229926;
                
                defunc_2_reduce_res_229609 = defunc_1_op_res_229927;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229909);
        free(reduce_stage_1_tid_res_arr_mem_229911);
        free(reduce_stage_1_tid_res_arr_mem_229913);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236095_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236095_end -
                 futhark_mc_segred_task_236095_start;
        
        ctx->futhark_mc_segred_task_236095_runs[tid]++;
        ctx->futhark_mc_segred_task_236095_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236095_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236094->retval_defunc_2_reduce_res_229607 =
            defunc_2_reduce_res_229607;
        *futhark_mc_task_236094->retval_defunc_2_reduce_res_229608 =
            defunc_2_reduce_res_229608;
        *futhark_mc_task_236094->retval_defunc_2_reduce_res_229609 =
            defunc_2_reduce_res_229609;
    }
    return err;
}
struct futhark_mc_task_236101 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212336;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_x_229602;
    double free_x_229603;
    int64_t free_defunc_0_g_res_229606;
    double free_a11_229644;
    double free_b11_229646;
    double free_c11_229647;
    double *retval_defunc_2_reduce_res_229648;
    double *retval_defunc_2_reduce_res_229649;
};
struct futhark_mc_segred_stage_1_parloop_struct_236105 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212336;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_x_229602;
    double free_x_229603;
    int64_t free_defunc_0_g_res_229606;
    double free_a11_229644;
    double free_b11_229646;
    double free_c11_229647;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229930;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229932;
};
static int futhark_mc_segred_stage_1_parloop_236106(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229869,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236105
    *futhark_mc_segred_stage_1_parloop_struct_236105 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236105 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236105->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236106_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236106_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236105->free_n_203490;
    int64_t gtid_212336 =
            futhark_mc_segred_stage_1_parloop_struct_236105->free_gtid_212336;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236105->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236105->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236105->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236105->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236105->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_229602 =
            futhark_mc_segred_stage_1_parloop_struct_236105->free_x_229602;
    double x_229603 =
           futhark_mc_segred_stage_1_parloop_struct_236105->free_x_229603;
    int64_t defunc_0_g_res_229606 =
            futhark_mc_segred_stage_1_parloop_struct_236105->free_defunc_0_g_res_229606;
    double a11_229644 =
           futhark_mc_segred_stage_1_parloop_struct_236105->free_a11_229644;
    double b11_229646 =
           futhark_mc_segred_stage_1_parloop_struct_236105->free_b11_229646;
    double c11_229647 =
           futhark_mc_segred_stage_1_parloop_struct_236105->free_c11_229647;
    struct memblock reduce_stage_1_tid_res_arr_mem_229930 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229930",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236105->free_reduce_stage_1_tid_res_arr_mem_229930,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229932 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229932",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236105->free_reduce_stage_1_tid_res_arr_mem_229932,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229934 = start;
    double x_229871;
    double x_229872;
    double x_229874;
    double x_229875;
    double local_acc_229935 = 0.0;
    double local_acc_229936 = 0.0;
    
    for (; iter_229934 < end; iter_229934++) {
        int64_t gtid_229870 = iter_229934;
        bool cond_229877 = sle64(n_203490, gtid_229870);
        int64_t defunc_0_f_res_229878;
        
        if (cond_229877) {
            defunc_0_f_res_229878 = (int64_t) 0;
        } else {
            int64_t i_229879 = add64(x_229602, gtid_229870);
            int64_t defunc_1_add_res_229880 = add64((int64_t) 1, i_229879);
            
            defunc_0_f_res_229878 = defunc_1_add_res_229880;
        }
        
        double defunc_0_f_res_229881;
        
        if (cond_229877) {
            defunc_0_f_res_229881 = 0.0;
        } else {
            int64_t i_229882 = add64(x_229602, gtid_229870);
            double defunc_0_add_arg_229883;
            
            defunc_0_add_arg_229883 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_212336 *
                                                   ctx_param_ext_217867 +
                                                   i_229882 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_229881 = defunc_0_add_arg_229883;
        }
        
        int64_t binop_p_229884 = sub64(defunc_0_f_res_229878,
                                       defunc_0_g_res_229606);
        double defunc_0_f_res_229885 = sitofp_i64_f64(binop_p_229884);
        double abs_res_229886 = fabs(defunc_0_f_res_229885);
        double tmp1_229887 = abs_res_229886 / x_229603;
        double x_229888 = tmp1_229887 * tmp1_229887;
        double y_229889 = tmp1_229887 * x_229888;
        double tmp2_229890 = 1.0 - y_229889;
        double x_229891 = tmp2_229890 * tmp2_229890;
        double tmp3_229892 = tmp2_229890 * x_229891;
        double tmp4_229893 = defunc_0_f_res_229881 * tmp3_229892;
        double defunc_1_f_res_229894 = defunc_0_f_res_229885 * tmp4_229893;
        double defunc_0_f_res_229895;
        
        if (cond_229877) {
            defunc_0_f_res_229895 = 0.0;
        } else {
            int64_t i_229896 = add64(x_229602, gtid_229870);
            double defunc_0_add_arg_229897;
            
            defunc_0_add_arg_229897 = ((double *) mem_219293.mem)[gtid_212336 *
                                                                  n_203490 +
                                                                  i_229896];
            defunc_0_f_res_229895 = defunc_0_add_arg_229897;
        }
        
        double x_229898 = a11_229644 * tmp4_229893;
        double y_229899 = b11_229646 * defunc_1_f_res_229894;
        double x_229900 = x_229898 + y_229899;
        double defunc_9_fit_fun_res_229901 = defunc_0_f_res_229895 * x_229900;
        double x_229902 = b11_229646 * tmp4_229893;
        double y_229903 = c11_229647 * defunc_1_f_res_229894;
        double x_229904 = x_229902 + y_229903;
        double defunc_9_slope_fun_res_229905 = defunc_0_f_res_229895 * x_229904;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_229871 = local_acc_229935;
        }
        // Load next params
        {
            x_229872 = defunc_9_fit_fun_res_229901;
        }
        // Red body
        {
            double defunc_1_op_res_229873 = x_229871 + x_229872;
            
            local_acc_229935 = defunc_1_op_res_229873;
        }
        // Load accum params
        {
            x_229874 = local_acc_229936;
        }
        // Load next params
        {
            x_229875 = defunc_9_slope_fun_res_229905;
        }
        // Red body
        {
            double defunc_1_op_res_229876 = x_229874 + x_229875;
            
            local_acc_229936 = defunc_1_op_res_229876;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229930.mem)[flat_tid_229869] =
        local_acc_229935;
    ((double *) reduce_stage_1_tid_res_arr_mem_229932.mem)[flat_tid_229869] =
        local_acc_229936;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236106_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236106_end -
                 futhark_mc_segred_stage_1_parloop_236106_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236106_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236106_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236106_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236102(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229869 = tid;
    int num_tasks_229929 = info.nsubtasks;
    struct futhark_mc_task_236101 *futhark_mc_task_236101 =
                                  (struct futhark_mc_task_236101 *) args;
    struct futhark_context *ctx = futhark_mc_task_236101->ctx;
    uint64_t futhark_mc_segred_task_236102_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236102_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236101->free_n_203490;
    int64_t gtid_212336 = futhark_mc_task_236101->free_gtid_212336;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236101->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236101->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236101->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236101->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236101->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_229602 = futhark_mc_task_236101->free_x_229602;
    double x_229603 = futhark_mc_task_236101->free_x_229603;
    int64_t defunc_0_g_res_229606 =
            futhark_mc_task_236101->free_defunc_0_g_res_229606;
    double a11_229644 = futhark_mc_task_236101->free_a11_229644;
    double b11_229646 = futhark_mc_task_236101->free_b11_229646;
    double c11_229647 = futhark_mc_task_236101->free_c11_229647;
    double defunc_2_reduce_res_229648 =
           *futhark_mc_task_236101->retval_defunc_2_reduce_res_229648;
    double defunc_2_reduce_res_229649 =
           *futhark_mc_task_236101->retval_defunc_2_reduce_res_229649;
    size_t reduce_stage_1_tid_res_arr_mem_229930_cached_sizze_236103 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229930 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_229932_cached_sizze_236104 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229932 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229930_cached_sizze_236103 <
        (size_t) ((int64_t) 8 * num_tasks_229929)) {
        reduce_stage_1_tid_res_arr_mem_229930 =
            realloc(reduce_stage_1_tid_res_arr_mem_229930, (int64_t) 8 *
                    num_tasks_229929);
        reduce_stage_1_tid_res_arr_mem_229930_cached_sizze_236103 =
            (int64_t) 8 * num_tasks_229929;
    }
    if (reduce_stage_1_tid_res_arr_mem_229932_cached_sizze_236104 <
        (size_t) ((int64_t) 8 * num_tasks_229929)) {
        reduce_stage_1_tid_res_arr_mem_229932 =
            realloc(reduce_stage_1_tid_res_arr_mem_229932, (int64_t) 8 *
                    num_tasks_229929);
        reduce_stage_1_tid_res_arr_mem_229932_cached_sizze_236104 =
            (int64_t) 8 * num_tasks_229929;
    }
    
    int64_t iter_229934;
    struct futhark_mc_segred_stage_1_parloop_struct_236105
    futhark_mc_segred_stage_1_parloop_struct_236105;
    
    futhark_mc_segred_stage_1_parloop_struct_236105.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_gtid_212336 =
        gtid_212336;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_mem_219293 =
        mem_219293.mem;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_x_229602 = x_229602;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_x_229603 = x_229603;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_defunc_0_g_res_229606 =
        defunc_0_g_res_229606;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_a11_229644 =
        a11_229644;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_b11_229646 =
        b11_229646;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_c11_229647 =
        c11_229647;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_reduce_stage_1_tid_res_arr_mem_229930 =
        reduce_stage_1_tid_res_arr_mem_229930;
    futhark_mc_segred_stage_1_parloop_struct_236105.free_reduce_stage_1_tid_res_arr_mem_229932 =
        reduce_stage_1_tid_res_arr_mem_229932;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236106_task;
    
    futhark_mc_segred_stage_1_parloop_236106_task.name =
        "futhark_mc_segred_stage_1_parloop_236106";
    futhark_mc_segred_stage_1_parloop_236106_task.fn =
        futhark_mc_segred_stage_1_parloop_236106;
    futhark_mc_segred_stage_1_parloop_236106_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236105;
    futhark_mc_segred_stage_1_parloop_236106_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236106_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236106_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236106_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236106_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236106_task);
    
    if (futhark_mc_segred_stage_1_parloop_236106_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236106_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236106_total_end -
                 futhark_mc_segred_stage_1_parloop_236106_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236106_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236106_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236106_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229648 = 0.0;
        defunc_2_reduce_res_229649 = 0.0;
    }
    
    double x_229937;
    double x_229938;
    double x_229940;
    double x_229941;
    
    for (int32_t i_229943 = 0; i_229943 < num_tasks_229929; i_229943++) {
        flat_tid_229869 = i_229943;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229937 = defunc_2_reduce_res_229648;
            }
            // load next params
            {
                x_229938 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229930)[flat_tid_229869];
            }
            // red body
            {
                double defunc_1_op_res_229939 = x_229937 + x_229938;
                
                defunc_2_reduce_res_229648 = defunc_1_op_res_229939;
            }
            // load acc params
            {
                x_229940 = defunc_2_reduce_res_229649;
            }
            // load next params
            {
                x_229941 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229932)[flat_tid_229869];
            }
            // red body
            {
                double defunc_1_op_res_229942 = x_229940 + x_229941;
                
                defunc_2_reduce_res_229649 = defunc_1_op_res_229942;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229930);
        free(reduce_stage_1_tid_res_arr_mem_229932);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236102_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236102_end -
                 futhark_mc_segred_task_236102_start;
        
        ctx->futhark_mc_segred_task_236102_runs[tid]++;
        ctx->futhark_mc_segred_task_236102_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236102_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236101->retval_defunc_2_reduce_res_229648 =
            defunc_2_reduce_res_229648;
        *futhark_mc_task_236101->retval_defunc_2_reduce_res_229649 =
            defunc_2_reduce_res_229649;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236093(void *args, int64_t start,
                                            int64_t end, int flat_tid_229600,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236092
    *futhark_mc_segmap_parloop_struct_236092 =
    (struct futhark_mc_segmap_parloop_struct_236092 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236092->ctx;
    uint64_t futhark_mc_segmap_parloop_236093_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236093_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236092->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236092->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236092->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236092->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236092->free_i_203670;
    int64_t gtid_212336 =
            futhark_mc_segmap_parloop_struct_236092->free_gtid_212336;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236092->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236092->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236092->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236092->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236092->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236092->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236092->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219322 = {.desc ="mem_219322", .mem =
                                  futhark_mc_segmap_parloop_struct_236092->free_mem_219322,
                                  .size =0, .references =NULL};
    struct memblock mem_219325 = {.desc ="mem_219325", .mem =
                                  futhark_mc_segmap_parloop_struct_236092->free_mem_219325,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229838 = start;
    
    for (; iter_229838 < end; iter_229838++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229906 = l_n_m_203643;
        int64_t gtid_229601 = iter_229838;
        int64_t remnant_229907 = iter_229838 - gtid_229601;
        int64_t x_229602;
        
        x_229602 = ((int64_t *) mem_217773.mem)[gtid_212336 * l_n_m_203643 +
                                                gtid_229601];
        
        double x_229603;
        
        x_229603 = ((double *) mem_217777.mem)[gtid_212336 * l_n_m_203643 +
                                               gtid_229601];
        
        int64_t min_arg_229604 = mul64(jump_t_203500, gtid_229601);
        int64_t min_res_229605 = smin64(i_203670, min_arg_229604);
        int64_t defunc_0_g_res_229606 = add64((int64_t) 1, min_res_229605);
        double defunc_2_reduce_res_229607;
        double defunc_2_reduce_res_229608;
        double defunc_2_reduce_res_229609;
        int64_t flat_tid_229839 = (int64_t) 0;
        int32_t num_tasks_229908;
        
        defunc_2_reduce_res_229607 = 0.0;
        defunc_2_reduce_res_229608 = 0.0;
        defunc_2_reduce_res_229609 = 0.0;
        
        struct futhark_mc_task_236094 futhark_mc_task_236094;
        
        futhark_mc_task_236094.ctx = ctx;
        futhark_mc_task_236094.free_n_203490 = n_203490;
        futhark_mc_task_236094.free_gtid_212336 = gtid_212336;
        futhark_mc_task_236094.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236094.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236094.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236094.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236094.free_x_229602 = x_229602;
        futhark_mc_task_236094.free_x_229603 = x_229603;
        futhark_mc_task_236094.free_defunc_0_g_res_229606 =
            defunc_0_g_res_229606;
        futhark_mc_task_236094.retval_defunc_2_reduce_res_229607 =
            &defunc_2_reduce_res_229607;
        futhark_mc_task_236094.retval_defunc_2_reduce_res_229608 =
            &defunc_2_reduce_res_229608;
        futhark_mc_task_236094.retval_defunc_2_reduce_res_229609 =
            &defunc_2_reduce_res_229609;
        
        struct scheduler_segop futhark_mc_task_236094_task;
        
        futhark_mc_task_236094_task.args = &futhark_mc_task_236094;
        futhark_mc_task_236094_task.top_level_fn =
            futhark_mc_segred_task_236095;
        futhark_mc_task_236094_task.name = "futhark_mc_segred_task_236095";
        futhark_mc_task_236094_task.iterations = q_l_203495;
        futhark_mc_task_236094_task.task_time =
            &ctx->futhark_mc_segred_task_236095_total_time;
        futhark_mc_task_236094_task.task_iter =
            &ctx->futhark_mc_segred_task_236095_total_iter;
        futhark_mc_task_236094_task.sched = STATIC;
        futhark_mc_task_236094_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236095_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236094_task);
        
        if (futhark_mc_segred_task_236095_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_229640 = defunc_2_reduce_res_229607 *
               defunc_2_reduce_res_229609;
        double y_229641 = defunc_2_reduce_res_229608 *
               defunc_2_reduce_res_229608;
        double y_229642 = x_229640 - y_229641;
        double det1_229643 = 1.0 / y_229642;
        double a11_229644 = defunc_2_reduce_res_229609 * det1_229643;
        double x_229645 = 0.0 - defunc_2_reduce_res_229608;
        double b11_229646 = det1_229643 * x_229645;
        double c11_229647 = defunc_2_reduce_res_229607 * det1_229643;
        double defunc_2_reduce_res_229648;
        double defunc_2_reduce_res_229649;
        int64_t flat_tid_229869 = (int64_t) 0;
        int32_t num_tasks_229929;
        
        defunc_2_reduce_res_229648 = 0.0;
        defunc_2_reduce_res_229649 = 0.0;
        
        struct futhark_mc_task_236101 futhark_mc_task_236101;
        
        futhark_mc_task_236101.ctx = ctx;
        futhark_mc_task_236101.free_n_203490 = n_203490;
        futhark_mc_task_236101.free_gtid_212336 = gtid_212336;
        futhark_mc_task_236101.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236101.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236101.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236101.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236101.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236101.free_x_229602 = x_229602;
        futhark_mc_task_236101.free_x_229603 = x_229603;
        futhark_mc_task_236101.free_defunc_0_g_res_229606 =
            defunc_0_g_res_229606;
        futhark_mc_task_236101.free_a11_229644 = a11_229644;
        futhark_mc_task_236101.free_b11_229646 = b11_229646;
        futhark_mc_task_236101.free_c11_229647 = c11_229647;
        futhark_mc_task_236101.retval_defunc_2_reduce_res_229648 =
            &defunc_2_reduce_res_229648;
        futhark_mc_task_236101.retval_defunc_2_reduce_res_229649 =
            &defunc_2_reduce_res_229649;
        
        struct scheduler_segop futhark_mc_task_236101_task;
        
        futhark_mc_task_236101_task.args = &futhark_mc_task_236101;
        futhark_mc_task_236101_task.top_level_fn =
            futhark_mc_segred_task_236102;
        futhark_mc_task_236101_task.name = "futhark_mc_segred_task_236102";
        futhark_mc_task_236101_task.iterations = q_l_203495;
        futhark_mc_task_236101_task.task_time =
            &ctx->futhark_mc_segred_task_236102_total_time;
        futhark_mc_task_236101_task.task_iter =
            &ctx->futhark_mc_segred_task_236102_total_iter;
        futhark_mc_task_236101_task.sched = STATIC;
        futhark_mc_task_236101_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236102_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236101_task);
        
        if (futhark_mc_segred_task_236102_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219322.mem)[gtid_229601] = defunc_2_reduce_res_229648;
        ((double *) mem_219325.mem)[gtid_229601] = defunc_2_reduce_res_229649;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236093_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236093_end -
                 futhark_mc_segmap_parloop_236093_start;
        
        ctx->futhark_mc_segmap_parloop_236093_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236093_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236093_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236091(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229600 = tid;
    int num_tasks_229769 = info.nsubtasks;
    struct futhark_mc_task_236087 *futhark_mc_task_236087 =
                                  (struct futhark_mc_task_236087 *) args;
    struct futhark_context *ctx = futhark_mc_task_236087->ctx;
    uint64_t futhark_mc_segmap_nested_task_236091_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236091_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236087->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236087->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236087->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236087->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236087->free_i_203670;
    int64_t gtid_212336 = futhark_mc_task_236087->free_gtid_212336;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236087->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236087->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236087->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236087->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236087->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236087->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236087->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219322 = {.desc ="mem_219322", .mem =
                                  futhark_mc_task_236087->free_mem_219322,
                                  .size =0, .references =NULL};
    struct memblock mem_219325 = {.desc ="mem_219325", .mem =
                                  futhark_mc_task_236087->free_mem_219325,
                                  .size =0, .references =NULL};
    int64_t iter_229838;
    struct futhark_mc_segmap_parloop_struct_236092
    futhark_mc_segmap_parloop_struct_236092;
    
    futhark_mc_segmap_parloop_struct_236092.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236092.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236092.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236092.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236092.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236092.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236092.free_gtid_212336 = gtid_212336;
    futhark_mc_segmap_parloop_struct_236092.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236092.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236092.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236092.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236092.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236092.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236092.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236092.free_mem_219322 = mem_219322.mem;
    futhark_mc_segmap_parloop_struct_236092.free_mem_219325 = mem_219325.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236093_task;
    
    futhark_mc_segmap_parloop_236093_task.name =
        "futhark_mc_segmap_parloop_236093";
    futhark_mc_segmap_parloop_236093_task.fn = futhark_mc_segmap_parloop_236093;
    futhark_mc_segmap_parloop_236093_task.args =
        &futhark_mc_segmap_parloop_struct_236092;
    futhark_mc_segmap_parloop_236093_task.iterations = iterations;
    futhark_mc_segmap_parloop_236093_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236093_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236093_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236093_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236093_task);
    
    if (futhark_mc_segmap_parloop_236093_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236093_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236093_total_end -
                 futhark_mc_segmap_parloop_236093_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236093_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236093_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236093_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236091_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236091_end -
                 futhark_mc_segmap_nested_task_236091_start;
        
        ctx->futhark_mc_segmap_nested_task_236091_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236091_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236091_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236084(void *args, int64_t start,
                                            int64_t end, int flat_tid_212335,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236083
    *futhark_mc_segmap_parloop_struct_236083 =
    (struct futhark_mc_segmap_parloop_struct_236083 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236083->ctx;
    uint64_t futhark_mc_segmap_parloop_236084_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236084_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236083->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236083->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236083->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236083->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236083->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236083->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236083->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236083->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236083->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236083->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236083->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236083->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236083->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236083->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219359 = {.desc ="mem_219359", .mem =
                                  futhark_mc_segmap_parloop_struct_236083->free_mem_219359,
                                  .size =0, .references =NULL};
    struct memblock mem_219363 = {.desc ="mem_219363", .mem =
                                  futhark_mc_segmap_parloop_struct_236083->free_mem_219363,
                                  .size =0, .references =NULL};
    size_t mem_219322_cached_sizze_236085 = 0;
    unsigned char *mem_219322 = NULL;
    size_t mem_219325_cached_sizze_236086 = 0;
    unsigned char *mem_219325 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229599 = start;
    
    if (mem_219322_cached_sizze_236085 < (size_t) bytes_217720) {
        mem_219322 = realloc(mem_219322, bytes_217720);
        mem_219322_cached_sizze_236085 = bytes_217720;
    }
    if (mem_219325_cached_sizze_236086 < (size_t) bytes_217720) {
        mem_219325 = realloc(mem_219325, bytes_217720);
        mem_219325_cached_sizze_236086 = bytes_217720;
    }
    for (; iter_229599 < end; iter_229599++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229767 = partition_sizze_203577;
        int64_t gtid_212336 = iter_229599;
        int64_t remnant_229768 = iter_229599 - gtid_212336;
        int64_t flat_tid_229687 = (int64_t) 0;
        int32_t num_tasks_229769;
        int64_t flat_tid_229600 = (int64_t) 0;
        struct futhark_mc_task_236087 futhark_mc_task_236087;
        
        futhark_mc_task_236087.ctx = ctx;
        futhark_mc_task_236087.free_n_203490 = n_203490;
        futhark_mc_task_236087.free_q_l_203495 = q_l_203495;
        futhark_mc_task_236087.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236087.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_236087.free_i_203670 = i_203670;
        futhark_mc_task_236087.free_gtid_212336 = gtid_212336;
        futhark_mc_task_236087.free_mem_217773 = mem_217773.mem;
        futhark_mc_task_236087.free_mem_217777 = mem_217777.mem;
        futhark_mc_task_236087.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236087.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236087.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236087.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236087.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236087.free_mem_219322 = mem_219322;
        futhark_mc_task_236087.free_mem_219325 = mem_219325;
        
        struct scheduler_segop futhark_mc_task_236087_task;
        
        futhark_mc_task_236087_task.args = &futhark_mc_task_236087;
        futhark_mc_task_236087_task.top_level_fn =
            futhark_mc_segmap_task_236088;
        futhark_mc_task_236087_task.name = "futhark_mc_segmap_task_236088";
        futhark_mc_task_236087_task.iterations = l_n_m_203643;
        futhark_mc_task_236087_task.task_time =
            &ctx->futhark_mc_segmap_task_236088_total_time;
        futhark_mc_task_236087_task.task_iter =
            &ctx->futhark_mc_segmap_task_236088_total_iter;
        futhark_mc_task_236087_task.sched = STATIC;
        futhark_mc_task_236087_task.nested_fn =
            futhark_mc_segmap_nested_task_236091;
        
        int futhark_mc_segmap_task_236088_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236087_task);
        
        if (futhark_mc_segmap_task_236088_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219359.mem + gtid_212336 * l_n_m_203643 * (int64_t) 8,
                    mem_219322 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219363.mem + gtid_212336 * l_n_m_203643 * (int64_t) 8,
                    mem_219325 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219322);
    free(mem_219325);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236084_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236084_end -
                 futhark_mc_segmap_parloop_236084_start;
        
        ctx->futhark_mc_segmap_parloop_236084_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236084_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236084_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236082(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212335 = tid;
    int num_tasks_229505 = info.nsubtasks;
    struct futhark_mc_task_236076 *futhark_mc_task_236076 =
                                  (struct futhark_mc_task_236076 *) args;
    struct futhark_context *ctx = futhark_mc_task_236076->ctx;
    uint64_t futhark_mc_segmap_nested_task_236082_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236082_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236076->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236076->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236076->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236076->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236076->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236076->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236076->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236076->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236076->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236076->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236076->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236076->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236076->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236076->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219359 = {.desc ="mem_219359", .mem =
                                  futhark_mc_task_236076->free_mem_219359,
                                  .size =0, .references =NULL};
    struct memblock mem_219363 = {.desc ="mem_219363", .mem =
                                  futhark_mc_task_236076->free_mem_219363,
                                  .size =0, .references =NULL};
    int64_t iter_229599;
    struct futhark_mc_segmap_parloop_struct_236083
    futhark_mc_segmap_parloop_struct_236083;
    
    futhark_mc_segmap_parloop_struct_236083.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236083.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236083.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236083.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236083.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236083.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236083.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236083.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236083.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236083.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236083.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236083.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236083.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236083.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236083.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236083.free_mem_219359 = mem_219359.mem;
    futhark_mc_segmap_parloop_struct_236083.free_mem_219363 = mem_219363.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236084_task;
    
    futhark_mc_segmap_parloop_236084_task.name =
        "futhark_mc_segmap_parloop_236084";
    futhark_mc_segmap_parloop_236084_task.fn = futhark_mc_segmap_parloop_236084;
    futhark_mc_segmap_parloop_236084_task.args =
        &futhark_mc_segmap_parloop_struct_236083;
    futhark_mc_segmap_parloop_236084_task.iterations = iterations;
    futhark_mc_segmap_parloop_236084_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236084_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236084_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236084_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236084_task);
    
    if (futhark_mc_segmap_parloop_236084_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236084_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236084_total_end -
                 futhark_mc_segmap_parloop_236084_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236084_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236084_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236084_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236082_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236082_end -
                 futhark_mc_segmap_nested_task_236082_start;
        
        ctx->futhark_mc_segmap_nested_task_236082_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236082_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236082_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236107 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219403;
    unsigned char *free_mem_219407;
};
struct futhark_mc_segmap_parloop_struct_236109 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219403;
    unsigned char *free_mem_219407;
};
static int futhark_mc_segmap_parloop_236110(void *args, int64_t start,
                                            int64_t end, int flat_tid_212519,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236109
    *futhark_mc_segmap_parloop_struct_236109 =
    (struct futhark_mc_segmap_parloop_struct_236109 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236109->ctx;
    uint64_t futhark_mc_segmap_parloop_236110_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236110_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236109->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236109->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236109->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236109->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236109->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236109->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236109->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236109->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236109->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236109->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236109->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236109->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236109->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236109->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219403 = {.desc ="mem_219403", .mem =
                                  futhark_mc_segmap_parloop_struct_236109->free_mem_219403,
                                  .size =0, .references =NULL};
    struct memblock mem_219407 = {.desc ="mem_219407", .mem =
                                  futhark_mc_segmap_parloop_struct_236109->free_mem_219407,
                                  .size =0, .references =NULL};
    size_t mem_219372_cached_sizze_236111 = 0;
    unsigned char *mem_219372 = NULL;
    size_t mem_219375_cached_sizze_236112 = 0;
    unsigned char *mem_219375 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229945 = start;
    
    if (mem_219372_cached_sizze_236111 < (size_t) bytes_217720) {
        mem_219372 = realloc(mem_219372, bytes_217720);
        mem_219372_cached_sizze_236111 = bytes_217720;
    }
    if (mem_219375_cached_sizze_236112 < (size_t) bytes_217720) {
        mem_219375 = realloc(mem_219375, bytes_217720);
        mem_219375_cached_sizze_236112 = bytes_217720;
    }
    for (; iter_229945 < end; iter_229945++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230059 = partition_sizze_203577;
        int64_t gtid_212520 = iter_229945;
        int64_t remnant_230060 = iter_229945 - gtid_212520;
        
        for (int64_t i_229946 = 0; i_229946 < l_n_m_203643; i_229946++) {
            int64_t x_229949;
            
            x_229949 = ((int64_t *) mem_217773.mem)[gtid_212520 * l_n_m_203643 +
                                                    i_229946];
            
            double x_229950;
            
            x_229950 = ((double *) mem_217777.mem)[gtid_212520 * l_n_m_203643 +
                                                   i_229946];
            
            int64_t min_arg_229951 = mul64(jump_t_203500, i_229946);
            int64_t min_res_229952 = smin64(i_203670, min_arg_229951);
            int64_t defunc_0_g_res_229953 = add64((int64_t) 1, min_res_229952);
            double defunc_2_reduce_res_229954;
            double defunc_2_reduce_res_229955;
            double defunc_2_reduce_res_229956;
            double defunc_2_reduce_res_229957;
            double defunc_2_reduce_res_229958;
            double redout_229960;
            double redout_229961;
            double redout_229962;
            double redout_229963;
            double redout_229964;
            
            redout_229960 = 0.0;
            redout_229961 = 0.0;
            redout_229962 = 0.0;
            redout_229963 = 0.0;
            redout_229964 = 0.0;
            for (int64_t i_229959 = 0; i_229959 < q_l_203495; i_229959++) {
                bool cond_229965 = sle64(n_203490, i_229959);
                int64_t defunc_0_f_res_229966;
                
                if (cond_229965) {
                    defunc_0_f_res_229966 = (int64_t) 0;
                } else {
                    int64_t i_229967 = add64(x_229949, i_229959);
                    int64_t defunc_1_add_res_229968 = add64((int64_t) 1,
                                                            i_229967);
                    
                    defunc_0_f_res_229966 = defunc_1_add_res_229968;
                }
                
                double defunc_0_f_res_229969;
                
                if (cond_229965) {
                    defunc_0_f_res_229969 = 0.0;
                } else {
                    int64_t i_229970 = add64(x_229949, i_229959);
                    double defunc_0_add_arg_229971;
                    
                    defunc_0_add_arg_229971 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_212520 *
                                                           ctx_param_ext_217867 +
                                                           i_229970 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_229969 = defunc_0_add_arg_229971;
                }
                
                int64_t binop_p_229972 = sub64(defunc_0_f_res_229966,
                                               defunc_0_g_res_229953);
                double defunc_0_f_res_229973 = sitofp_i64_f64(binop_p_229972);
                double abs_res_229974 = fabs(defunc_0_f_res_229973);
                double tmp1_229975 = abs_res_229974 / x_229950;
                double x_229976 = tmp1_229975 * tmp1_229975;
                double y_229977 = tmp1_229975 * x_229976;
                double tmp2_229978 = 1.0 - y_229977;
                double x_229979 = tmp2_229978 * tmp2_229978;
                double tmp3_229980 = tmp2_229978 * x_229979;
                double w_j_229981 = defunc_0_f_res_229969 * tmp3_229980;
                double xw_j_229982 = defunc_0_f_res_229973 * w_j_229981;
                double x2w_j_229983 = defunc_0_f_res_229973 * xw_j_229982;
                double x3w_j_229984 = defunc_0_f_res_229973 * x2w_j_229983;
                double x4w_j_229985 = defunc_0_f_res_229973 * x3w_j_229984;
                double defunc_1_op_res_229986 = w_j_229981 + redout_229960;
                double defunc_1_op_res_229987 = xw_j_229982 + redout_229961;
                double defunc_1_op_res_229988 = x2w_j_229983 + redout_229962;
                double defunc_1_op_res_229989 = x3w_j_229984 + redout_229963;
                double defunc_1_op_res_229990 = x4w_j_229985 + redout_229964;
                double redout_tmp_230063 = defunc_1_op_res_229986;
                double redout_tmp_230064 = defunc_1_op_res_229987;
                double redout_tmp_230065 = defunc_1_op_res_229988;
                double redout_tmp_230066 = defunc_1_op_res_229989;
                double redout_tmp_230067 = defunc_1_op_res_229990;
                
                redout_229960 = redout_tmp_230063;
                redout_229961 = redout_tmp_230064;
                redout_229962 = redout_tmp_230065;
                redout_229963 = redout_tmp_230066;
                redout_229964 = redout_tmp_230067;
            }
            defunc_2_reduce_res_229954 = redout_229960;
            defunc_2_reduce_res_229955 = redout_229961;
            defunc_2_reduce_res_229956 = redout_229962;
            defunc_2_reduce_res_229957 = redout_229963;
            defunc_2_reduce_res_229958 = redout_229964;
            
            double x_229991 = defunc_2_reduce_res_229956 *
                   defunc_2_reduce_res_229958;
            double y_229992 = defunc_2_reduce_res_229957 *
                   defunc_2_reduce_res_229957;
            double a12_229993 = x_229991 - y_229992;
            double x_229994 = defunc_2_reduce_res_229956 *
                   defunc_2_reduce_res_229957;
            double y_229995 = defunc_2_reduce_res_229955 *
                   defunc_2_reduce_res_229958;
            double b12_229996 = x_229994 - y_229995;
            double x_229997 = defunc_2_reduce_res_229955 *
                   defunc_2_reduce_res_229957;
            double y_229998 = defunc_2_reduce_res_229956 *
                   defunc_2_reduce_res_229956;
            double c12_229999 = x_229997 - y_229998;
            double x_230000 = defunc_2_reduce_res_229954 *
                   defunc_2_reduce_res_229958;
            double b2_230001 = x_230000 - y_229998;
            double x_230002 = defunc_2_reduce_res_229955 *
                   defunc_2_reduce_res_229956;
            double y_230003 = defunc_2_reduce_res_229954 *
                   defunc_2_reduce_res_229957;
            double c2_230004 = x_230002 - y_230003;
            double x_230005 = defunc_2_reduce_res_229954 * a12_229993;
            double y_230006 = defunc_2_reduce_res_229955 * b12_229996;
            double x_230007 = x_230005 + y_230006;
            double y_230008 = defunc_2_reduce_res_229956 * c12_229999;
            double y_230009 = x_230007 + y_230008;
            double det_230010 = 1.0 / y_230009;
            double a12_230011 = a12_229993 * det_230010;
            double b12_230012 = b12_229996 * det_230010;
            double c12_230013 = c12_229999 * det_230010;
            double b2_230014 = b2_230001 * det_230010;
            double c2_230015 = c2_230004 * det_230010;
            double defunc_2_reduce_res_230016;
            double defunc_2_reduce_res_230017;
            double redout_230019;
            double redout_230020;
            
            redout_230019 = 0.0;
            redout_230020 = 0.0;
            for (int64_t i_230018 = 0; i_230018 < q_l_203495; i_230018++) {
                bool cond_230021 = sle64(n_203490, i_230018);
                int64_t defunc_0_f_res_230022;
                
                if (cond_230021) {
                    defunc_0_f_res_230022 = (int64_t) 0;
                } else {
                    int64_t i_230023 = add64(x_229949, i_230018);
                    int64_t defunc_1_add_res_230024 = add64((int64_t) 1,
                                                            i_230023);
                    
                    defunc_0_f_res_230022 = defunc_1_add_res_230024;
                }
                
                double defunc_0_f_res_230025;
                
                if (cond_230021) {
                    defunc_0_f_res_230025 = 0.0;
                } else {
                    int64_t i_230026 = add64(x_229949, i_230018);
                    double defunc_0_add_arg_230027;
                    
                    defunc_0_add_arg_230027 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_212520 *
                                                           ctx_param_ext_217867 +
                                                           i_230026 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_230025 = defunc_0_add_arg_230027;
                }
                
                int64_t binop_p_230028 = sub64(defunc_0_f_res_230022,
                                               defunc_0_g_res_229953);
                double defunc_0_f_res_230029 = sitofp_i64_f64(binop_p_230028);
                double abs_res_230030 = fabs(defunc_0_f_res_230029);
                double tmp1_230031 = abs_res_230030 / x_229950;
                double x_230032 = tmp1_230031 * tmp1_230031;
                double y_230033 = tmp1_230031 * x_230032;
                double tmp2_230034 = 1.0 - y_230033;
                double x_230035 = tmp2_230034 * tmp2_230034;
                double tmp3_230036 = tmp2_230034 * x_230035;
                double tmp4_230037 = defunc_0_f_res_230025 * tmp3_230036;
                double defunc_1_f_res_230038 = defunc_0_f_res_230029 *
                       tmp4_230037;
                double defunc_1_f_res_230039 = defunc_0_f_res_230029 *
                       defunc_1_f_res_230038;
                double defunc_0_f_res_230040;
                
                if (cond_230021) {
                    defunc_0_f_res_230040 = 0.0;
                } else {
                    int64_t i_230041 = add64(x_229949, i_230018);
                    double defunc_0_add_arg_230042;
                    
                    defunc_0_add_arg_230042 =
                        ((double *) mem_219293.mem)[gtid_212520 * n_203490 +
                                                    i_230041];
                    defunc_0_f_res_230040 = defunc_0_add_arg_230042;
                }
                
                double x_230043 = a12_230011 * tmp4_230037;
                double y_230044 = b12_230012 * defunc_1_f_res_230038;
                double x_230045 = x_230043 + y_230044;
                double y_230046 = c12_230013 * defunc_1_f_res_230039;
                double x_230047 = x_230045 + y_230046;
                double defunc_9_fit_fun_res_230048 = defunc_0_f_res_230040 *
                       x_230047;
                double x_230049 = b12_230012 * tmp4_230037;
                double y_230050 = b2_230014 * defunc_1_f_res_230038;
                double x_230051 = x_230049 + y_230050;
                double y_230052 = c2_230015 * defunc_1_f_res_230039;
                double x_230053 = x_230051 + y_230052;
                double defunc_9_slope_fun_res_230054 = defunc_0_f_res_230040 *
                       x_230053;
                double defunc_1_op_res_230055 = defunc_9_fit_fun_res_230048 +
                       redout_230019;
                double defunc_1_op_res_230056 = defunc_9_slope_fun_res_230054 +
                       redout_230020;
                double redout_tmp_230068 = defunc_1_op_res_230055;
                double redout_tmp_230069 = defunc_1_op_res_230056;
                
                redout_230019 = redout_tmp_230068;
                redout_230020 = redout_tmp_230069;
            }
            defunc_2_reduce_res_230016 = redout_230019;
            defunc_2_reduce_res_230017 = redout_230020;
            ((double *) mem_219372)[i_229946] = defunc_2_reduce_res_230016;
            ((double *) mem_219375)[i_229946] = defunc_2_reduce_res_230017;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219403.mem + gtid_212520 * l_n_m_203643 * (int64_t) 8,
                    mem_219372 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219407.mem + gtid_212520 * l_n_m_203643 * (int64_t) 8,
                    mem_219375 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219372);
    free(mem_219375);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236110_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236110_end -
                 futhark_mc_segmap_parloop_236110_start;
        
        ctx->futhark_mc_segmap_parloop_236110_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236110_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236110_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236108(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212519 = tid;
    int num_tasks_229944 = info.nsubtasks;
    struct futhark_mc_task_236107 *futhark_mc_task_236107 =
                                  (struct futhark_mc_task_236107 *) args;
    struct futhark_context *ctx = futhark_mc_task_236107->ctx;
    uint64_t futhark_mc_segmap_task_236108_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236108_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236107->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236107->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236107->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236107->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236107->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236107->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236107->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236107->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236107->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236107->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236107->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236107->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236107->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236107->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219403 = {.desc ="mem_219403", .mem =
                                  futhark_mc_task_236107->free_mem_219403,
                                  .size =0, .references =NULL};
    struct memblock mem_219407 = {.desc ="mem_219407", .mem =
                                  futhark_mc_task_236107->free_mem_219407,
                                  .size =0, .references =NULL};
    int64_t iter_229945;
    struct futhark_mc_segmap_parloop_struct_236109
    futhark_mc_segmap_parloop_struct_236109;
    
    futhark_mc_segmap_parloop_struct_236109.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236109.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236109.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236109.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236109.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236109.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236109.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236109.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236109.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236109.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236109.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236109.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236109.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236109.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236109.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236109.free_mem_219403 = mem_219403.mem;
    futhark_mc_segmap_parloop_struct_236109.free_mem_219407 = mem_219407.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236110_task;
    
    futhark_mc_segmap_parloop_236110_task.name =
        "futhark_mc_segmap_parloop_236110";
    futhark_mc_segmap_parloop_236110_task.fn = futhark_mc_segmap_parloop_236110;
    futhark_mc_segmap_parloop_236110_task.args =
        &futhark_mc_segmap_parloop_struct_236109;
    futhark_mc_segmap_parloop_236110_task.iterations = iterations;
    futhark_mc_segmap_parloop_236110_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236110_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236110_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236110_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236110_task);
    
    if (futhark_mc_segmap_parloop_236110_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236110_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236110_total_end -
                 futhark_mc_segmap_parloop_236110_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236110_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236110_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236110_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236108_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236108_end -
                 futhark_mc_segmap_task_236108_start;
        
        ctx->futhark_mc_segmap_task_236108_runs[tid]++;
        ctx->futhark_mc_segmap_task_236108_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236108_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236114 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219403;
    unsigned char *free_mem_219407;
};
struct futhark_mc_task_236118 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212654;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219366;
    unsigned char *free_mem_219369;
};
struct futhark_mc_segmap_parloop_struct_236120 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212654;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219366;
    unsigned char *free_mem_219369;
};
static int futhark_mc_segmap_parloop_236121(void *args, int64_t start,
                                            int64_t end, int flat_tid_230190,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236120
    *futhark_mc_segmap_parloop_struct_236120 =
    (struct futhark_mc_segmap_parloop_struct_236120 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236120->ctx;
    uint64_t futhark_mc_segmap_parloop_236121_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236121_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236120->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236120->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236120->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236120->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236120->free_i_203670;
    int64_t gtid_212654 =
            futhark_mc_segmap_parloop_struct_236120->free_gtid_212654;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236120->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236120->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236120->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236120->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236120->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236120->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236120->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219366 = {.desc ="mem_219366", .mem =
                                  futhark_mc_segmap_parloop_struct_236120->free_mem_219366,
                                  .size =0, .references =NULL};
    struct memblock mem_219369 = {.desc ="mem_219369", .mem =
                                  futhark_mc_segmap_parloop_struct_236120->free_mem_219369,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230303 = start;
    
    for (; iter_230303 < end; iter_230303++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230375 = l_n_m_203643;
        int64_t gtid_230191 = iter_230303;
        int64_t remnant_230376 = iter_230303 - gtid_230191;
        int64_t x_230192;
        
        x_230192 = ((int64_t *) mem_217773.mem)[gtid_212654 * l_n_m_203643 +
                                                gtid_230191];
        
        double x_230193;
        
        x_230193 = ((double *) mem_217777.mem)[gtid_212654 * l_n_m_203643 +
                                               gtid_230191];
        
        int64_t min_arg_230194 = mul64(jump_t_203500, gtid_230191);
        int64_t min_res_230195 = smin64(i_203670, min_arg_230194);
        int64_t defunc_0_g_res_230196 = add64((int64_t) 1, min_res_230195);
        double defunc_2_reduce_res_230197;
        double defunc_2_reduce_res_230198;
        double defunc_2_reduce_res_230199;
        double defunc_2_reduce_res_230200;
        double defunc_2_reduce_res_230201;
        double redout_230305;
        double redout_230306;
        double redout_230307;
        double redout_230308;
        double redout_230309;
        
        redout_230305 = 0.0;
        redout_230306 = 0.0;
        redout_230307 = 0.0;
        redout_230308 = 0.0;
        redout_230309 = 0.0;
        for (int64_t i_230304 = 0; i_230304 < q_l_203495; i_230304++) {
            bool cond_230310 = sle64(n_203490, i_230304);
            int64_t defunc_0_f_res_230311;
            
            if (cond_230310) {
                defunc_0_f_res_230311 = (int64_t) 0;
            } else {
                int64_t i_230312 = add64(x_230192, i_230304);
                int64_t defunc_1_add_res_230313 = add64((int64_t) 1, i_230312);
                
                defunc_0_f_res_230311 = defunc_1_add_res_230313;
            }
            
            double defunc_0_f_res_230314;
            
            if (cond_230310) {
                defunc_0_f_res_230314 = 0.0;
            } else {
                int64_t i_230315 = add64(x_230192, i_230304);
                double defunc_0_add_arg_230316;
                
                defunc_0_add_arg_230316 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_212654 *
                                                       ctx_param_ext_217867 +
                                                       i_230315 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_230314 = defunc_0_add_arg_230316;
            }
            
            int64_t binop_p_230317 = sub64(defunc_0_f_res_230311,
                                           defunc_0_g_res_230196);
            double defunc_0_f_res_230318 = sitofp_i64_f64(binop_p_230317);
            double abs_res_230319 = fabs(defunc_0_f_res_230318);
            double tmp1_230320 = abs_res_230319 / x_230193;
            double x_230321 = tmp1_230320 * tmp1_230320;
            double y_230322 = tmp1_230320 * x_230321;
            double tmp2_230323 = 1.0 - y_230322;
            double x_230324 = tmp2_230323 * tmp2_230323;
            double tmp3_230325 = tmp2_230323 * x_230324;
            double w_j_230326 = defunc_0_f_res_230314 * tmp3_230325;
            double xw_j_230327 = defunc_0_f_res_230318 * w_j_230326;
            double x2w_j_230328 = defunc_0_f_res_230318 * xw_j_230327;
            double x3w_j_230329 = defunc_0_f_res_230318 * x2w_j_230328;
            double x4w_j_230330 = defunc_0_f_res_230318 * x3w_j_230329;
            double defunc_1_op_res_230331 = w_j_230326 + redout_230305;
            double defunc_1_op_res_230332 = xw_j_230327 + redout_230306;
            double defunc_1_op_res_230333 = x2w_j_230328 + redout_230307;
            double defunc_1_op_res_230334 = x3w_j_230329 + redout_230308;
            double defunc_1_op_res_230335 = x4w_j_230330 + redout_230309;
            double redout_tmp_230377 = defunc_1_op_res_230331;
            double redout_tmp_230378 = defunc_1_op_res_230332;
            double redout_tmp_230379 = defunc_1_op_res_230333;
            double redout_tmp_230380 = defunc_1_op_res_230334;
            double redout_tmp_230381 = defunc_1_op_res_230335;
            
            redout_230305 = redout_tmp_230377;
            redout_230306 = redout_tmp_230378;
            redout_230307 = redout_tmp_230379;
            redout_230308 = redout_tmp_230380;
            redout_230309 = redout_tmp_230381;
        }
        defunc_2_reduce_res_230197 = redout_230305;
        defunc_2_reduce_res_230198 = redout_230306;
        defunc_2_reduce_res_230199 = redout_230307;
        defunc_2_reduce_res_230200 = redout_230308;
        defunc_2_reduce_res_230201 = redout_230309;
        
        double x_230234 = defunc_2_reduce_res_230199 *
               defunc_2_reduce_res_230201;
        double y_230235 = defunc_2_reduce_res_230200 *
               defunc_2_reduce_res_230200;
        double a12_230236 = x_230234 - y_230235;
        double x_230237 = defunc_2_reduce_res_230199 *
               defunc_2_reduce_res_230200;
        double y_230238 = defunc_2_reduce_res_230198 *
               defunc_2_reduce_res_230201;
        double b12_230239 = x_230237 - y_230238;
        double x_230240 = defunc_2_reduce_res_230198 *
               defunc_2_reduce_res_230200;
        double y_230241 = defunc_2_reduce_res_230199 *
               defunc_2_reduce_res_230199;
        double c12_230242 = x_230240 - y_230241;
        double x_230243 = defunc_2_reduce_res_230197 *
               defunc_2_reduce_res_230201;
        double b2_230244 = x_230243 - y_230241;
        double x_230245 = defunc_2_reduce_res_230198 *
               defunc_2_reduce_res_230199;
        double y_230246 = defunc_2_reduce_res_230197 *
               defunc_2_reduce_res_230200;
        double c2_230247 = x_230245 - y_230246;
        double x_230248 = defunc_2_reduce_res_230197 * a12_230236;
        double y_230249 = defunc_2_reduce_res_230198 * b12_230239;
        double x_230250 = x_230248 + y_230249;
        double y_230251 = defunc_2_reduce_res_230199 * c12_230242;
        double y_230252 = x_230250 + y_230251;
        double det_230253 = 1.0 / y_230252;
        double a12_230254 = a12_230236 * det_230253;
        double b12_230255 = b12_230239 * det_230253;
        double c12_230256 = c12_230242 * det_230253;
        double b2_230257 = b2_230244 * det_230253;
        double c2_230258 = c2_230247 * det_230253;
        double defunc_2_reduce_res_230259;
        double defunc_2_reduce_res_230260;
        double redout_230337;
        double redout_230338;
        
        redout_230337 = 0.0;
        redout_230338 = 0.0;
        for (int64_t i_230336 = 0; i_230336 < q_l_203495; i_230336++) {
            bool cond_230339 = sle64(n_203490, i_230336);
            int64_t defunc_0_f_res_230340;
            
            if (cond_230339) {
                defunc_0_f_res_230340 = (int64_t) 0;
            } else {
                int64_t i_230341 = add64(x_230192, i_230336);
                int64_t defunc_1_add_res_230342 = add64((int64_t) 1, i_230341);
                
                defunc_0_f_res_230340 = defunc_1_add_res_230342;
            }
            
            double defunc_0_f_res_230343;
            
            if (cond_230339) {
                defunc_0_f_res_230343 = 0.0;
            } else {
                int64_t i_230344 = add64(x_230192, i_230336);
                double defunc_0_add_arg_230345;
                
                defunc_0_add_arg_230345 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_212654 *
                                                       ctx_param_ext_217867 +
                                                       i_230344 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_230343 = defunc_0_add_arg_230345;
            }
            
            int64_t binop_p_230346 = sub64(defunc_0_f_res_230340,
                                           defunc_0_g_res_230196);
            double defunc_0_f_res_230347 = sitofp_i64_f64(binop_p_230346);
            double abs_res_230348 = fabs(defunc_0_f_res_230347);
            double tmp1_230349 = abs_res_230348 / x_230193;
            double x_230350 = tmp1_230349 * tmp1_230349;
            double y_230351 = tmp1_230349 * x_230350;
            double tmp2_230352 = 1.0 - y_230351;
            double x_230353 = tmp2_230352 * tmp2_230352;
            double tmp3_230354 = tmp2_230352 * x_230353;
            double tmp4_230355 = defunc_0_f_res_230343 * tmp3_230354;
            double defunc_1_f_res_230356 = defunc_0_f_res_230347 * tmp4_230355;
            double defunc_1_f_res_230357 = defunc_0_f_res_230347 *
                   defunc_1_f_res_230356;
            double defunc_0_f_res_230358;
            
            if (cond_230339) {
                defunc_0_f_res_230358 = 0.0;
            } else {
                int64_t i_230359 = add64(x_230192, i_230336);
                double defunc_0_add_arg_230360;
                
                defunc_0_add_arg_230360 =
                    ((double *) mem_219293.mem)[gtid_212654 * n_203490 +
                                                i_230359];
                defunc_0_f_res_230358 = defunc_0_add_arg_230360;
            }
            
            double x_230361 = a12_230254 * tmp4_230355;
            double y_230362 = b12_230255 * defunc_1_f_res_230356;
            double x_230363 = x_230361 + y_230362;
            double y_230364 = c12_230256 * defunc_1_f_res_230357;
            double x_230365 = x_230363 + y_230364;
            double defunc_9_fit_fun_res_230366 = defunc_0_f_res_230358 *
                   x_230365;
            double x_230367 = b12_230255 * tmp4_230355;
            double y_230368 = b2_230257 * defunc_1_f_res_230356;
            double x_230369 = x_230367 + y_230368;
            double y_230370 = c2_230258 * defunc_1_f_res_230357;
            double x_230371 = x_230369 + y_230370;
            double defunc_9_slope_fun_res_230372 = defunc_0_f_res_230358 *
                   x_230371;
            double defunc_1_op_res_230373 = defunc_9_fit_fun_res_230366 +
                   redout_230337;
            double defunc_1_op_res_230374 = defunc_9_slope_fun_res_230372 +
                   redout_230338;
            double redout_tmp_230382 = defunc_1_op_res_230373;
            double redout_tmp_230383 = defunc_1_op_res_230374;
            
            redout_230337 = redout_tmp_230382;
            redout_230338 = redout_tmp_230383;
        }
        defunc_2_reduce_res_230259 = redout_230337;
        defunc_2_reduce_res_230260 = redout_230338;
        ((double *) mem_219366.mem)[gtid_230191] = defunc_2_reduce_res_230259;
        ((double *) mem_219369.mem)[gtid_230191] = defunc_2_reduce_res_230260;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236121_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236121_end -
                 futhark_mc_segmap_parloop_236121_start;
        
        ctx->futhark_mc_segmap_parloop_236121_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236121_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236121_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236119(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230190 = tid;
    int num_tasks_230302 = info.nsubtasks;
    struct futhark_mc_task_236118 *futhark_mc_task_236118 =
                                  (struct futhark_mc_task_236118 *) args;
    struct futhark_context *ctx = futhark_mc_task_236118->ctx;
    uint64_t futhark_mc_segmap_task_236119_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236119_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236118->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236118->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236118->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236118->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236118->free_i_203670;
    int64_t gtid_212654 = futhark_mc_task_236118->free_gtid_212654;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236118->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236118->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236118->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236118->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236118->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236118->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236118->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219366 = {.desc ="mem_219366", .mem =
                                  futhark_mc_task_236118->free_mem_219366,
                                  .size =0, .references =NULL};
    struct memblock mem_219369 = {.desc ="mem_219369", .mem =
                                  futhark_mc_task_236118->free_mem_219369,
                                  .size =0, .references =NULL};
    int64_t iter_230303;
    struct futhark_mc_segmap_parloop_struct_236120
    futhark_mc_segmap_parloop_struct_236120;
    
    futhark_mc_segmap_parloop_struct_236120.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236120.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236120.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236120.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236120.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236120.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236120.free_gtid_212654 = gtid_212654;
    futhark_mc_segmap_parloop_struct_236120.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236120.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236120.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236120.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236120.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236120.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236120.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236120.free_mem_219366 = mem_219366.mem;
    futhark_mc_segmap_parloop_struct_236120.free_mem_219369 = mem_219369.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236121_task;
    
    futhark_mc_segmap_parloop_236121_task.name =
        "futhark_mc_segmap_parloop_236121";
    futhark_mc_segmap_parloop_236121_task.fn = futhark_mc_segmap_parloop_236121;
    futhark_mc_segmap_parloop_236121_task.args =
        &futhark_mc_segmap_parloop_struct_236120;
    futhark_mc_segmap_parloop_236121_task.iterations = iterations;
    futhark_mc_segmap_parloop_236121_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236121_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236121_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236121_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236121_task);
    
    if (futhark_mc_segmap_parloop_236121_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236121_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236121_total_end -
                 futhark_mc_segmap_parloop_236121_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236121_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236121_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236121_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236119_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236119_end -
                 futhark_mc_segmap_task_236119_start;
        
        ctx->futhark_mc_segmap_task_236119_runs[tid]++;
        ctx->futhark_mc_segmap_task_236119_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236119_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236123 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212654;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    unsigned char *free_mem_219366;
    unsigned char *free_mem_219369;
};
struct futhark_mc_task_236125 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212654;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_230073;
    double free_x_230074;
    int64_t free_defunc_0_g_res_230077;
    double *retval_defunc_2_reduce_res_230078;
    double *retval_defunc_2_reduce_res_230079;
    double *retval_defunc_2_reduce_res_230080;
    double *retval_defunc_2_reduce_res_230081;
    double *retval_defunc_2_reduce_res_230082;
};
struct futhark_mc_segred_stage_1_parloop_struct_236132 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212654;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_230073;
    double free_x_230074;
    int64_t free_defunc_0_g_res_230077;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230468;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230470;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230472;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230474;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230476;
};
static int futhark_mc_segred_stage_1_parloop_236133(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230385,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236132
    *futhark_mc_segred_stage_1_parloop_struct_236132 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236132 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236132->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236133_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236133_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236132->free_n_203490;
    int64_t gtid_212654 =
            futhark_mc_segred_stage_1_parloop_struct_236132->free_gtid_212654;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236132->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236132->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236132->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236132->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_230073 =
            futhark_mc_segred_stage_1_parloop_struct_236132->free_x_230073;
    double x_230074 =
           futhark_mc_segred_stage_1_parloop_struct_236132->free_x_230074;
    int64_t defunc_0_g_res_230077 =
            futhark_mc_segred_stage_1_parloop_struct_236132->free_defunc_0_g_res_230077;
    struct memblock reduce_stage_1_tid_res_arr_mem_230468 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230468",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236132->free_reduce_stage_1_tid_res_arr_mem_230468,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230470 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230470",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236132->free_reduce_stage_1_tid_res_arr_mem_230470,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230472 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230472",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236132->free_reduce_stage_1_tid_res_arr_mem_230472,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230474 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230474",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236132->free_reduce_stage_1_tid_res_arr_mem_230474,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230476 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230476",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236132->free_reduce_stage_1_tid_res_arr_mem_230476,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230478 = start;
    double x_230387;
    double x_230388;
    double x_230390;
    double x_230391;
    double x_230393;
    double x_230394;
    double x_230396;
    double x_230397;
    double x_230399;
    double x_230400;
    double local_acc_230479 = 0.0;
    double local_acc_230480 = 0.0;
    double local_acc_230481 = 0.0;
    double local_acc_230482 = 0.0;
    double local_acc_230483 = 0.0;
    
    for (; iter_230478 < end; iter_230478++) {
        int64_t gtid_230386 = iter_230478;
        bool cond_230402 = sle64(n_203490, gtid_230386);
        int64_t defunc_0_f_res_230403;
        
        if (cond_230402) {
            defunc_0_f_res_230403 = (int64_t) 0;
        } else {
            int64_t i_230404 = add64(x_230073, gtid_230386);
            int64_t defunc_1_add_res_230405 = add64((int64_t) 1, i_230404);
            
            defunc_0_f_res_230403 = defunc_1_add_res_230405;
        }
        
        double defunc_0_f_res_230406;
        
        if (cond_230402) {
            defunc_0_f_res_230406 = 0.0;
        } else {
            int64_t i_230407 = add64(x_230073, gtid_230386);
            double defunc_0_add_arg_230408;
            
            defunc_0_add_arg_230408 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_212654 *
                                                   ctx_param_ext_217867 +
                                                   i_230407 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_230406 = defunc_0_add_arg_230408;
        }
        
        int64_t binop_p_230409 = sub64(defunc_0_f_res_230403,
                                       defunc_0_g_res_230077);
        double defunc_0_f_res_230410 = sitofp_i64_f64(binop_p_230409);
        double abs_res_230411 = fabs(defunc_0_f_res_230410);
        double tmp1_230412 = abs_res_230411 / x_230074;
        double x_230413 = tmp1_230412 * tmp1_230412;
        double y_230414 = tmp1_230412 * x_230413;
        double tmp2_230415 = 1.0 - y_230414;
        double x_230416 = tmp2_230415 * tmp2_230415;
        double tmp3_230417 = tmp2_230415 * x_230416;
        double w_j_230418 = defunc_0_f_res_230406 * tmp3_230417;
        double xw_j_230419 = defunc_0_f_res_230410 * w_j_230418;
        double x2w_j_230420 = defunc_0_f_res_230410 * xw_j_230419;
        double x3w_j_230421 = defunc_0_f_res_230410 * x2w_j_230420;
        double x4w_j_230422 = defunc_0_f_res_230410 * x3w_j_230421;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230387 = local_acc_230479;
        }
        // Load next params
        {
            x_230388 = w_j_230418;
        }
        // Red body
        {
            double defunc_1_op_res_230389 = x_230387 + x_230388;
            
            local_acc_230479 = defunc_1_op_res_230389;
        }
        // Load accum params
        {
            x_230390 = local_acc_230480;
        }
        // Load next params
        {
            x_230391 = xw_j_230419;
        }
        // Red body
        {
            double defunc_1_op_res_230392 = x_230390 + x_230391;
            
            local_acc_230480 = defunc_1_op_res_230392;
        }
        // Load accum params
        {
            x_230393 = local_acc_230481;
        }
        // Load next params
        {
            x_230394 = x2w_j_230420;
        }
        // Red body
        {
            double defunc_1_op_res_230395 = x_230393 + x_230394;
            
            local_acc_230481 = defunc_1_op_res_230395;
        }
        // Load accum params
        {
            x_230396 = local_acc_230482;
        }
        // Load next params
        {
            x_230397 = x3w_j_230421;
        }
        // Red body
        {
            double defunc_1_op_res_230398 = x_230396 + x_230397;
            
            local_acc_230482 = defunc_1_op_res_230398;
        }
        // Load accum params
        {
            x_230399 = local_acc_230483;
        }
        // Load next params
        {
            x_230400 = x4w_j_230422;
        }
        // Red body
        {
            double defunc_1_op_res_230401 = x_230399 + x_230400;
            
            local_acc_230483 = defunc_1_op_res_230401;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230468.mem)[flat_tid_230385] =
        local_acc_230479;
    ((double *) reduce_stage_1_tid_res_arr_mem_230470.mem)[flat_tid_230385] =
        local_acc_230480;
    ((double *) reduce_stage_1_tid_res_arr_mem_230472.mem)[flat_tid_230385] =
        local_acc_230481;
    ((double *) reduce_stage_1_tid_res_arr_mem_230474.mem)[flat_tid_230385] =
        local_acc_230482;
    ((double *) reduce_stage_1_tid_res_arr_mem_230476.mem)[flat_tid_230385] =
        local_acc_230483;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236133_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236133_end -
                 futhark_mc_segred_stage_1_parloop_236133_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236133_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236133_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236133_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236126(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230385 = tid;
    int num_tasks_230467 = info.nsubtasks;
    struct futhark_mc_task_236125 *futhark_mc_task_236125 =
                                  (struct futhark_mc_task_236125 *) args;
    struct futhark_context *ctx = futhark_mc_task_236125->ctx;
    uint64_t futhark_mc_segred_task_236126_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236126_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236125->free_n_203490;
    int64_t gtid_212654 = futhark_mc_task_236125->free_gtid_212654;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236125->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236125->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236125->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236125->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_230073 = futhark_mc_task_236125->free_x_230073;
    double x_230074 = futhark_mc_task_236125->free_x_230074;
    int64_t defunc_0_g_res_230077 =
            futhark_mc_task_236125->free_defunc_0_g_res_230077;
    double defunc_2_reduce_res_230078 =
           *futhark_mc_task_236125->retval_defunc_2_reduce_res_230078;
    double defunc_2_reduce_res_230079 =
           *futhark_mc_task_236125->retval_defunc_2_reduce_res_230079;
    double defunc_2_reduce_res_230080 =
           *futhark_mc_task_236125->retval_defunc_2_reduce_res_230080;
    double defunc_2_reduce_res_230081 =
           *futhark_mc_task_236125->retval_defunc_2_reduce_res_230081;
    double defunc_2_reduce_res_230082 =
           *futhark_mc_task_236125->retval_defunc_2_reduce_res_230082;
    size_t reduce_stage_1_tid_res_arr_mem_230468_cached_sizze_236127 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230468 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230470_cached_sizze_236128 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230470 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230472_cached_sizze_236129 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230472 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230474_cached_sizze_236130 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230474 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230476_cached_sizze_236131 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230476 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230468_cached_sizze_236127 <
        (size_t) ((int64_t) 8 * num_tasks_230467)) {
        reduce_stage_1_tid_res_arr_mem_230468 =
            realloc(reduce_stage_1_tid_res_arr_mem_230468, (int64_t) 8 *
                    num_tasks_230467);
        reduce_stage_1_tid_res_arr_mem_230468_cached_sizze_236127 =
            (int64_t) 8 * num_tasks_230467;
    }
    if (reduce_stage_1_tid_res_arr_mem_230470_cached_sizze_236128 <
        (size_t) ((int64_t) 8 * num_tasks_230467)) {
        reduce_stage_1_tid_res_arr_mem_230470 =
            realloc(reduce_stage_1_tid_res_arr_mem_230470, (int64_t) 8 *
                    num_tasks_230467);
        reduce_stage_1_tid_res_arr_mem_230470_cached_sizze_236128 =
            (int64_t) 8 * num_tasks_230467;
    }
    if (reduce_stage_1_tid_res_arr_mem_230472_cached_sizze_236129 <
        (size_t) ((int64_t) 8 * num_tasks_230467)) {
        reduce_stage_1_tid_res_arr_mem_230472 =
            realloc(reduce_stage_1_tid_res_arr_mem_230472, (int64_t) 8 *
                    num_tasks_230467);
        reduce_stage_1_tid_res_arr_mem_230472_cached_sizze_236129 =
            (int64_t) 8 * num_tasks_230467;
    }
    if (reduce_stage_1_tid_res_arr_mem_230474_cached_sizze_236130 <
        (size_t) ((int64_t) 8 * num_tasks_230467)) {
        reduce_stage_1_tid_res_arr_mem_230474 =
            realloc(reduce_stage_1_tid_res_arr_mem_230474, (int64_t) 8 *
                    num_tasks_230467);
        reduce_stage_1_tid_res_arr_mem_230474_cached_sizze_236130 =
            (int64_t) 8 * num_tasks_230467;
    }
    if (reduce_stage_1_tid_res_arr_mem_230476_cached_sizze_236131 <
        (size_t) ((int64_t) 8 * num_tasks_230467)) {
        reduce_stage_1_tid_res_arr_mem_230476 =
            realloc(reduce_stage_1_tid_res_arr_mem_230476, (int64_t) 8 *
                    num_tasks_230467);
        reduce_stage_1_tid_res_arr_mem_230476_cached_sizze_236131 =
            (int64_t) 8 * num_tasks_230467;
    }
    
    int64_t iter_230478;
    struct futhark_mc_segred_stage_1_parloop_struct_236132
    futhark_mc_segred_stage_1_parloop_struct_236132;
    
    futhark_mc_segred_stage_1_parloop_struct_236132.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_gtid_212654 =
        gtid_212654;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_x_230073 = x_230073;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_x_230074 = x_230074;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_defunc_0_g_res_230077 =
        defunc_0_g_res_230077;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_reduce_stage_1_tid_res_arr_mem_230468 =
        reduce_stage_1_tid_res_arr_mem_230468;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_reduce_stage_1_tid_res_arr_mem_230470 =
        reduce_stage_1_tid_res_arr_mem_230470;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_reduce_stage_1_tid_res_arr_mem_230472 =
        reduce_stage_1_tid_res_arr_mem_230472;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_reduce_stage_1_tid_res_arr_mem_230474 =
        reduce_stage_1_tid_res_arr_mem_230474;
    futhark_mc_segred_stage_1_parloop_struct_236132.free_reduce_stage_1_tid_res_arr_mem_230476 =
        reduce_stage_1_tid_res_arr_mem_230476;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236133_task;
    
    futhark_mc_segred_stage_1_parloop_236133_task.name =
        "futhark_mc_segred_stage_1_parloop_236133";
    futhark_mc_segred_stage_1_parloop_236133_task.fn =
        futhark_mc_segred_stage_1_parloop_236133;
    futhark_mc_segred_stage_1_parloop_236133_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236132;
    futhark_mc_segred_stage_1_parloop_236133_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236133_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236133_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236133_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236133_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236133_task);
    
    if (futhark_mc_segred_stage_1_parloop_236133_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236133_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236133_total_end -
                 futhark_mc_segred_stage_1_parloop_236133_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236133_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236133_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236133_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230078 = 0.0;
        defunc_2_reduce_res_230079 = 0.0;
        defunc_2_reduce_res_230080 = 0.0;
        defunc_2_reduce_res_230081 = 0.0;
        defunc_2_reduce_res_230082 = 0.0;
    }
    
    double x_230484;
    double x_230485;
    double x_230487;
    double x_230488;
    double x_230490;
    double x_230491;
    double x_230493;
    double x_230494;
    double x_230496;
    double x_230497;
    
    for (int32_t i_230499 = 0; i_230499 < num_tasks_230467; i_230499++) {
        flat_tid_230385 = i_230499;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230484 = defunc_2_reduce_res_230078;
            }
            // load next params
            {
                x_230485 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230468)[flat_tid_230385];
            }
            // red body
            {
                double defunc_1_op_res_230486 = x_230484 + x_230485;
                
                defunc_2_reduce_res_230078 = defunc_1_op_res_230486;
            }
            // load acc params
            {
                x_230487 = defunc_2_reduce_res_230079;
            }
            // load next params
            {
                x_230488 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230470)[flat_tid_230385];
            }
            // red body
            {
                double defunc_1_op_res_230489 = x_230487 + x_230488;
                
                defunc_2_reduce_res_230079 = defunc_1_op_res_230489;
            }
            // load acc params
            {
                x_230490 = defunc_2_reduce_res_230080;
            }
            // load next params
            {
                x_230491 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230472)[flat_tid_230385];
            }
            // red body
            {
                double defunc_1_op_res_230492 = x_230490 + x_230491;
                
                defunc_2_reduce_res_230080 = defunc_1_op_res_230492;
            }
            // load acc params
            {
                x_230493 = defunc_2_reduce_res_230081;
            }
            // load next params
            {
                x_230494 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230474)[flat_tid_230385];
            }
            // red body
            {
                double defunc_1_op_res_230495 = x_230493 + x_230494;
                
                defunc_2_reduce_res_230081 = defunc_1_op_res_230495;
            }
            // load acc params
            {
                x_230496 = defunc_2_reduce_res_230082;
            }
            // load next params
            {
                x_230497 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230476)[flat_tid_230385];
            }
            // red body
            {
                double defunc_1_op_res_230498 = x_230496 + x_230497;
                
                defunc_2_reduce_res_230082 = defunc_1_op_res_230498;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230468);
        free(reduce_stage_1_tid_res_arr_mem_230470);
        free(reduce_stage_1_tid_res_arr_mem_230472);
        free(reduce_stage_1_tid_res_arr_mem_230474);
        free(reduce_stage_1_tid_res_arr_mem_230476);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236126_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236126_end -
                 futhark_mc_segred_task_236126_start;
        
        ctx->futhark_mc_segred_task_236126_runs[tid]++;
        ctx->futhark_mc_segred_task_236126_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236126_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236125->retval_defunc_2_reduce_res_230078 =
            defunc_2_reduce_res_230078;
        *futhark_mc_task_236125->retval_defunc_2_reduce_res_230079 =
            defunc_2_reduce_res_230079;
        *futhark_mc_task_236125->retval_defunc_2_reduce_res_230080 =
            defunc_2_reduce_res_230080;
        *futhark_mc_task_236125->retval_defunc_2_reduce_res_230081 =
            defunc_2_reduce_res_230081;
        *futhark_mc_task_236125->retval_defunc_2_reduce_res_230082 =
            defunc_2_reduce_res_230082;
    }
    return err;
}
struct futhark_mc_task_236134 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212654;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_x_230073;
    double free_x_230074;
    int64_t free_defunc_0_g_res_230077;
    double free_a12_230141;
    double free_b12_230142;
    double free_c12_230143;
    double free_b2_230144;
    double free_c2_230145;
    double *retval_defunc_2_reduce_res_230146;
    double *retval_defunc_2_reduce_res_230147;
};
struct futhark_mc_segred_stage_1_parloop_struct_236138 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212654;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_x_230073;
    double free_x_230074;
    int64_t free_defunc_0_g_res_230077;
    double free_a12_230141;
    double free_b12_230142;
    double free_c12_230143;
    double free_b2_230144;
    double free_c2_230145;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230501;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230503;
};
static int futhark_mc_segred_stage_1_parloop_236139(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230423,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236138
    *futhark_mc_segred_stage_1_parloop_struct_236138 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236138 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236138->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236139_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236139_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236138->free_n_203490;
    int64_t gtid_212654 =
            futhark_mc_segred_stage_1_parloop_struct_236138->free_gtid_212654;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236138->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236138->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236138->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236138->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236138->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_230073 =
            futhark_mc_segred_stage_1_parloop_struct_236138->free_x_230073;
    double x_230074 =
           futhark_mc_segred_stage_1_parloop_struct_236138->free_x_230074;
    int64_t defunc_0_g_res_230077 =
            futhark_mc_segred_stage_1_parloop_struct_236138->free_defunc_0_g_res_230077;
    double a12_230141 =
           futhark_mc_segred_stage_1_parloop_struct_236138->free_a12_230141;
    double b12_230142 =
           futhark_mc_segred_stage_1_parloop_struct_236138->free_b12_230142;
    double c12_230143 =
           futhark_mc_segred_stage_1_parloop_struct_236138->free_c12_230143;
    double b2_230144 =
           futhark_mc_segred_stage_1_parloop_struct_236138->free_b2_230144;
    double c2_230145 =
           futhark_mc_segred_stage_1_parloop_struct_236138->free_c2_230145;
    struct memblock reduce_stage_1_tid_res_arr_mem_230501 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230501",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236138->free_reduce_stage_1_tid_res_arr_mem_230501,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230503 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230503",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236138->free_reduce_stage_1_tid_res_arr_mem_230503,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230505 = start;
    double x_230425;
    double x_230426;
    double x_230428;
    double x_230429;
    double local_acc_230506 = 0.0;
    double local_acc_230507 = 0.0;
    
    for (; iter_230505 < end; iter_230505++) {
        int64_t gtid_230424 = iter_230505;
        bool cond_230431 = sle64(n_203490, gtid_230424);
        int64_t defunc_0_f_res_230432;
        
        if (cond_230431) {
            defunc_0_f_res_230432 = (int64_t) 0;
        } else {
            int64_t i_230433 = add64(x_230073, gtid_230424);
            int64_t defunc_1_add_res_230434 = add64((int64_t) 1, i_230433);
            
            defunc_0_f_res_230432 = defunc_1_add_res_230434;
        }
        
        double defunc_0_f_res_230435;
        
        if (cond_230431) {
            defunc_0_f_res_230435 = 0.0;
        } else {
            int64_t i_230436 = add64(x_230073, gtid_230424);
            double defunc_0_add_arg_230437;
            
            defunc_0_add_arg_230437 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_212654 *
                                                   ctx_param_ext_217867 +
                                                   i_230436 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_230435 = defunc_0_add_arg_230437;
        }
        
        int64_t binop_p_230438 = sub64(defunc_0_f_res_230432,
                                       defunc_0_g_res_230077);
        double defunc_0_f_res_230439 = sitofp_i64_f64(binop_p_230438);
        double abs_res_230440 = fabs(defunc_0_f_res_230439);
        double tmp1_230441 = abs_res_230440 / x_230074;
        double x_230442 = tmp1_230441 * tmp1_230441;
        double y_230443 = tmp1_230441 * x_230442;
        double tmp2_230444 = 1.0 - y_230443;
        double x_230445 = tmp2_230444 * tmp2_230444;
        double tmp3_230446 = tmp2_230444 * x_230445;
        double tmp4_230447 = defunc_0_f_res_230435 * tmp3_230446;
        double defunc_1_f_res_230448 = defunc_0_f_res_230439 * tmp4_230447;
        double defunc_1_f_res_230449 = defunc_0_f_res_230439 *
               defunc_1_f_res_230448;
        double defunc_0_f_res_230450;
        
        if (cond_230431) {
            defunc_0_f_res_230450 = 0.0;
        } else {
            int64_t i_230451 = add64(x_230073, gtid_230424);
            double defunc_0_add_arg_230452;
            
            defunc_0_add_arg_230452 = ((double *) mem_219293.mem)[gtid_212654 *
                                                                  n_203490 +
                                                                  i_230451];
            defunc_0_f_res_230450 = defunc_0_add_arg_230452;
        }
        
        double x_230453 = a12_230141 * tmp4_230447;
        double y_230454 = b12_230142 * defunc_1_f_res_230448;
        double x_230455 = x_230453 + y_230454;
        double y_230456 = c12_230143 * defunc_1_f_res_230449;
        double x_230457 = x_230455 + y_230456;
        double defunc_9_fit_fun_res_230458 = defunc_0_f_res_230450 * x_230457;
        double x_230459 = b12_230142 * tmp4_230447;
        double y_230460 = b2_230144 * defunc_1_f_res_230448;
        double x_230461 = x_230459 + y_230460;
        double y_230462 = c2_230145 * defunc_1_f_res_230449;
        double x_230463 = x_230461 + y_230462;
        double defunc_9_slope_fun_res_230464 = defunc_0_f_res_230450 * x_230463;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230425 = local_acc_230506;
        }
        // Load next params
        {
            x_230426 = defunc_9_fit_fun_res_230458;
        }
        // Red body
        {
            double defunc_1_op_res_230427 = x_230425 + x_230426;
            
            local_acc_230506 = defunc_1_op_res_230427;
        }
        // Load accum params
        {
            x_230428 = local_acc_230507;
        }
        // Load next params
        {
            x_230429 = defunc_9_slope_fun_res_230464;
        }
        // Red body
        {
            double defunc_1_op_res_230430 = x_230428 + x_230429;
            
            local_acc_230507 = defunc_1_op_res_230430;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230501.mem)[flat_tid_230423] =
        local_acc_230506;
    ((double *) reduce_stage_1_tid_res_arr_mem_230503.mem)[flat_tid_230423] =
        local_acc_230507;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236139_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236139_end -
                 futhark_mc_segred_stage_1_parloop_236139_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236139_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236139_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236139_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236135(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230423 = tid;
    int num_tasks_230500 = info.nsubtasks;
    struct futhark_mc_task_236134 *futhark_mc_task_236134 =
                                  (struct futhark_mc_task_236134 *) args;
    struct futhark_context *ctx = futhark_mc_task_236134->ctx;
    uint64_t futhark_mc_segred_task_236135_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236135_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236134->free_n_203490;
    int64_t gtid_212654 = futhark_mc_task_236134->free_gtid_212654;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236134->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236134->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236134->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236134->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236134->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_230073 = futhark_mc_task_236134->free_x_230073;
    double x_230074 = futhark_mc_task_236134->free_x_230074;
    int64_t defunc_0_g_res_230077 =
            futhark_mc_task_236134->free_defunc_0_g_res_230077;
    double a12_230141 = futhark_mc_task_236134->free_a12_230141;
    double b12_230142 = futhark_mc_task_236134->free_b12_230142;
    double c12_230143 = futhark_mc_task_236134->free_c12_230143;
    double b2_230144 = futhark_mc_task_236134->free_b2_230144;
    double c2_230145 = futhark_mc_task_236134->free_c2_230145;
    double defunc_2_reduce_res_230146 =
           *futhark_mc_task_236134->retval_defunc_2_reduce_res_230146;
    double defunc_2_reduce_res_230147 =
           *futhark_mc_task_236134->retval_defunc_2_reduce_res_230147;
    size_t reduce_stage_1_tid_res_arr_mem_230501_cached_sizze_236136 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230501 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230503_cached_sizze_236137 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230503 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230501_cached_sizze_236136 <
        (size_t) ((int64_t) 8 * num_tasks_230500)) {
        reduce_stage_1_tid_res_arr_mem_230501 =
            realloc(reduce_stage_1_tid_res_arr_mem_230501, (int64_t) 8 *
                    num_tasks_230500);
        reduce_stage_1_tid_res_arr_mem_230501_cached_sizze_236136 =
            (int64_t) 8 * num_tasks_230500;
    }
    if (reduce_stage_1_tid_res_arr_mem_230503_cached_sizze_236137 <
        (size_t) ((int64_t) 8 * num_tasks_230500)) {
        reduce_stage_1_tid_res_arr_mem_230503 =
            realloc(reduce_stage_1_tid_res_arr_mem_230503, (int64_t) 8 *
                    num_tasks_230500);
        reduce_stage_1_tid_res_arr_mem_230503_cached_sizze_236137 =
            (int64_t) 8 * num_tasks_230500;
    }
    
    int64_t iter_230505;
    struct futhark_mc_segred_stage_1_parloop_struct_236138
    futhark_mc_segred_stage_1_parloop_struct_236138;
    
    futhark_mc_segred_stage_1_parloop_struct_236138.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_gtid_212654 =
        gtid_212654;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_mem_219293 =
        mem_219293.mem;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_x_230073 = x_230073;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_x_230074 = x_230074;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_defunc_0_g_res_230077 =
        defunc_0_g_res_230077;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_a12_230141 =
        a12_230141;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_b12_230142 =
        b12_230142;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_c12_230143 =
        c12_230143;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_b2_230144 = b2_230144;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_c2_230145 = c2_230145;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_reduce_stage_1_tid_res_arr_mem_230501 =
        reduce_stage_1_tid_res_arr_mem_230501;
    futhark_mc_segred_stage_1_parloop_struct_236138.free_reduce_stage_1_tid_res_arr_mem_230503 =
        reduce_stage_1_tid_res_arr_mem_230503;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236139_task;
    
    futhark_mc_segred_stage_1_parloop_236139_task.name =
        "futhark_mc_segred_stage_1_parloop_236139";
    futhark_mc_segred_stage_1_parloop_236139_task.fn =
        futhark_mc_segred_stage_1_parloop_236139;
    futhark_mc_segred_stage_1_parloop_236139_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236138;
    futhark_mc_segred_stage_1_parloop_236139_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236139_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236139_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236139_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236139_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236139_task);
    
    if (futhark_mc_segred_stage_1_parloop_236139_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236139_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236139_total_end -
                 futhark_mc_segred_stage_1_parloop_236139_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236139_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236139_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236139_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230146 = 0.0;
        defunc_2_reduce_res_230147 = 0.0;
    }
    
    double x_230508;
    double x_230509;
    double x_230511;
    double x_230512;
    
    for (int32_t i_230514 = 0; i_230514 < num_tasks_230500; i_230514++) {
        flat_tid_230423 = i_230514;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230508 = defunc_2_reduce_res_230146;
            }
            // load next params
            {
                x_230509 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230501)[flat_tid_230423];
            }
            // red body
            {
                double defunc_1_op_res_230510 = x_230508 + x_230509;
                
                defunc_2_reduce_res_230146 = defunc_1_op_res_230510;
            }
            // load acc params
            {
                x_230511 = defunc_2_reduce_res_230147;
            }
            // load next params
            {
                x_230512 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230503)[flat_tid_230423];
            }
            // red body
            {
                double defunc_1_op_res_230513 = x_230511 + x_230512;
                
                defunc_2_reduce_res_230147 = defunc_1_op_res_230513;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230501);
        free(reduce_stage_1_tid_res_arr_mem_230503);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236135_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236135_end -
                 futhark_mc_segred_task_236135_start;
        
        ctx->futhark_mc_segred_task_236135_runs[tid]++;
        ctx->futhark_mc_segred_task_236135_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236135_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236134->retval_defunc_2_reduce_res_230146 =
            defunc_2_reduce_res_230146;
        *futhark_mc_task_236134->retval_defunc_2_reduce_res_230147 =
            defunc_2_reduce_res_230147;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236124(void *args, int64_t start,
                                            int64_t end, int flat_tid_230071,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236123
    *futhark_mc_segmap_parloop_struct_236123 =
    (struct futhark_mc_segmap_parloop_struct_236123 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236123->ctx;
    uint64_t futhark_mc_segmap_parloop_236124_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236124_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236123->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236123->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236123->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236123->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236123->free_i_203670;
    int64_t gtid_212654 =
            futhark_mc_segmap_parloop_struct_236123->free_gtid_212654;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236123->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236123->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236123->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236123->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236123->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236123->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236123->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219366 = {.desc ="mem_219366", .mem =
                                  futhark_mc_segmap_parloop_struct_236123->free_mem_219366,
                                  .size =0, .references =NULL};
    struct memblock mem_219369 = {.desc ="mem_219369", .mem =
                                  futhark_mc_segmap_parloop_struct_236123->free_mem_219369,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230384 = start;
    
    for (; iter_230384 < end; iter_230384++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230465 = l_n_m_203643;
        int64_t gtid_230072 = iter_230384;
        int64_t remnant_230466 = iter_230384 - gtid_230072;
        int64_t x_230073;
        
        x_230073 = ((int64_t *) mem_217773.mem)[gtid_212654 * l_n_m_203643 +
                                                gtid_230072];
        
        double x_230074;
        
        x_230074 = ((double *) mem_217777.mem)[gtid_212654 * l_n_m_203643 +
                                               gtid_230072];
        
        int64_t min_arg_230075 = mul64(jump_t_203500, gtid_230072);
        int64_t min_res_230076 = smin64(i_203670, min_arg_230075);
        int64_t defunc_0_g_res_230077 = add64((int64_t) 1, min_res_230076);
        double defunc_2_reduce_res_230078;
        double defunc_2_reduce_res_230079;
        double defunc_2_reduce_res_230080;
        double defunc_2_reduce_res_230081;
        double defunc_2_reduce_res_230082;
        int64_t flat_tid_230385 = (int64_t) 0;
        int32_t num_tasks_230467;
        
        defunc_2_reduce_res_230078 = 0.0;
        defunc_2_reduce_res_230079 = 0.0;
        defunc_2_reduce_res_230080 = 0.0;
        defunc_2_reduce_res_230081 = 0.0;
        defunc_2_reduce_res_230082 = 0.0;
        
        struct futhark_mc_task_236125 futhark_mc_task_236125;
        
        futhark_mc_task_236125.ctx = ctx;
        futhark_mc_task_236125.free_n_203490 = n_203490;
        futhark_mc_task_236125.free_gtid_212654 = gtid_212654;
        futhark_mc_task_236125.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236125.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236125.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236125.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236125.free_x_230073 = x_230073;
        futhark_mc_task_236125.free_x_230074 = x_230074;
        futhark_mc_task_236125.free_defunc_0_g_res_230077 =
            defunc_0_g_res_230077;
        futhark_mc_task_236125.retval_defunc_2_reduce_res_230078 =
            &defunc_2_reduce_res_230078;
        futhark_mc_task_236125.retval_defunc_2_reduce_res_230079 =
            &defunc_2_reduce_res_230079;
        futhark_mc_task_236125.retval_defunc_2_reduce_res_230080 =
            &defunc_2_reduce_res_230080;
        futhark_mc_task_236125.retval_defunc_2_reduce_res_230081 =
            &defunc_2_reduce_res_230081;
        futhark_mc_task_236125.retval_defunc_2_reduce_res_230082 =
            &defunc_2_reduce_res_230082;
        
        struct scheduler_segop futhark_mc_task_236125_task;
        
        futhark_mc_task_236125_task.args = &futhark_mc_task_236125;
        futhark_mc_task_236125_task.top_level_fn =
            futhark_mc_segred_task_236126;
        futhark_mc_task_236125_task.name = "futhark_mc_segred_task_236126";
        futhark_mc_task_236125_task.iterations = q_l_203495;
        futhark_mc_task_236125_task.task_time =
            &ctx->futhark_mc_segred_task_236126_total_time;
        futhark_mc_task_236125_task.task_iter =
            &ctx->futhark_mc_segred_task_236126_total_iter;
        futhark_mc_task_236125_task.sched = STATIC;
        futhark_mc_task_236125_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236126_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236125_task);
        
        if (futhark_mc_segred_task_236126_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_230121 = defunc_2_reduce_res_230080 *
               defunc_2_reduce_res_230082;
        double y_230122 = defunc_2_reduce_res_230081 *
               defunc_2_reduce_res_230081;
        double a12_230123 = x_230121 - y_230122;
        double x_230124 = defunc_2_reduce_res_230080 *
               defunc_2_reduce_res_230081;
        double y_230125 = defunc_2_reduce_res_230079 *
               defunc_2_reduce_res_230082;
        double b12_230126 = x_230124 - y_230125;
        double x_230127 = defunc_2_reduce_res_230079 *
               defunc_2_reduce_res_230081;
        double y_230128 = defunc_2_reduce_res_230080 *
               defunc_2_reduce_res_230080;
        double c12_230129 = x_230127 - y_230128;
        double x_230130 = defunc_2_reduce_res_230078 *
               defunc_2_reduce_res_230082;
        double b2_230131 = x_230130 - y_230128;
        double x_230132 = defunc_2_reduce_res_230079 *
               defunc_2_reduce_res_230080;
        double y_230133 = defunc_2_reduce_res_230078 *
               defunc_2_reduce_res_230081;
        double c2_230134 = x_230132 - y_230133;
        double x_230135 = defunc_2_reduce_res_230078 * a12_230123;
        double y_230136 = defunc_2_reduce_res_230079 * b12_230126;
        double x_230137 = x_230135 + y_230136;
        double y_230138 = defunc_2_reduce_res_230080 * c12_230129;
        double y_230139 = x_230137 + y_230138;
        double det_230140 = 1.0 / y_230139;
        double a12_230141 = a12_230123 * det_230140;
        double b12_230142 = b12_230126 * det_230140;
        double c12_230143 = c12_230129 * det_230140;
        double b2_230144 = b2_230131 * det_230140;
        double c2_230145 = c2_230134 * det_230140;
        double defunc_2_reduce_res_230146;
        double defunc_2_reduce_res_230147;
        int64_t flat_tid_230423 = (int64_t) 0;
        int32_t num_tasks_230500;
        
        defunc_2_reduce_res_230146 = 0.0;
        defunc_2_reduce_res_230147 = 0.0;
        
        struct futhark_mc_task_236134 futhark_mc_task_236134;
        
        futhark_mc_task_236134.ctx = ctx;
        futhark_mc_task_236134.free_n_203490 = n_203490;
        futhark_mc_task_236134.free_gtid_212654 = gtid_212654;
        futhark_mc_task_236134.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236134.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236134.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236134.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236134.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236134.free_x_230073 = x_230073;
        futhark_mc_task_236134.free_x_230074 = x_230074;
        futhark_mc_task_236134.free_defunc_0_g_res_230077 =
            defunc_0_g_res_230077;
        futhark_mc_task_236134.free_a12_230141 = a12_230141;
        futhark_mc_task_236134.free_b12_230142 = b12_230142;
        futhark_mc_task_236134.free_c12_230143 = c12_230143;
        futhark_mc_task_236134.free_b2_230144 = b2_230144;
        futhark_mc_task_236134.free_c2_230145 = c2_230145;
        futhark_mc_task_236134.retval_defunc_2_reduce_res_230146 =
            &defunc_2_reduce_res_230146;
        futhark_mc_task_236134.retval_defunc_2_reduce_res_230147 =
            &defunc_2_reduce_res_230147;
        
        struct scheduler_segop futhark_mc_task_236134_task;
        
        futhark_mc_task_236134_task.args = &futhark_mc_task_236134;
        futhark_mc_task_236134_task.top_level_fn =
            futhark_mc_segred_task_236135;
        futhark_mc_task_236134_task.name = "futhark_mc_segred_task_236135";
        futhark_mc_task_236134_task.iterations = q_l_203495;
        futhark_mc_task_236134_task.task_time =
            &ctx->futhark_mc_segred_task_236135_total_time;
        futhark_mc_task_236134_task.task_iter =
            &ctx->futhark_mc_segred_task_236135_total_iter;
        futhark_mc_task_236134_task.sched = STATIC;
        futhark_mc_task_236134_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236135_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236134_task);
        
        if (futhark_mc_segred_task_236135_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219366.mem)[gtid_230072] = defunc_2_reduce_res_230146;
        ((double *) mem_219369.mem)[gtid_230072] = defunc_2_reduce_res_230147;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236124_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236124_end -
                 futhark_mc_segmap_parloop_236124_start;
        
        ctx->futhark_mc_segmap_parloop_236124_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236124_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236124_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236122(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230071 = tid;
    int num_tasks_230302 = info.nsubtasks;
    struct futhark_mc_task_236118 *futhark_mc_task_236118 =
                                  (struct futhark_mc_task_236118 *) args;
    struct futhark_context *ctx = futhark_mc_task_236118->ctx;
    uint64_t futhark_mc_segmap_nested_task_236122_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236122_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236118->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236118->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236118->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236118->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236118->free_i_203670;
    int64_t gtid_212654 = futhark_mc_task_236118->free_gtid_212654;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236118->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236118->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236118->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236118->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236118->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236118->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236118->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219366 = {.desc ="mem_219366", .mem =
                                  futhark_mc_task_236118->free_mem_219366,
                                  .size =0, .references =NULL};
    struct memblock mem_219369 = {.desc ="mem_219369", .mem =
                                  futhark_mc_task_236118->free_mem_219369,
                                  .size =0, .references =NULL};
    int64_t iter_230384;
    struct futhark_mc_segmap_parloop_struct_236123
    futhark_mc_segmap_parloop_struct_236123;
    
    futhark_mc_segmap_parloop_struct_236123.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236123.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236123.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236123.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236123.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236123.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236123.free_gtid_212654 = gtid_212654;
    futhark_mc_segmap_parloop_struct_236123.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236123.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236123.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236123.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236123.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236123.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236123.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236123.free_mem_219366 = mem_219366.mem;
    futhark_mc_segmap_parloop_struct_236123.free_mem_219369 = mem_219369.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236124_task;
    
    futhark_mc_segmap_parloop_236124_task.name =
        "futhark_mc_segmap_parloop_236124";
    futhark_mc_segmap_parloop_236124_task.fn = futhark_mc_segmap_parloop_236124;
    futhark_mc_segmap_parloop_236124_task.args =
        &futhark_mc_segmap_parloop_struct_236123;
    futhark_mc_segmap_parloop_236124_task.iterations = iterations;
    futhark_mc_segmap_parloop_236124_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236124_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236124_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236124_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236124_task);
    
    if (futhark_mc_segmap_parloop_236124_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236124_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236124_total_end -
                 futhark_mc_segmap_parloop_236124_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236124_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236124_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236124_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236122_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236122_end -
                 futhark_mc_segmap_nested_task_236122_start;
        
        ctx->futhark_mc_segmap_nested_task_236122_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236122_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236122_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236115(void *args, int64_t start,
                                            int64_t end, int flat_tid_212653,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236114
    *futhark_mc_segmap_parloop_struct_236114 =
    (struct futhark_mc_segmap_parloop_struct_236114 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236114->ctx;
    uint64_t futhark_mc_segmap_parloop_236115_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236115_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236114->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236114->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236114->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236114->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236114->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236114->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236114->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236114->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236114->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236114->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236114->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236114->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236114->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236114->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219403 = {.desc ="mem_219403", .mem =
                                  futhark_mc_segmap_parloop_struct_236114->free_mem_219403,
                                  .size =0, .references =NULL};
    struct memblock mem_219407 = {.desc ="mem_219407", .mem =
                                  futhark_mc_segmap_parloop_struct_236114->free_mem_219407,
                                  .size =0, .references =NULL};
    size_t mem_219366_cached_sizze_236116 = 0;
    unsigned char *mem_219366 = NULL;
    size_t mem_219369_cached_sizze_236117 = 0;
    unsigned char *mem_219369 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230070 = start;
    
    if (mem_219366_cached_sizze_236116 < (size_t) bytes_217720) {
        mem_219366 = realloc(mem_219366, bytes_217720);
        mem_219366_cached_sizze_236116 = bytes_217720;
    }
    if (mem_219369_cached_sizze_236117 < (size_t) bytes_217720) {
        mem_219369 = realloc(mem_219369, bytes_217720);
        mem_219369_cached_sizze_236117 = bytes_217720;
    }
    for (; iter_230070 < end; iter_230070++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230300 = partition_sizze_203577;
        int64_t gtid_212654 = iter_230070;
        int64_t remnant_230301 = iter_230070 - gtid_212654;
        int64_t flat_tid_230190 = (int64_t) 0;
        int32_t num_tasks_230302;
        int64_t flat_tid_230071 = (int64_t) 0;
        struct futhark_mc_task_236118 futhark_mc_task_236118;
        
        futhark_mc_task_236118.ctx = ctx;
        futhark_mc_task_236118.free_n_203490 = n_203490;
        futhark_mc_task_236118.free_q_l_203495 = q_l_203495;
        futhark_mc_task_236118.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236118.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_236118.free_i_203670 = i_203670;
        futhark_mc_task_236118.free_gtid_212654 = gtid_212654;
        futhark_mc_task_236118.free_mem_217773 = mem_217773.mem;
        futhark_mc_task_236118.free_mem_217777 = mem_217777.mem;
        futhark_mc_task_236118.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236118.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236118.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236118.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236118.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236118.free_mem_219366 = mem_219366;
        futhark_mc_task_236118.free_mem_219369 = mem_219369;
        
        struct scheduler_segop futhark_mc_task_236118_task;
        
        futhark_mc_task_236118_task.args = &futhark_mc_task_236118;
        futhark_mc_task_236118_task.top_level_fn =
            futhark_mc_segmap_task_236119;
        futhark_mc_task_236118_task.name = "futhark_mc_segmap_task_236119";
        futhark_mc_task_236118_task.iterations = l_n_m_203643;
        futhark_mc_task_236118_task.task_time =
            &ctx->futhark_mc_segmap_task_236119_total_time;
        futhark_mc_task_236118_task.task_iter =
            &ctx->futhark_mc_segmap_task_236119_total_iter;
        futhark_mc_task_236118_task.sched = STATIC;
        futhark_mc_task_236118_task.nested_fn =
            futhark_mc_segmap_nested_task_236122;
        
        int futhark_mc_segmap_task_236119_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236118_task);
        
        if (futhark_mc_segmap_task_236119_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219403.mem + gtid_212654 * l_n_m_203643 * (int64_t) 8,
                    mem_219366 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219407.mem + gtid_212654 * l_n_m_203643 * (int64_t) 8,
                    mem_219369 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219366);
    free(mem_219369);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236115_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236115_end -
                 futhark_mc_segmap_parloop_236115_start;
        
        ctx->futhark_mc_segmap_parloop_236115_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236115_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236115_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236113(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212653 = tid;
    int num_tasks_229944 = info.nsubtasks;
    struct futhark_mc_task_236107 *futhark_mc_task_236107 =
                                  (struct futhark_mc_task_236107 *) args;
    struct futhark_context *ctx = futhark_mc_task_236107->ctx;
    uint64_t futhark_mc_segmap_nested_task_236113_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236113_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236107->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236107->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236107->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236107->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236107->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236107->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236107->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236107->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236107->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236107->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236107->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236107->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236107->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236107->free_mem_219293,
                                  .size =0, .references =NULL};
    struct memblock mem_219403 = {.desc ="mem_219403", .mem =
                                  futhark_mc_task_236107->free_mem_219403,
                                  .size =0, .references =NULL};
    struct memblock mem_219407 = {.desc ="mem_219407", .mem =
                                  futhark_mc_task_236107->free_mem_219407,
                                  .size =0, .references =NULL};
    int64_t iter_230070;
    struct futhark_mc_segmap_parloop_struct_236114
    futhark_mc_segmap_parloop_struct_236114;
    
    futhark_mc_segmap_parloop_struct_236114.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236114.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236114.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236114.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236114.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236114.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236114.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236114.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236114.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236114.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236114.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236114.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236114.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236114.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236114.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236114.free_mem_219403 = mem_219403.mem;
    futhark_mc_segmap_parloop_struct_236114.free_mem_219407 = mem_219407.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236115_task;
    
    futhark_mc_segmap_parloop_236115_task.name =
        "futhark_mc_segmap_parloop_236115";
    futhark_mc_segmap_parloop_236115_task.fn = futhark_mc_segmap_parloop_236115;
    futhark_mc_segmap_parloop_236115_task.args =
        &futhark_mc_segmap_parloop_struct_236114;
    futhark_mc_segmap_parloop_236115_task.iterations = iterations;
    futhark_mc_segmap_parloop_236115_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236115_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236115_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236115_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236115_task);
    
    if (futhark_mc_segmap_parloop_236115_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236115_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236115_total_end -
                 futhark_mc_segmap_parloop_236115_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236115_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236115_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236115_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236113_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236113_end -
                 futhark_mc_segmap_nested_task_236113_start;
        
        ctx->futhark_mc_segmap_nested_task_236113_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236113_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236113_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236140 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219417;
    unsigned char *free_mem_219470;
};
struct futhark_mc_segmap_parloop_struct_236142 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219417;
    unsigned char *free_mem_219470;
};
static int futhark_mc_segmap_parloop_236143(void *args, int64_t start,
                                            int64_t end, int flat_tid_212901,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236142
    *futhark_mc_segmap_parloop_struct_236142 =
    (struct futhark_mc_segmap_parloop_struct_236142 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236142->ctx;
    uint64_t futhark_mc_segmap_parloop_236143_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236143_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236142->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236142->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236142->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236142->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236142->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236142->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236142->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236142->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236142->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236142->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236142->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236142->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236142->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236142->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 =
            futhark_mc_segmap_parloop_struct_236142->free_bytes_219417;
    struct memblock mem_219470 = {.desc ="mem_219470", .mem =
                                  futhark_mc_segmap_parloop_struct_236142->free_mem_219470,
                                  .size =0, .references =NULL};
    size_t mem_219439_cached_sizze_236144 = 0;
    unsigned char *mem_219439 = NULL;
    size_t mem_219449_cached_sizze_236145 = 0;
    unsigned char *mem_219449 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230518 = start;
    
    if (mem_219439_cached_sizze_236144 < (size_t) bytes_217720) {
        mem_219439 = realloc(mem_219439, bytes_217720);
        mem_219439_cached_sizze_236144 = bytes_217720;
    }
    if (mem_219449_cached_sizze_236145 < (size_t) bytes_219417) {
        mem_219449 = realloc(mem_219449, bytes_219417);
        mem_219449_cached_sizze_236145 = bytes_219417;
    }
    for (; iter_230518 < end; iter_230518++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230564 = partition_sizze_203577;
        int64_t gtid_212902 = iter_230518;
        int64_t remnant_230565 = iter_230518 - gtid_212902;
        
        for (int64_t i_230519 = 0; i_230519 < l_n_m_203643; i_230519++) {
            int64_t x_230521;
            
            x_230521 = ((int64_t *) mem_217773.mem)[gtid_212902 * l_n_m_203643 +
                                                    i_230519];
            
            double x_230522;
            
            x_230522 = ((double *) mem_217777.mem)[gtid_212902 * l_n_m_203643 +
                                                   i_230519];
            
            int64_t min_arg_230523 = mul64(jump_t_203500, i_230519);
            int64_t min_res_230524 = smin64(i_203670, min_arg_230523);
            int64_t defunc_0_g_res_230525 = add64((int64_t) 1, min_res_230524);
            double defunc_2_reduce_res_230527;
            double redout_230530 = 0.0;
            
            for (int64_t i_230529 = 0; i_230529 < q_l_203495; i_230529++) {
                bool cond_230532 = sle64(n_203490, i_230529);
                int64_t defunc_0_f_res_230533;
                
                if (cond_230532) {
                    defunc_0_f_res_230533 = (int64_t) 0;
                } else {
                    int64_t i_230534 = add64(x_230521, i_230529);
                    int64_t defunc_1_add_res_230535 = add64((int64_t) 1,
                                                            i_230534);
                    
                    defunc_0_f_res_230533 = defunc_1_add_res_230535;
                }
                
                double defunc_0_f_res_230536;
                
                if (cond_230532) {
                    defunc_0_f_res_230536 = 0.0;
                } else {
                    int64_t i_230537 = add64(x_230521, i_230529);
                    double defunc_0_add_arg_230538;
                    
                    defunc_0_add_arg_230538 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_212902 *
                                                           ctx_param_ext_217867 +
                                                           i_230537 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_230536 = defunc_0_add_arg_230538;
                }
                
                int64_t binop_p_230539 = sub64(defunc_0_f_res_230533,
                                               defunc_0_g_res_230525);
                double defunc_0_f_res_230540 = sitofp_i64_f64(binop_p_230539);
                double abs_res_230541 = fabs(defunc_0_f_res_230540);
                double tmp1_230542 = abs_res_230541 / x_230522;
                double x_230543 = tmp1_230542 * tmp1_230542;
                double y_230544 = tmp1_230542 * x_230543;
                double tmp2_230545 = 1.0 - y_230544;
                double x_230546 = tmp2_230545 * tmp2_230545;
                double tmp3_230547 = tmp2_230545 * x_230546;
                double tmp4_230548 = defunc_0_f_res_230536 * tmp3_230547;
                double defunc_1_op_res_230549 = tmp4_230548 + redout_230530;
                
                ((double *) mem_219449)[i_230529] = tmp4_230548;
                
                double redout_tmp_230567 = defunc_1_op_res_230549;
                
                redout_230530 = redout_tmp_230567;
            }
            defunc_2_reduce_res_230527 = redout_230530;
            
            double a0_230551 = 1.0 / defunc_2_reduce_res_230527;
            double defunc_2_reduce_res_230552;
            double redout_230554 = 0.0;
            
            for (int64_t i_230553 = 0; i_230553 < q_l_203495; i_230553++) {
                double x_230555;
                
                x_230555 = ((double *) mem_219449)[i_230553];
                
                bool cond_230556 = sle64(n_203490, i_230553);
                double defunc_0_f_res_230557;
                
                if (cond_230556) {
                    defunc_0_f_res_230557 = 0.0;
                } else {
                    int64_t i_230558 = add64(x_230521, i_230553);
                    double defunc_0_add_arg_230559;
                    
                    defunc_0_add_arg_230559 =
                        ((double *) mem_219293.mem)[gtid_212902 * n_203490 +
                                                    i_230558];
                    defunc_0_f_res_230557 = defunc_0_add_arg_230559;
                }
                
                double x_230560 = a0_230551 * x_230555;
                double defunc_9_fit_fun_res_230561 = defunc_0_f_res_230557 *
                       x_230560;
                double defunc_1_op_res_230562 = defunc_9_fit_fun_res_230561 +
                       redout_230554;
                double redout_tmp_230569 = defunc_1_op_res_230562;
                
                redout_230554 = redout_tmp_230569;
            }
            defunc_2_reduce_res_230552 = redout_230554;
            ((double *) mem_219439)[i_230519] = defunc_2_reduce_res_230552;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219470.mem + gtid_212902 * l_n_m_203643 * (int64_t) 8,
                    mem_219439 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219439);
    free(mem_219449);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236143_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236143_end -
                 futhark_mc_segmap_parloop_236143_start;
        
        ctx->futhark_mc_segmap_parloop_236143_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236143_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236143_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236141(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212901 = tid;
    int num_tasks_230517 = info.nsubtasks;
    struct futhark_mc_task_236140 *futhark_mc_task_236140 =
                                  (struct futhark_mc_task_236140 *) args;
    struct futhark_context *ctx = futhark_mc_task_236140->ctx;
    uint64_t futhark_mc_segmap_task_236141_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236141_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236140->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236140->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236140->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236140->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236140->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236140->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236140->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236140->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236140->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236140->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236140->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236140->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236140->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236140->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 = futhark_mc_task_236140->free_bytes_219417;
    struct memblock mem_219470 = {.desc ="mem_219470", .mem =
                                  futhark_mc_task_236140->free_mem_219470,
                                  .size =0, .references =NULL};
    int64_t iter_230518;
    struct futhark_mc_segmap_parloop_struct_236142
    futhark_mc_segmap_parloop_struct_236142;
    
    futhark_mc_segmap_parloop_struct_236142.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236142.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236142.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236142.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236142.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236142.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236142.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236142.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236142.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236142.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236142.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236142.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236142.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236142.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236142.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236142.free_bytes_219417 = bytes_219417;
    futhark_mc_segmap_parloop_struct_236142.free_mem_219470 = mem_219470.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236143_task;
    
    futhark_mc_segmap_parloop_236143_task.name =
        "futhark_mc_segmap_parloop_236143";
    futhark_mc_segmap_parloop_236143_task.fn = futhark_mc_segmap_parloop_236143;
    futhark_mc_segmap_parloop_236143_task.args =
        &futhark_mc_segmap_parloop_struct_236142;
    futhark_mc_segmap_parloop_236143_task.iterations = iterations;
    futhark_mc_segmap_parloop_236143_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236143_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236143_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236143_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236143_task);
    
    if (futhark_mc_segmap_parloop_236143_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236143_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236143_total_end -
                 futhark_mc_segmap_parloop_236143_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236143_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236143_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236143_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236141_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236141_end -
                 futhark_mc_segmap_task_236141_start;
        
        ctx->futhark_mc_segmap_task_236141_runs[tid]++;
        ctx->futhark_mc_segmap_task_236141_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236141_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236147 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219417;
    unsigned char *free_mem_219470;
};
struct futhark_mc_task_236150 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212962;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219417;
    unsigned char *free_mem_219436;
};
struct futhark_mc_segmap_parloop_struct_236152 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212962;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219417;
    unsigned char *free_mem_219436;
};
static int futhark_mc_segmap_parloop_236153(void *args, int64_t start,
                                            int64_t end, int flat_tid_230617,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236152
    *futhark_mc_segmap_parloop_struct_236152 =
    (struct futhark_mc_segmap_parloop_struct_236152 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236152->ctx;
    uint64_t futhark_mc_segmap_parloop_236153_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236153_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236152->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236152->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236152->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236152->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236152->free_i_203670;
    int64_t gtid_212962 =
            futhark_mc_segmap_parloop_struct_236152->free_gtid_212962;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236152->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236152->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236152->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236152->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236152->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236152->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236152->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 =
            futhark_mc_segmap_parloop_struct_236152->free_bytes_219417;
    struct memblock mem_219436 = {.desc ="mem_219436", .mem =
                                  futhark_mc_segmap_parloop_struct_236152->free_mem_219436,
                                  .size =0, .references =NULL};
    size_t mem_230624_cached_sizze_236154 = 0;
    unsigned char *mem_230624 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230665 = start;
    
    if (mem_230624_cached_sizze_236154 < (size_t) bytes_219417) {
        mem_230624 = realloc(mem_230624, bytes_219417);
        mem_230624_cached_sizze_236154 = bytes_219417;
    }
    for (; iter_230665 < end; iter_230665++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230698 = l_n_m_203643;
        int64_t gtid_230618 = iter_230665;
        int64_t remnant_230699 = iter_230665 - gtid_230618;
        int64_t x_230619;
        
        x_230619 = ((int64_t *) mem_217773.mem)[gtid_212962 * l_n_m_203643 +
                                                gtid_230618];
        
        double x_230620;
        
        x_230620 = ((double *) mem_217777.mem)[gtid_212962 * l_n_m_203643 +
                                               gtid_230618];
        
        int64_t min_arg_230621 = mul64(jump_t_203500, gtid_230618);
        int64_t min_res_230622 = smin64(i_203670, min_arg_230621);
        int64_t defunc_0_g_res_230623 = add64((int64_t) 1, min_res_230622);
        double defunc_2_reduce_res_230626;
        double redout_230667 = 0.0;
        
        for (int64_t i_230666 = 0; i_230666 < q_l_203495; i_230666++) {
            bool cond_230669 = sle64(n_203490, i_230666);
            int64_t defunc_0_f_res_230670;
            
            if (cond_230669) {
                defunc_0_f_res_230670 = (int64_t) 0;
            } else {
                int64_t i_230671 = add64(x_230619, i_230666);
                int64_t defunc_1_add_res_230672 = add64((int64_t) 1, i_230671);
                
                defunc_0_f_res_230670 = defunc_1_add_res_230672;
            }
            
            double defunc_0_f_res_230673;
            
            if (cond_230669) {
                defunc_0_f_res_230673 = 0.0;
            } else {
                int64_t i_230674 = add64(x_230619, i_230666);
                double defunc_0_add_arg_230675;
                
                defunc_0_add_arg_230675 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_212962 *
                                                       ctx_param_ext_217867 +
                                                       i_230674 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_230673 = defunc_0_add_arg_230675;
            }
            
            int64_t binop_p_230676 = sub64(defunc_0_f_res_230670,
                                           defunc_0_g_res_230623);
            double defunc_0_f_res_230677 = sitofp_i64_f64(binop_p_230676);
            double abs_res_230678 = fabs(defunc_0_f_res_230677);
            double tmp1_230679 = abs_res_230678 / x_230620;
            double x_230680 = tmp1_230679 * tmp1_230679;
            double y_230681 = tmp1_230679 * x_230680;
            double tmp2_230682 = 1.0 - y_230681;
            double x_230683 = tmp2_230682 * tmp2_230682;
            double tmp3_230684 = tmp2_230682 * x_230683;
            double tmp4_230685 = defunc_0_f_res_230673 * tmp3_230684;
            double defunc_1_op_res_230686 = tmp4_230685 + redout_230667;
            
            ((double *) mem_230624)[i_230666] = tmp4_230685;
            
            double redout_tmp_230700 = defunc_1_op_res_230686;
            
            redout_230667 = redout_tmp_230700;
        }
        defunc_2_reduce_res_230626 = redout_230667;
        
        double a0_230650 = 1.0 / defunc_2_reduce_res_230626;
        double defunc_2_reduce_res_230651;
        double redout_230689 = 0.0;
        
        for (int64_t i_230688 = 0; i_230688 < q_l_203495; i_230688++) {
            double x_230690;
            
            x_230690 = ((double *) mem_230624)[i_230688];
            
            bool cond_230691 = sle64(n_203490, i_230688);
            double defunc_0_f_res_230692;
            
            if (cond_230691) {
                defunc_0_f_res_230692 = 0.0;
            } else {
                int64_t i_230693 = add64(x_230619, i_230688);
                double defunc_0_add_arg_230694;
                
                defunc_0_add_arg_230694 =
                    ((double *) mem_219293.mem)[gtid_212962 * n_203490 +
                                                i_230693];
                defunc_0_f_res_230692 = defunc_0_add_arg_230694;
            }
            
            double x_230695 = a0_230650 * x_230690;
            double defunc_9_fit_fun_res_230696 = defunc_0_f_res_230692 *
                   x_230695;
            double defunc_1_op_res_230697 = defunc_9_fit_fun_res_230696 +
                   redout_230689;
            double redout_tmp_230702 = defunc_1_op_res_230697;
            
            redout_230689 = redout_tmp_230702;
        }
        defunc_2_reduce_res_230651 = redout_230689;
        ((double *) mem_219436.mem)[gtid_230618] = defunc_2_reduce_res_230651;
    }
    
  cleanup:
    { }
    free(mem_230624);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236153_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236153_end -
                 futhark_mc_segmap_parloop_236153_start;
        
        ctx->futhark_mc_segmap_parloop_236153_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236153_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236153_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236151(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230617 = tid;
    int num_tasks_230664 = info.nsubtasks;
    struct futhark_mc_task_236150 *futhark_mc_task_236150 =
                                  (struct futhark_mc_task_236150 *) args;
    struct futhark_context *ctx = futhark_mc_task_236150->ctx;
    uint64_t futhark_mc_segmap_task_236151_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236151_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236150->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236150->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236150->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236150->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236150->free_i_203670;
    int64_t gtid_212962 = futhark_mc_task_236150->free_gtid_212962;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236150->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236150->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236150->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236150->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236150->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236150->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236150->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 = futhark_mc_task_236150->free_bytes_219417;
    struct memblock mem_219436 = {.desc ="mem_219436", .mem =
                                  futhark_mc_task_236150->free_mem_219436,
                                  .size =0, .references =NULL};
    int64_t iter_230665;
    struct futhark_mc_segmap_parloop_struct_236152
    futhark_mc_segmap_parloop_struct_236152;
    
    futhark_mc_segmap_parloop_struct_236152.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236152.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236152.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236152.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236152.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236152.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236152.free_gtid_212962 = gtid_212962;
    futhark_mc_segmap_parloop_struct_236152.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236152.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236152.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236152.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236152.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236152.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236152.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236152.free_bytes_219417 = bytes_219417;
    futhark_mc_segmap_parloop_struct_236152.free_mem_219436 = mem_219436.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236153_task;
    
    futhark_mc_segmap_parloop_236153_task.name =
        "futhark_mc_segmap_parloop_236153";
    futhark_mc_segmap_parloop_236153_task.fn = futhark_mc_segmap_parloop_236153;
    futhark_mc_segmap_parloop_236153_task.args =
        &futhark_mc_segmap_parloop_struct_236152;
    futhark_mc_segmap_parloop_236153_task.iterations = iterations;
    futhark_mc_segmap_parloop_236153_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236153_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236153_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236153_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236153_task);
    
    if (futhark_mc_segmap_parloop_236153_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236153_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236153_total_end -
                 futhark_mc_segmap_parloop_236153_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236153_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236153_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236153_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236151_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236151_end -
                 futhark_mc_segmap_task_236151_start;
        
        ctx->futhark_mc_segmap_task_236151_runs[tid]++;
        ctx->futhark_mc_segmap_task_236151_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236151_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236156 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_212962;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219417;
    unsigned char *free_mem_219436;
};
struct futhark_mc_task_236159 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212962;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_230573;
    double free_x_230574;
    int64_t free_defunc_0_g_res_230577;
    double *retval_defunc_2_reduce_res_230579;
    unsigned char *retval_mem_230578;
};
struct futhark_mc_segred_stage_1_parloop_struct_236162 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212962;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_230573;
    double free_x_230574;
    int64_t free_defunc_0_g_res_230577;
    unsigned char *free_mem_230578;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230741;
};
static int futhark_mc_segred_stage_1_parloop_236163(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230704,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236162
    *futhark_mc_segred_stage_1_parloop_struct_236162 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236162 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236162->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236163_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236163_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236162->free_n_203490;
    int64_t gtid_212962 =
            futhark_mc_segred_stage_1_parloop_struct_236162->free_gtid_212962;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236162->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236162->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236162->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236162->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_230573 =
            futhark_mc_segred_stage_1_parloop_struct_236162->free_x_230573;
    double x_230574 =
           futhark_mc_segred_stage_1_parloop_struct_236162->free_x_230574;
    int64_t defunc_0_g_res_230577 =
            futhark_mc_segred_stage_1_parloop_struct_236162->free_defunc_0_g_res_230577;
    struct memblock mem_230578 = {.desc ="mem_230578", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236162->free_mem_230578,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230741 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230741",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236162->free_reduce_stage_1_tid_res_arr_mem_230741,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230743 = start;
    double x_230706;
    double x_230707;
    double local_acc_230744 = 0.0;
    
    for (; iter_230743 < end; iter_230743++) {
        int64_t gtid_230705 = iter_230743;
        bool cond_230709 = sle64(n_203490, gtid_230705);
        int64_t defunc_0_f_res_230710;
        
        if (cond_230709) {
            defunc_0_f_res_230710 = (int64_t) 0;
        } else {
            int64_t i_230711 = add64(x_230573, gtid_230705);
            int64_t defunc_1_add_res_230712 = add64((int64_t) 1, i_230711);
            
            defunc_0_f_res_230710 = defunc_1_add_res_230712;
        }
        
        double defunc_0_f_res_230713;
        
        if (cond_230709) {
            defunc_0_f_res_230713 = 0.0;
        } else {
            int64_t i_230714 = add64(x_230573, gtid_230705);
            double defunc_0_add_arg_230715;
            
            defunc_0_add_arg_230715 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_212962 *
                                                   ctx_param_ext_217867 +
                                                   i_230714 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_230713 = defunc_0_add_arg_230715;
        }
        
        int64_t binop_p_230716 = sub64(defunc_0_f_res_230710,
                                       defunc_0_g_res_230577);
        double defunc_0_f_res_230717 = sitofp_i64_f64(binop_p_230716);
        double abs_res_230718 = fabs(defunc_0_f_res_230717);
        double tmp1_230719 = abs_res_230718 / x_230574;
        double x_230720 = tmp1_230719 * tmp1_230719;
        double y_230721 = tmp1_230719 * x_230720;
        double tmp2_230722 = 1.0 - y_230721;
        double x_230723 = tmp2_230722 * tmp2_230722;
        double tmp3_230724 = tmp2_230722 * x_230723;
        double tmp4_230725 = defunc_0_f_res_230713 * tmp3_230724;
        
        // save map-out results
        {
            ((double *) mem_230578.mem)[gtid_230705] = tmp4_230725;
        }
        // Load accum params
        {
            x_230706 = local_acc_230744;
        }
        // Load next params
        {
            x_230707 = tmp4_230725;
        }
        // Red body
        {
            double defunc_1_op_res_230708 = x_230706 + x_230707;
            
            local_acc_230744 = defunc_1_op_res_230708;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230741.mem)[flat_tid_230704] =
        local_acc_230744;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236163_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236163_end -
                 futhark_mc_segred_stage_1_parloop_236163_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236163_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236163_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236163_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236160(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230704 = tid;
    int num_tasks_230740 = info.nsubtasks;
    struct futhark_mc_task_236159 *futhark_mc_task_236159 =
                                  (struct futhark_mc_task_236159 *) args;
    struct futhark_context *ctx = futhark_mc_task_236159->ctx;
    uint64_t futhark_mc_segred_task_236160_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236160_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236159->free_n_203490;
    int64_t gtid_212962 = futhark_mc_task_236159->free_gtid_212962;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236159->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236159->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236159->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236159->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_230573 = futhark_mc_task_236159->free_x_230573;
    double x_230574 = futhark_mc_task_236159->free_x_230574;
    int64_t defunc_0_g_res_230577 =
            futhark_mc_task_236159->free_defunc_0_g_res_230577;
    double defunc_2_reduce_res_230579 =
           *futhark_mc_task_236159->retval_defunc_2_reduce_res_230579;
    struct memblock mem_230578 = {.desc ="mem_230578", .mem =
                                  futhark_mc_task_236159->retval_mem_230578,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_230741_cached_sizze_236161 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230741 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230741_cached_sizze_236161 <
        (size_t) ((int64_t) 8 * num_tasks_230740)) {
        reduce_stage_1_tid_res_arr_mem_230741 =
            realloc(reduce_stage_1_tid_res_arr_mem_230741, (int64_t) 8 *
                    num_tasks_230740);
        reduce_stage_1_tid_res_arr_mem_230741_cached_sizze_236161 =
            (int64_t) 8 * num_tasks_230740;
    }
    
    int64_t iter_230743;
    struct futhark_mc_segred_stage_1_parloop_struct_236162
    futhark_mc_segred_stage_1_parloop_struct_236162;
    
    futhark_mc_segred_stage_1_parloop_struct_236162.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_gtid_212962 =
        gtid_212962;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_x_230573 = x_230573;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_x_230574 = x_230574;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_defunc_0_g_res_230577 =
        defunc_0_g_res_230577;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_mem_230578 =
        mem_230578.mem;
    futhark_mc_segred_stage_1_parloop_struct_236162.free_reduce_stage_1_tid_res_arr_mem_230741 =
        reduce_stage_1_tid_res_arr_mem_230741;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236163_task;
    
    futhark_mc_segred_stage_1_parloop_236163_task.name =
        "futhark_mc_segred_stage_1_parloop_236163";
    futhark_mc_segred_stage_1_parloop_236163_task.fn =
        futhark_mc_segred_stage_1_parloop_236163;
    futhark_mc_segred_stage_1_parloop_236163_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236162;
    futhark_mc_segred_stage_1_parloop_236163_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236163_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236163_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236163_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236163_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236163_task);
    
    if (futhark_mc_segred_stage_1_parloop_236163_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236163_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236163_total_end -
                 futhark_mc_segred_stage_1_parloop_236163_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236163_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236163_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236163_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230579 = 0.0;
    }
    
    double x_230745;
    double x_230746;
    
    for (int32_t i_230748 = 0; i_230748 < num_tasks_230740; i_230748++) {
        flat_tid_230704 = i_230748;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230745 = defunc_2_reduce_res_230579;
            }
            // load next params
            {
                x_230746 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230741)[flat_tid_230704];
            }
            // red body
            {
                double defunc_1_op_res_230747 = x_230745 + x_230746;
                
                defunc_2_reduce_res_230579 = defunc_1_op_res_230747;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230741);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236160_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236160_end -
                 futhark_mc_segred_task_236160_start;
        
        ctx->futhark_mc_segred_task_236160_runs[tid]++;
        ctx->futhark_mc_segred_task_236160_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236160_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236159->retval_defunc_2_reduce_res_230579 =
            defunc_2_reduce_res_230579;
        futhark_mc_task_236159->retval_mem_230578 = mem_230578.mem;
    }
    return err;
}
struct futhark_mc_task_236164 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212962;
    unsigned char *free_mem_219293;
    int64_t free_x_230573;
    unsigned char *free_mem_230578;
    double free_a0_230603;
    double *retval_defunc_2_reduce_res_230604;
};
struct futhark_mc_segred_stage_1_parloop_struct_236167 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_212962;
    unsigned char *free_mem_219293;
    int64_t free_x_230573;
    unsigned char *free_mem_230578;
    double free_a0_230603;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230750;
};
static int futhark_mc_segred_stage_1_parloop_236168(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230726,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236167
    *futhark_mc_segred_stage_1_parloop_struct_236167 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236167 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236167->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236168_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236168_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236167->free_n_203490;
    int64_t gtid_212962 =
            futhark_mc_segred_stage_1_parloop_struct_236167->free_gtid_212962;
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236167->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_230573 =
            futhark_mc_segred_stage_1_parloop_struct_236167->free_x_230573;
    struct memblock mem_230578 = {.desc ="mem_230578", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236167->free_mem_230578,
                                  .size =0, .references =NULL};
    double a0_230603 =
           futhark_mc_segred_stage_1_parloop_struct_236167->free_a0_230603;
    struct memblock reduce_stage_1_tid_res_arr_mem_230750 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230750",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236167->free_reduce_stage_1_tid_res_arr_mem_230750,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230752 = start;
    double x_230728;
    double x_230729;
    double local_acc_230753 = 0.0;
    
    for (; iter_230752 < end; iter_230752++) {
        int64_t gtid_230727 = iter_230752;
        double x_230731;
        
        x_230731 = ((double *) mem_230578.mem)[gtid_230727];
        
        bool cond_230732 = sle64(n_203490, gtid_230727);
        double defunc_0_f_res_230733;
        
        if (cond_230732) {
            defunc_0_f_res_230733 = 0.0;
        } else {
            int64_t i_230734 = add64(x_230573, gtid_230727);
            double defunc_0_add_arg_230735;
            
            defunc_0_add_arg_230735 = ((double *) mem_219293.mem)[gtid_212962 *
                                                                  n_203490 +
                                                                  i_230734];
            defunc_0_f_res_230733 = defunc_0_add_arg_230735;
        }
        
        double x_230736 = a0_230603 * x_230731;
        double defunc_9_fit_fun_res_230737 = defunc_0_f_res_230733 * x_230736;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230728 = local_acc_230753;
        }
        // Load next params
        {
            x_230729 = defunc_9_fit_fun_res_230737;
        }
        // Red body
        {
            double defunc_1_op_res_230730 = x_230728 + x_230729;
            
            local_acc_230753 = defunc_1_op_res_230730;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230750.mem)[flat_tid_230726] =
        local_acc_230753;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236168_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236168_end -
                 futhark_mc_segred_stage_1_parloop_236168_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236168_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236168_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236168_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236165(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230726 = tid;
    int num_tasks_230749 = info.nsubtasks;
    struct futhark_mc_task_236164 *futhark_mc_task_236164 =
                                  (struct futhark_mc_task_236164 *) args;
    struct futhark_context *ctx = futhark_mc_task_236164->ctx;
    uint64_t futhark_mc_segred_task_236165_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236165_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236164->free_n_203490;
    int64_t gtid_212962 = futhark_mc_task_236164->free_gtid_212962;
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236164->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_230573 = futhark_mc_task_236164->free_x_230573;
    struct memblock mem_230578 = {.desc ="mem_230578", .mem =
                                  futhark_mc_task_236164->free_mem_230578,
                                  .size =0, .references =NULL};
    double a0_230603 = futhark_mc_task_236164->free_a0_230603;
    double defunc_2_reduce_res_230604 =
           *futhark_mc_task_236164->retval_defunc_2_reduce_res_230604;
    size_t reduce_stage_1_tid_res_arr_mem_230750_cached_sizze_236166 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230750 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230750_cached_sizze_236166 <
        (size_t) ((int64_t) 8 * num_tasks_230749)) {
        reduce_stage_1_tid_res_arr_mem_230750 =
            realloc(reduce_stage_1_tid_res_arr_mem_230750, (int64_t) 8 *
                    num_tasks_230749);
        reduce_stage_1_tid_res_arr_mem_230750_cached_sizze_236166 =
            (int64_t) 8 * num_tasks_230749;
    }
    
    int64_t iter_230752;
    struct futhark_mc_segred_stage_1_parloop_struct_236167
    futhark_mc_segred_stage_1_parloop_struct_236167;
    
    futhark_mc_segred_stage_1_parloop_struct_236167.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236167.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236167.free_gtid_212962 =
        gtid_212962;
    futhark_mc_segred_stage_1_parloop_struct_236167.free_mem_219293 =
        mem_219293.mem;
    futhark_mc_segred_stage_1_parloop_struct_236167.free_x_230573 = x_230573;
    futhark_mc_segred_stage_1_parloop_struct_236167.free_mem_230578 =
        mem_230578.mem;
    futhark_mc_segred_stage_1_parloop_struct_236167.free_a0_230603 = a0_230603;
    futhark_mc_segred_stage_1_parloop_struct_236167.free_reduce_stage_1_tid_res_arr_mem_230750 =
        reduce_stage_1_tid_res_arr_mem_230750;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236168_task;
    
    futhark_mc_segred_stage_1_parloop_236168_task.name =
        "futhark_mc_segred_stage_1_parloop_236168";
    futhark_mc_segred_stage_1_parloop_236168_task.fn =
        futhark_mc_segred_stage_1_parloop_236168;
    futhark_mc_segred_stage_1_parloop_236168_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236167;
    futhark_mc_segred_stage_1_parloop_236168_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236168_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236168_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236168_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236168_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236168_task);
    
    if (futhark_mc_segred_stage_1_parloop_236168_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236168_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236168_total_end -
                 futhark_mc_segred_stage_1_parloop_236168_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236168_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236168_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236168_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230604 = 0.0;
    }
    
    double x_230754;
    double x_230755;
    
    for (int32_t i_230757 = 0; i_230757 < num_tasks_230749; i_230757++) {
        flat_tid_230726 = i_230757;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230754 = defunc_2_reduce_res_230604;
            }
            // load next params
            {
                x_230755 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230750)[flat_tid_230726];
            }
            // red body
            {
                double defunc_1_op_res_230756 = x_230754 + x_230755;
                
                defunc_2_reduce_res_230604 = defunc_1_op_res_230756;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230750);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236165_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236165_end -
                 futhark_mc_segred_task_236165_start;
        
        ctx->futhark_mc_segred_task_236165_runs[tid]++;
        ctx->futhark_mc_segred_task_236165_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236165_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236164->retval_defunc_2_reduce_res_230604 =
            defunc_2_reduce_res_230604;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236157(void *args, int64_t start,
                                            int64_t end, int flat_tid_230571,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236156
    *futhark_mc_segmap_parloop_struct_236156 =
    (struct futhark_mc_segmap_parloop_struct_236156 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236156->ctx;
    uint64_t futhark_mc_segmap_parloop_236157_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236157_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236156->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236156->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236156->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236156->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236156->free_i_203670;
    int64_t gtid_212962 =
            futhark_mc_segmap_parloop_struct_236156->free_gtid_212962;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236156->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236156->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236156->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236156->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236156->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236156->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236156->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 =
            futhark_mc_segmap_parloop_struct_236156->free_bytes_219417;
    struct memblock mem_219436 = {.desc ="mem_219436", .mem =
                                  futhark_mc_segmap_parloop_struct_236156->free_mem_219436,
                                  .size =0, .references =NULL};
    size_t mem_230578_cached_sizze_236158 = 0;
    unsigned char *mem_230578 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230703 = start;
    
    if (mem_230578_cached_sizze_236158 < (size_t) bytes_219417) {
        mem_230578 = realloc(mem_230578, bytes_219417);
        mem_230578_cached_sizze_236158 = bytes_219417;
    }
    for (; iter_230703 < end; iter_230703++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230738 = l_n_m_203643;
        int64_t gtid_230572 = iter_230703;
        int64_t remnant_230739 = iter_230703 - gtid_230572;
        int64_t x_230573;
        
        x_230573 = ((int64_t *) mem_217773.mem)[gtid_212962 * l_n_m_203643 +
                                                gtid_230572];
        
        double x_230574;
        
        x_230574 = ((double *) mem_217777.mem)[gtid_212962 * l_n_m_203643 +
                                               gtid_230572];
        
        int64_t min_arg_230575 = mul64(jump_t_203500, gtid_230572);
        int64_t min_res_230576 = smin64(i_203670, min_arg_230575);
        int64_t defunc_0_g_res_230577 = add64((int64_t) 1, min_res_230576);
        double defunc_2_reduce_res_230579;
        int64_t flat_tid_230704 = (int64_t) 0;
        int32_t num_tasks_230740;
        
        defunc_2_reduce_res_230579 = 0.0;
        
        struct futhark_mc_task_236159 futhark_mc_task_236159;
        
        futhark_mc_task_236159.ctx = ctx;
        futhark_mc_task_236159.free_n_203490 = n_203490;
        futhark_mc_task_236159.free_gtid_212962 = gtid_212962;
        futhark_mc_task_236159.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236159.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236159.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236159.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236159.free_x_230573 = x_230573;
        futhark_mc_task_236159.free_x_230574 = x_230574;
        futhark_mc_task_236159.free_defunc_0_g_res_230577 =
            defunc_0_g_res_230577;
        futhark_mc_task_236159.retval_defunc_2_reduce_res_230579 =
            &defunc_2_reduce_res_230579;
        futhark_mc_task_236159.retval_mem_230578 = mem_230578;
        
        struct scheduler_segop futhark_mc_task_236159_task;
        
        futhark_mc_task_236159_task.args = &futhark_mc_task_236159;
        futhark_mc_task_236159_task.top_level_fn =
            futhark_mc_segred_task_236160;
        futhark_mc_task_236159_task.name = "futhark_mc_segred_task_236160";
        futhark_mc_task_236159_task.iterations = q_l_203495;
        futhark_mc_task_236159_task.task_time =
            &ctx->futhark_mc_segred_task_236160_total_time;
        futhark_mc_task_236159_task.task_iter =
            &ctx->futhark_mc_segred_task_236160_total_iter;
        futhark_mc_task_236159_task.sched = STATIC;
        futhark_mc_task_236159_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236160_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236159_task);
        
        if (futhark_mc_segred_task_236160_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_230603 = 1.0 / defunc_2_reduce_res_230579;
        double defunc_2_reduce_res_230604;
        int64_t flat_tid_230726 = (int64_t) 0;
        int32_t num_tasks_230749;
        
        defunc_2_reduce_res_230604 = 0.0;
        
        struct futhark_mc_task_236164 futhark_mc_task_236164;
        
        futhark_mc_task_236164.ctx = ctx;
        futhark_mc_task_236164.free_n_203490 = n_203490;
        futhark_mc_task_236164.free_gtid_212962 = gtid_212962;
        futhark_mc_task_236164.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236164.free_x_230573 = x_230573;
        futhark_mc_task_236164.free_mem_230578 = mem_230578;
        futhark_mc_task_236164.free_a0_230603 = a0_230603;
        futhark_mc_task_236164.retval_defunc_2_reduce_res_230604 =
            &defunc_2_reduce_res_230604;
        
        struct scheduler_segop futhark_mc_task_236164_task;
        
        futhark_mc_task_236164_task.args = &futhark_mc_task_236164;
        futhark_mc_task_236164_task.top_level_fn =
            futhark_mc_segred_task_236165;
        futhark_mc_task_236164_task.name = "futhark_mc_segred_task_236165";
        futhark_mc_task_236164_task.iterations = q_l_203495;
        futhark_mc_task_236164_task.task_time =
            &ctx->futhark_mc_segred_task_236165_total_time;
        futhark_mc_task_236164_task.task_iter =
            &ctx->futhark_mc_segred_task_236165_total_iter;
        futhark_mc_task_236164_task.sched = STATIC;
        futhark_mc_task_236164_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236165_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236164_task);
        
        if (futhark_mc_segred_task_236165_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219436.mem)[gtid_230572] = defunc_2_reduce_res_230604;
    }
    
  cleanup:
    { }
    free(mem_230578);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236157_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236157_end -
                 futhark_mc_segmap_parloop_236157_start;
        
        ctx->futhark_mc_segmap_parloop_236157_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236157_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236157_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236155(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230571 = tid;
    int num_tasks_230664 = info.nsubtasks;
    struct futhark_mc_task_236150 *futhark_mc_task_236150 =
                                  (struct futhark_mc_task_236150 *) args;
    struct futhark_context *ctx = futhark_mc_task_236150->ctx;
    uint64_t futhark_mc_segmap_nested_task_236155_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236155_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236150->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236150->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236150->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236150->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236150->free_i_203670;
    int64_t gtid_212962 = futhark_mc_task_236150->free_gtid_212962;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236150->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236150->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236150->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236150->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236150->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236150->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236150->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 = futhark_mc_task_236150->free_bytes_219417;
    struct memblock mem_219436 = {.desc ="mem_219436", .mem =
                                  futhark_mc_task_236150->free_mem_219436,
                                  .size =0, .references =NULL};
    int64_t iter_230703;
    struct futhark_mc_segmap_parloop_struct_236156
    futhark_mc_segmap_parloop_struct_236156;
    
    futhark_mc_segmap_parloop_struct_236156.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236156.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236156.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236156.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236156.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236156.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236156.free_gtid_212962 = gtid_212962;
    futhark_mc_segmap_parloop_struct_236156.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236156.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236156.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236156.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236156.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236156.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236156.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236156.free_bytes_219417 = bytes_219417;
    futhark_mc_segmap_parloop_struct_236156.free_mem_219436 = mem_219436.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236157_task;
    
    futhark_mc_segmap_parloop_236157_task.name =
        "futhark_mc_segmap_parloop_236157";
    futhark_mc_segmap_parloop_236157_task.fn = futhark_mc_segmap_parloop_236157;
    futhark_mc_segmap_parloop_236157_task.args =
        &futhark_mc_segmap_parloop_struct_236156;
    futhark_mc_segmap_parloop_236157_task.iterations = iterations;
    futhark_mc_segmap_parloop_236157_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236157_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236157_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236157_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236157_task);
    
    if (futhark_mc_segmap_parloop_236157_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236157_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236157_total_end -
                 futhark_mc_segmap_parloop_236157_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236157_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236157_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236157_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236155_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236155_end -
                 futhark_mc_segmap_nested_task_236155_start;
        
        ctx->futhark_mc_segmap_nested_task_236155_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236155_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236155_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236148(void *args, int64_t start,
                                            int64_t end, int flat_tid_212961,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236147
    *futhark_mc_segmap_parloop_struct_236147 =
    (struct futhark_mc_segmap_parloop_struct_236147 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236147->ctx;
    uint64_t futhark_mc_segmap_parloop_236148_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236148_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236147->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236147->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236147->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236147->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236147->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236147->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236147->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236147->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236147->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236147->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236147->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236147->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236147->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236147->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 =
            futhark_mc_segmap_parloop_struct_236147->free_bytes_219417;
    struct memblock mem_219470 = {.desc ="mem_219470", .mem =
                                  futhark_mc_segmap_parloop_struct_236147->free_mem_219470,
                                  .size =0, .references =NULL};
    size_t mem_219436_cached_sizze_236149 = 0;
    unsigned char *mem_219436 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230570 = start;
    
    if (mem_219436_cached_sizze_236149 < (size_t) bytes_217720) {
        mem_219436 = realloc(mem_219436, bytes_217720);
        mem_219436_cached_sizze_236149 = bytes_217720;
    }
    for (; iter_230570 < end; iter_230570++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230662 = partition_sizze_203577;
        int64_t gtid_212962 = iter_230570;
        int64_t remnant_230663 = iter_230570 - gtid_212962;
        int64_t flat_tid_230617 = (int64_t) 0;
        int32_t num_tasks_230664;
        int64_t flat_tid_230571 = (int64_t) 0;
        struct futhark_mc_task_236150 futhark_mc_task_236150;
        
        futhark_mc_task_236150.ctx = ctx;
        futhark_mc_task_236150.free_n_203490 = n_203490;
        futhark_mc_task_236150.free_q_l_203495 = q_l_203495;
        futhark_mc_task_236150.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236150.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_236150.free_i_203670 = i_203670;
        futhark_mc_task_236150.free_gtid_212962 = gtid_212962;
        futhark_mc_task_236150.free_mem_217773 = mem_217773.mem;
        futhark_mc_task_236150.free_mem_217777 = mem_217777.mem;
        futhark_mc_task_236150.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236150.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236150.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236150.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236150.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236150.free_bytes_219417 = bytes_219417;
        futhark_mc_task_236150.free_mem_219436 = mem_219436;
        
        struct scheduler_segop futhark_mc_task_236150_task;
        
        futhark_mc_task_236150_task.args = &futhark_mc_task_236150;
        futhark_mc_task_236150_task.top_level_fn =
            futhark_mc_segmap_task_236151;
        futhark_mc_task_236150_task.name = "futhark_mc_segmap_task_236151";
        futhark_mc_task_236150_task.iterations = l_n_m_203643;
        futhark_mc_task_236150_task.task_time =
            &ctx->futhark_mc_segmap_task_236151_total_time;
        futhark_mc_task_236150_task.task_iter =
            &ctx->futhark_mc_segmap_task_236151_total_iter;
        futhark_mc_task_236150_task.sched = STATIC;
        futhark_mc_task_236150_task.nested_fn =
            futhark_mc_segmap_nested_task_236155;
        
        int futhark_mc_segmap_task_236151_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236150_task);
        
        if (futhark_mc_segmap_task_236151_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219470.mem + gtid_212962 * l_n_m_203643 * (int64_t) 8,
                    mem_219436 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219436);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236148_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236148_end -
                 futhark_mc_segmap_parloop_236148_start;
        
        ctx->futhark_mc_segmap_parloop_236148_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236148_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236148_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236146(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212961 = tid;
    int num_tasks_230517 = info.nsubtasks;
    struct futhark_mc_task_236140 *futhark_mc_task_236140 =
                                  (struct futhark_mc_task_236140 *) args;
    struct futhark_context *ctx = futhark_mc_task_236140->ctx;
    uint64_t futhark_mc_segmap_nested_task_236146_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236146_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236140->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236140->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236140->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236140->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236140->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236140->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236140->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236140->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236140->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236140->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236140->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236140->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236140->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236140->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219417 = futhark_mc_task_236140->free_bytes_219417;
    struct memblock mem_219470 = {.desc ="mem_219470", .mem =
                                  futhark_mc_task_236140->free_mem_219470,
                                  .size =0, .references =NULL};
    int64_t iter_230570;
    struct futhark_mc_segmap_parloop_struct_236147
    futhark_mc_segmap_parloop_struct_236147;
    
    futhark_mc_segmap_parloop_struct_236147.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236147.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236147.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236147.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236147.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236147.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236147.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236147.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236147.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236147.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236147.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236147.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236147.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236147.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236147.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236147.free_bytes_219417 = bytes_219417;
    futhark_mc_segmap_parloop_struct_236147.free_mem_219470 = mem_219470.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236148_task;
    
    futhark_mc_segmap_parloop_236148_task.name =
        "futhark_mc_segmap_parloop_236148";
    futhark_mc_segmap_parloop_236148_task.fn = futhark_mc_segmap_parloop_236148;
    futhark_mc_segmap_parloop_236148_task.args =
        &futhark_mc_segmap_parloop_struct_236147;
    futhark_mc_segmap_parloop_236148_task.iterations = iterations;
    futhark_mc_segmap_parloop_236148_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236148_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236148_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236148_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236148_task);
    
    if (futhark_mc_segmap_parloop_236148_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236148_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236148_total_end -
                 futhark_mc_segmap_parloop_236148_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236148_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236148_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236148_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236146_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236146_end -
                 futhark_mc_segmap_nested_task_236146_start;
        
        ctx->futhark_mc_segmap_nested_task_236146_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236146_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236146_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236169 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219472;
    unsigned char *free_mem_219576;
    unsigned char *free_mem_219580;
};
struct futhark_mc_segmap_parloop_struct_236171 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219472;
    unsigned char *free_mem_219576;
    unsigned char *free_mem_219580;
};
static int futhark_mc_segmap_parloop_236172(void *args, int64_t start,
                                            int64_t end, int flat_tid_213060,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236171
    *futhark_mc_segmap_parloop_struct_236171 =
    (struct futhark_mc_segmap_parloop_struct_236171 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236171->ctx;
    uint64_t futhark_mc_segmap_parloop_236172_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236172_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236171->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236171->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236171->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236171->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236171->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236171->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236171->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236171->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236171->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236171->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236171->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236171->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236171->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236171->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 =
            futhark_mc_segmap_parloop_struct_236171->free_bytes_219472;
    struct memblock mem_219576 = {.desc ="mem_219576", .mem =
                                  futhark_mc_segmap_parloop_struct_236171->free_mem_219576,
                                  .size =0, .references =NULL};
    struct memblock mem_219580 = {.desc ="mem_219580", .mem =
                                  futhark_mc_segmap_parloop_struct_236171->free_mem_219580,
                                  .size =0, .references =NULL};
    size_t mem_219515_cached_sizze_236173 = 0;
    unsigned char *mem_219515 = NULL;
    size_t mem_219518_cached_sizze_236174 = 0;
    unsigned char *mem_219518 = NULL;
    size_t mem_219535_cached_sizze_236175 = 0;
    unsigned char *mem_219535 = NULL;
    size_t mem_219538_cached_sizze_236176 = 0;
    unsigned char *mem_219538 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230759 = start;
    
    if (mem_219515_cached_sizze_236173 < (size_t) bytes_217720) {
        mem_219515 = realloc(mem_219515, bytes_217720);
        mem_219515_cached_sizze_236173 = bytes_217720;
    }
    if (mem_219518_cached_sizze_236174 < (size_t) bytes_217720) {
        mem_219518 = realloc(mem_219518, bytes_217720);
        mem_219518_cached_sizze_236174 = bytes_217720;
    }
    if (mem_219535_cached_sizze_236175 < (size_t) bytes_219472) {
        mem_219535 = realloc(mem_219535, bytes_219472);
        mem_219535_cached_sizze_236175 = bytes_219472;
    }
    if (mem_219538_cached_sizze_236176 < (size_t) bytes_219472) {
        mem_219538 = realloc(mem_219538, bytes_219472);
        mem_219538_cached_sizze_236176 = bytes_219472;
    }
    for (; iter_230759 < end; iter_230759++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230836 = partition_sizze_203577;
        int64_t gtid_213061 = iter_230759;
        int64_t remnant_230837 = iter_230759 - gtid_213061;
        
        for (int64_t i_230760 = 0; i_230760 < l_n_m_203643; i_230760++) {
            int64_t x_230763;
            
            x_230763 = ((int64_t *) mem_217773.mem)[gtid_213061 * l_n_m_203643 +
                                                    i_230760];
            
            double x_230764;
            
            x_230764 = ((double *) mem_217777.mem)[gtid_213061 * l_n_m_203643 +
                                                   i_230760];
            
            int64_t min_arg_230765 = mul64(jump_t_203500, i_230760);
            int64_t min_res_230766 = smin64(i_203670, min_arg_230765);
            int64_t defunc_0_g_res_230767 = add64((int64_t) 1, min_res_230766);
            double defunc_2_reduce_res_230770;
            double defunc_2_reduce_res_230771;
            double defunc_2_reduce_res_230772;
            double redout_230776;
            double redout_230777;
            double redout_230778;
            
            redout_230776 = 0.0;
            redout_230777 = 0.0;
            redout_230778 = 0.0;
            for (int64_t i_230775 = 0; i_230775 < q_l_203495; i_230775++) {
                bool cond_230781 = sle64(n_203490, i_230775);
                int64_t defunc_0_f_res_230782;
                
                if (cond_230781) {
                    defunc_0_f_res_230782 = (int64_t) 0;
                } else {
                    int64_t i_230783 = add64(x_230763, i_230775);
                    int64_t defunc_1_add_res_230784 = add64((int64_t) 1,
                                                            i_230783);
                    
                    defunc_0_f_res_230782 = defunc_1_add_res_230784;
                }
                
                double defunc_0_f_res_230785;
                
                if (cond_230781) {
                    defunc_0_f_res_230785 = 0.0;
                } else {
                    int64_t i_230786 = add64(x_230763, i_230775);
                    double defunc_0_add_arg_230787;
                    
                    defunc_0_add_arg_230787 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_213061 *
                                                           ctx_param_ext_217867 +
                                                           i_230786 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_230785 = defunc_0_add_arg_230787;
                }
                
                int64_t binop_p_230788 = sub64(defunc_0_f_res_230782,
                                               defunc_0_g_res_230767);
                double defunc_0_f_res_230789 = sitofp_i64_f64(binop_p_230788);
                double abs_res_230790 = fabs(defunc_0_f_res_230789);
                double tmp1_230791 = abs_res_230790 / x_230764;
                double x_230792 = tmp1_230791 * tmp1_230791;
                double y_230793 = tmp1_230791 * x_230792;
                double tmp2_230794 = 1.0 - y_230793;
                double x_230795 = tmp2_230794 * tmp2_230794;
                double tmp3_230796 = tmp2_230794 * x_230795;
                double tmp4_230797 = defunc_0_f_res_230785 * tmp3_230796;
                double defunc_1_f_res_230798 = defunc_0_f_res_230789 *
                       tmp4_230797;
                double defunc_1_f_res_230799 = defunc_0_f_res_230789 *
                       defunc_1_f_res_230798;
                double defunc_1_op_res_230800 = tmp4_230797 + redout_230776;
                double defunc_1_op_res_230801 = defunc_1_f_res_230798 +
                       redout_230777;
                double defunc_1_op_res_230802 = defunc_1_f_res_230799 +
                       redout_230778;
                
                ((double *) mem_219535)[i_230775] = defunc_1_f_res_230798;
                ((double *) mem_219538)[i_230775] = tmp4_230797;
                
                double redout_tmp_230840 = defunc_1_op_res_230800;
                double redout_tmp_230841 = defunc_1_op_res_230801;
                double redout_tmp_230842 = defunc_1_op_res_230802;
                
                redout_230776 = redout_tmp_230840;
                redout_230777 = redout_tmp_230841;
                redout_230778 = redout_tmp_230842;
            }
            defunc_2_reduce_res_230770 = redout_230776;
            defunc_2_reduce_res_230771 = redout_230777;
            defunc_2_reduce_res_230772 = redout_230778;
            
            double x_230805 = defunc_2_reduce_res_230770 *
                   defunc_2_reduce_res_230772;
            double y_230806 = defunc_2_reduce_res_230771 *
                   defunc_2_reduce_res_230771;
            double y_230807 = x_230805 - y_230806;
            double det1_230808 = 1.0 / y_230807;
            double a11_230809 = defunc_2_reduce_res_230772 * det1_230808;
            double x_230810 = 0.0 - defunc_2_reduce_res_230771;
            double b11_230811 = det1_230808 * x_230810;
            double c11_230812 = defunc_2_reduce_res_230770 * det1_230808;
            double defunc_2_reduce_res_230813;
            double defunc_2_reduce_res_230814;
            double redout_230816;
            double redout_230817;
            
            redout_230816 = 0.0;
            redout_230817 = 0.0;
            for (int64_t i_230815 = 0; i_230815 < q_l_203495; i_230815++) {
                double x_230818;
                
                x_230818 = ((double *) mem_219538)[i_230815];
                
                double x_230819;
                
                x_230819 = ((double *) mem_219535)[i_230815];
                
                bool cond_230820 = sle64(n_203490, i_230815);
                double defunc_0_f_res_230821;
                
                if (cond_230820) {
                    defunc_0_f_res_230821 = 0.0;
                } else {
                    int64_t i_230822 = add64(x_230763, i_230815);
                    double defunc_0_add_arg_230823;
                    
                    defunc_0_add_arg_230823 =
                        ((double *) mem_219293.mem)[gtid_213061 * n_203490 +
                                                    i_230822];
                    defunc_0_f_res_230821 = defunc_0_add_arg_230823;
                }
                
                double x_230824 = a11_230809 * x_230818;
                double y_230825 = b11_230811 * x_230819;
                double x_230826 = x_230824 + y_230825;
                double defunc_9_fit_fun_res_230827 = defunc_0_f_res_230821 *
                       x_230826;
                double x_230828 = b11_230811 * x_230818;
                double y_230829 = c11_230812 * x_230819;
                double x_230830 = x_230828 + y_230829;
                double defunc_9_slope_fun_res_230831 = defunc_0_f_res_230821 *
                       x_230830;
                double defunc_1_op_res_230832 = defunc_9_fit_fun_res_230827 +
                       redout_230816;
                double defunc_1_op_res_230833 = defunc_9_slope_fun_res_230831 +
                       redout_230817;
                double redout_tmp_230845 = defunc_1_op_res_230832;
                double redout_tmp_230846 = defunc_1_op_res_230833;
                
                redout_230816 = redout_tmp_230845;
                redout_230817 = redout_tmp_230846;
            }
            defunc_2_reduce_res_230813 = redout_230816;
            defunc_2_reduce_res_230814 = redout_230817;
            ((double *) mem_219515)[i_230760] = defunc_2_reduce_res_230813;
            ((double *) mem_219518)[i_230760] = defunc_2_reduce_res_230814;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219576.mem + gtid_213061 * l_n_m_203643 * (int64_t) 8,
                    mem_219515 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219580.mem + gtid_213061 * l_n_m_203643 * (int64_t) 8,
                    mem_219518 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219515);
    free(mem_219518);
    free(mem_219535);
    free(mem_219538);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236172_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236172_end -
                 futhark_mc_segmap_parloop_236172_start;
        
        ctx->futhark_mc_segmap_parloop_236172_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236172_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236172_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236170(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213060 = tid;
    int num_tasks_230758 = info.nsubtasks;
    struct futhark_mc_task_236169 *futhark_mc_task_236169 =
                                  (struct futhark_mc_task_236169 *) args;
    struct futhark_context *ctx = futhark_mc_task_236169->ctx;
    uint64_t futhark_mc_segmap_task_236170_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236170_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236169->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236169->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236169->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236169->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236169->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236169->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236169->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236169->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236169->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236169->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236169->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236169->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236169->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236169->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 = futhark_mc_task_236169->free_bytes_219472;
    struct memblock mem_219576 = {.desc ="mem_219576", .mem =
                                  futhark_mc_task_236169->free_mem_219576,
                                  .size =0, .references =NULL};
    struct memblock mem_219580 = {.desc ="mem_219580", .mem =
                                  futhark_mc_task_236169->free_mem_219580,
                                  .size =0, .references =NULL};
    int64_t iter_230759;
    struct futhark_mc_segmap_parloop_struct_236171
    futhark_mc_segmap_parloop_struct_236171;
    
    futhark_mc_segmap_parloop_struct_236171.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236171.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236171.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236171.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236171.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236171.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236171.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236171.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236171.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236171.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236171.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236171.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236171.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236171.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236171.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236171.free_bytes_219472 = bytes_219472;
    futhark_mc_segmap_parloop_struct_236171.free_mem_219576 = mem_219576.mem;
    futhark_mc_segmap_parloop_struct_236171.free_mem_219580 = mem_219580.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236172_task;
    
    futhark_mc_segmap_parloop_236172_task.name =
        "futhark_mc_segmap_parloop_236172";
    futhark_mc_segmap_parloop_236172_task.fn = futhark_mc_segmap_parloop_236172;
    futhark_mc_segmap_parloop_236172_task.args =
        &futhark_mc_segmap_parloop_struct_236171;
    futhark_mc_segmap_parloop_236172_task.iterations = iterations;
    futhark_mc_segmap_parloop_236172_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236172_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236172_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236172_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236172_task);
    
    if (futhark_mc_segmap_parloop_236172_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236172_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236172_total_end -
                 futhark_mc_segmap_parloop_236172_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236172_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236172_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236172_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236170_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236170_end -
                 futhark_mc_segmap_task_236170_start;
        
        ctx->futhark_mc_segmap_task_236170_runs[tid]++;
        ctx->futhark_mc_segmap_task_236170_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236170_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236178 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219472;
    unsigned char *free_mem_219576;
    unsigned char *free_mem_219580;
};
struct futhark_mc_task_236182 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_213150;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219472;
    unsigned char *free_mem_219509;
    unsigned char *free_mem_219512;
};
struct futhark_mc_segmap_parloop_struct_236184 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_213150;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219472;
    unsigned char *free_mem_219509;
    unsigned char *free_mem_219512;
};
static int futhark_mc_segmap_parloop_236185(void *args, int64_t start,
                                            int64_t end, int flat_tid_230924,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236184
    *futhark_mc_segmap_parloop_struct_236184 =
    (struct futhark_mc_segmap_parloop_struct_236184 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236184->ctx;
    uint64_t futhark_mc_segmap_parloop_236185_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236185_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236184->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236184->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236184->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236184->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236184->free_i_203670;
    int64_t gtid_213150 =
            futhark_mc_segmap_parloop_struct_236184->free_gtid_213150;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236184->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236184->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236184->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236184->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236184->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236184->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236184->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 =
            futhark_mc_segmap_parloop_struct_236184->free_bytes_219472;
    struct memblock mem_219509 = {.desc ="mem_219509", .mem =
                                  futhark_mc_segmap_parloop_struct_236184->free_mem_219509,
                                  .size =0, .references =NULL};
    struct memblock mem_219512 = {.desc ="mem_219512", .mem =
                                  futhark_mc_segmap_parloop_struct_236184->free_mem_219512,
                                  .size =0, .references =NULL};
    size_t mem_230931_cached_sizze_236186 = 0;
    unsigned char *mem_230931 = NULL;
    size_t mem_230933_cached_sizze_236187 = 0;
    unsigned char *mem_230933 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231002 = start;
    
    if (mem_230931_cached_sizze_236186 < (size_t) bytes_219472) {
        mem_230931 = realloc(mem_230931, bytes_219472);
        mem_230931_cached_sizze_236186 = bytes_219472;
    }
    if (mem_230933_cached_sizze_236187 < (size_t) bytes_219472) {
        mem_230933 = realloc(mem_230933, bytes_219472);
        mem_230933_cached_sizze_236187 = bytes_219472;
    }
    for (; iter_231002 < end; iter_231002++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231052 = l_n_m_203643;
        int64_t gtid_230925 = iter_231002;
        int64_t remnant_231053 = iter_231002 - gtid_230925;
        int64_t x_230926;
        
        x_230926 = ((int64_t *) mem_217773.mem)[gtid_213150 * l_n_m_203643 +
                                                gtid_230925];
        
        double x_230927;
        
        x_230927 = ((double *) mem_217777.mem)[gtid_213150 * l_n_m_203643 +
                                               gtid_230925];
        
        int64_t min_arg_230928 = mul64(jump_t_203500, gtid_230925);
        int64_t min_res_230929 = smin64(i_203670, min_arg_230928);
        int64_t defunc_0_g_res_230930 = add64((int64_t) 1, min_res_230929);
        double defunc_2_reduce_res_230935;
        double defunc_2_reduce_res_230936;
        double defunc_2_reduce_res_230937;
        double redout_231004;
        double redout_231005;
        double redout_231006;
        
        redout_231004 = 0.0;
        redout_231005 = 0.0;
        redout_231006 = 0.0;
        for (int64_t i_231003 = 0; i_231003 < q_l_203495; i_231003++) {
            bool cond_231009 = sle64(n_203490, i_231003);
            int64_t defunc_0_f_res_231010;
            
            if (cond_231009) {
                defunc_0_f_res_231010 = (int64_t) 0;
            } else {
                int64_t i_231011 = add64(x_230926, i_231003);
                int64_t defunc_1_add_res_231012 = add64((int64_t) 1, i_231011);
                
                defunc_0_f_res_231010 = defunc_1_add_res_231012;
            }
            
            double defunc_0_f_res_231013;
            
            if (cond_231009) {
                defunc_0_f_res_231013 = 0.0;
            } else {
                int64_t i_231014 = add64(x_230926, i_231003);
                double defunc_0_add_arg_231015;
                
                defunc_0_add_arg_231015 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_213150 *
                                                       ctx_param_ext_217867 +
                                                       i_231014 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_231013 = defunc_0_add_arg_231015;
            }
            
            int64_t binop_p_231016 = sub64(defunc_0_f_res_231010,
                                           defunc_0_g_res_230930);
            double defunc_0_f_res_231017 = sitofp_i64_f64(binop_p_231016);
            double abs_res_231018 = fabs(defunc_0_f_res_231017);
            double tmp1_231019 = abs_res_231018 / x_230927;
            double x_231020 = tmp1_231019 * tmp1_231019;
            double y_231021 = tmp1_231019 * x_231020;
            double tmp2_231022 = 1.0 - y_231021;
            double x_231023 = tmp2_231022 * tmp2_231022;
            double tmp3_231024 = tmp2_231022 * x_231023;
            double tmp4_231025 = defunc_0_f_res_231013 * tmp3_231024;
            double defunc_1_f_res_231026 = defunc_0_f_res_231017 * tmp4_231025;
            double defunc_1_f_res_231027 = defunc_0_f_res_231017 *
                   defunc_1_f_res_231026;
            double defunc_1_op_res_231028 = tmp4_231025 + redout_231004;
            double defunc_1_op_res_231029 = defunc_1_f_res_231026 +
                   redout_231005;
            double defunc_1_op_res_231030 = defunc_1_f_res_231027 +
                   redout_231006;
            
            ((double *) mem_230931)[i_231003] = defunc_1_f_res_231026;
            ((double *) mem_230933)[i_231003] = tmp4_231025;
            
            double redout_tmp_231054 = defunc_1_op_res_231028;
            double redout_tmp_231055 = defunc_1_op_res_231029;
            double redout_tmp_231056 = defunc_1_op_res_231030;
            
            redout_231004 = redout_tmp_231054;
            redout_231005 = redout_tmp_231055;
            redout_231006 = redout_tmp_231056;
        }
        defunc_2_reduce_res_230935 = redout_231004;
        defunc_2_reduce_res_230936 = redout_231005;
        defunc_2_reduce_res_230937 = redout_231006;
        
        double x_230970 = defunc_2_reduce_res_230935 *
               defunc_2_reduce_res_230937;
        double y_230971 = defunc_2_reduce_res_230936 *
               defunc_2_reduce_res_230936;
        double y_230972 = x_230970 - y_230971;
        double det1_230973 = 1.0 / y_230972;
        double a11_230974 = defunc_2_reduce_res_230937 * det1_230973;
        double x_230975 = 0.0 - defunc_2_reduce_res_230936;
        double b11_230976 = det1_230973 * x_230975;
        double c11_230977 = defunc_2_reduce_res_230935 * det1_230973;
        double defunc_2_reduce_res_230978;
        double defunc_2_reduce_res_230979;
        double redout_231034;
        double redout_231035;
        
        redout_231034 = 0.0;
        redout_231035 = 0.0;
        for (int64_t i_231033 = 0; i_231033 < q_l_203495; i_231033++) {
            double x_231036;
            
            x_231036 = ((double *) mem_230933)[i_231033];
            
            double x_231037;
            
            x_231037 = ((double *) mem_230931)[i_231033];
            
            bool cond_231038 = sle64(n_203490, i_231033);
            double defunc_0_f_res_231039;
            
            if (cond_231038) {
                defunc_0_f_res_231039 = 0.0;
            } else {
                int64_t i_231040 = add64(x_230926, i_231033);
                double defunc_0_add_arg_231041;
                
                defunc_0_add_arg_231041 =
                    ((double *) mem_219293.mem)[gtid_213150 * n_203490 +
                                                i_231040];
                defunc_0_f_res_231039 = defunc_0_add_arg_231041;
            }
            
            double x_231042 = a11_230974 * x_231036;
            double y_231043 = b11_230976 * x_231037;
            double x_231044 = x_231042 + y_231043;
            double defunc_9_fit_fun_res_231045 = defunc_0_f_res_231039 *
                   x_231044;
            double x_231046 = b11_230976 * x_231036;
            double y_231047 = c11_230977 * x_231037;
            double x_231048 = x_231046 + y_231047;
            double defunc_9_slope_fun_res_231049 = defunc_0_f_res_231039 *
                   x_231048;
            double defunc_1_op_res_231050 = defunc_9_fit_fun_res_231045 +
                   redout_231034;
            double defunc_1_op_res_231051 = defunc_9_slope_fun_res_231049 +
                   redout_231035;
            double redout_tmp_231059 = defunc_1_op_res_231050;
            double redout_tmp_231060 = defunc_1_op_res_231051;
            
            redout_231034 = redout_tmp_231059;
            redout_231035 = redout_tmp_231060;
        }
        defunc_2_reduce_res_230978 = redout_231034;
        defunc_2_reduce_res_230979 = redout_231035;
        ((double *) mem_219509.mem)[gtid_230925] = defunc_2_reduce_res_230978;
        ((double *) mem_219512.mem)[gtid_230925] = defunc_2_reduce_res_230979;
    }
    
  cleanup:
    { }
    free(mem_230931);
    free(mem_230933);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236185_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236185_end -
                 futhark_mc_segmap_parloop_236185_start;
        
        ctx->futhark_mc_segmap_parloop_236185_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236185_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236185_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236183(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230924 = tid;
    int num_tasks_231001 = info.nsubtasks;
    struct futhark_mc_task_236182 *futhark_mc_task_236182 =
                                  (struct futhark_mc_task_236182 *) args;
    struct futhark_context *ctx = futhark_mc_task_236182->ctx;
    uint64_t futhark_mc_segmap_task_236183_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236183_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236182->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236182->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236182->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236182->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236182->free_i_203670;
    int64_t gtid_213150 = futhark_mc_task_236182->free_gtid_213150;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236182->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236182->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236182->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236182->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236182->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236182->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236182->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 = futhark_mc_task_236182->free_bytes_219472;
    struct memblock mem_219509 = {.desc ="mem_219509", .mem =
                                  futhark_mc_task_236182->free_mem_219509,
                                  .size =0, .references =NULL};
    struct memblock mem_219512 = {.desc ="mem_219512", .mem =
                                  futhark_mc_task_236182->free_mem_219512,
                                  .size =0, .references =NULL};
    int64_t iter_231002;
    struct futhark_mc_segmap_parloop_struct_236184
    futhark_mc_segmap_parloop_struct_236184;
    
    futhark_mc_segmap_parloop_struct_236184.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236184.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236184.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236184.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236184.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236184.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236184.free_gtid_213150 = gtid_213150;
    futhark_mc_segmap_parloop_struct_236184.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236184.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236184.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236184.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236184.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236184.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236184.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236184.free_bytes_219472 = bytes_219472;
    futhark_mc_segmap_parloop_struct_236184.free_mem_219509 = mem_219509.mem;
    futhark_mc_segmap_parloop_struct_236184.free_mem_219512 = mem_219512.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236185_task;
    
    futhark_mc_segmap_parloop_236185_task.name =
        "futhark_mc_segmap_parloop_236185";
    futhark_mc_segmap_parloop_236185_task.fn = futhark_mc_segmap_parloop_236185;
    futhark_mc_segmap_parloop_236185_task.args =
        &futhark_mc_segmap_parloop_struct_236184;
    futhark_mc_segmap_parloop_236185_task.iterations = iterations;
    futhark_mc_segmap_parloop_236185_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236185_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236185_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236185_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236185_task);
    
    if (futhark_mc_segmap_parloop_236185_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236185_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236185_total_end -
                 futhark_mc_segmap_parloop_236185_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236185_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236185_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236185_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236183_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236183_end -
                 futhark_mc_segmap_task_236183_start;
        
        ctx->futhark_mc_segmap_task_236183_runs[tid]++;
        ctx->futhark_mc_segmap_task_236183_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236183_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236189 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_213150;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219472;
    unsigned char *free_mem_219509;
    unsigned char *free_mem_219512;
};
struct futhark_mc_task_236193 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213150;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_230850;
    double free_x_230851;
    int64_t free_defunc_0_g_res_230854;
    double *retval_defunc_2_reduce_res_230857;
    double *retval_defunc_2_reduce_res_230858;
    double *retval_defunc_2_reduce_res_230859;
    unsigned char *retval_mem_230855;
    unsigned char *retval_mem_230856;
};
struct futhark_mc_segred_stage_1_parloop_struct_236198 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213150;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_230850;
    double free_x_230851;
    int64_t free_defunc_0_g_res_230854;
    unsigned char *free_mem_230855;
    unsigned char *free_mem_230856;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231117;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231119;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231121;
};
static int futhark_mc_segred_stage_1_parloop_236199(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231062,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236198
    *futhark_mc_segred_stage_1_parloop_struct_236198 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236198 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236198->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236199_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236199_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236198->free_n_203490;
    int64_t gtid_213150 =
            futhark_mc_segred_stage_1_parloop_struct_236198->free_gtid_213150;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segred_stage_1_parloop_struct_236198->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segred_stage_1_parloop_struct_236198->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segred_stage_1_parloop_struct_236198->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236198->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_230850 =
            futhark_mc_segred_stage_1_parloop_struct_236198->free_x_230850;
    double x_230851 =
           futhark_mc_segred_stage_1_parloop_struct_236198->free_x_230851;
    int64_t defunc_0_g_res_230854 =
            futhark_mc_segred_stage_1_parloop_struct_236198->free_defunc_0_g_res_230854;
    struct memblock mem_230855 = {.desc ="mem_230855", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236198->free_mem_230855,
                                  .size =0, .references =NULL};
    struct memblock mem_230856 = {.desc ="mem_230856", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236198->free_mem_230856,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231117 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231117",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236198->free_reduce_stage_1_tid_res_arr_mem_231117,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231119 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231119",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236198->free_reduce_stage_1_tid_res_arr_mem_231119,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231121 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231121",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236198->free_reduce_stage_1_tid_res_arr_mem_231121,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231123 = start;
    double x_231064;
    double x_231065;
    double x_231067;
    double x_231068;
    double x_231070;
    double x_231071;
    double local_acc_231124 = 0.0;
    double local_acc_231125 = 0.0;
    double local_acc_231126 = 0.0;
    
    for (; iter_231123 < end; iter_231123++) {
        int64_t gtid_231063 = iter_231123;
        bool cond_231073 = sle64(n_203490, gtid_231063);
        int64_t defunc_0_f_res_231074;
        
        if (cond_231073) {
            defunc_0_f_res_231074 = (int64_t) 0;
        } else {
            int64_t i_231075 = add64(x_230850, gtid_231063);
            int64_t defunc_1_add_res_231076 = add64((int64_t) 1, i_231075);
            
            defunc_0_f_res_231074 = defunc_1_add_res_231076;
        }
        
        double defunc_0_f_res_231077;
        
        if (cond_231073) {
            defunc_0_f_res_231077 = 0.0;
        } else {
            int64_t i_231078 = add64(x_230850, gtid_231063);
            double defunc_0_add_arg_231079;
            
            defunc_0_add_arg_231079 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_213150 *
                                                   ctx_param_ext_217867 +
                                                   i_231078 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_231077 = defunc_0_add_arg_231079;
        }
        
        int64_t binop_p_231080 = sub64(defunc_0_f_res_231074,
                                       defunc_0_g_res_230854);
        double defunc_0_f_res_231081 = sitofp_i64_f64(binop_p_231080);
        double abs_res_231082 = fabs(defunc_0_f_res_231081);
        double tmp1_231083 = abs_res_231082 / x_230851;
        double x_231084 = tmp1_231083 * tmp1_231083;
        double y_231085 = tmp1_231083 * x_231084;
        double tmp2_231086 = 1.0 - y_231085;
        double x_231087 = tmp2_231086 * tmp2_231086;
        double tmp3_231088 = tmp2_231086 * x_231087;
        double tmp4_231089 = defunc_0_f_res_231077 * tmp3_231088;
        double defunc_1_f_res_231090 = defunc_0_f_res_231081 * tmp4_231089;
        double defunc_1_f_res_231091 = defunc_0_f_res_231081 *
               defunc_1_f_res_231090;
        
        // save map-out results
        {
            ((double *) mem_230855.mem)[gtid_231063] = defunc_1_f_res_231090;
            ((double *) mem_230856.mem)[gtid_231063] = tmp4_231089;
        }
        // Load accum params
        {
            x_231064 = local_acc_231124;
        }
        // Load next params
        {
            x_231065 = tmp4_231089;
        }
        // Red body
        {
            double defunc_1_op_res_231066 = x_231064 + x_231065;
            
            local_acc_231124 = defunc_1_op_res_231066;
        }
        // Load accum params
        {
            x_231067 = local_acc_231125;
        }
        // Load next params
        {
            x_231068 = defunc_1_f_res_231090;
        }
        // Red body
        {
            double defunc_1_op_res_231069 = x_231067 + x_231068;
            
            local_acc_231125 = defunc_1_op_res_231069;
        }
        // Load accum params
        {
            x_231070 = local_acc_231126;
        }
        // Load next params
        {
            x_231071 = defunc_1_f_res_231091;
        }
        // Red body
        {
            double defunc_1_op_res_231072 = x_231070 + x_231071;
            
            local_acc_231126 = defunc_1_op_res_231072;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231117.mem)[flat_tid_231062] =
        local_acc_231124;
    ((double *) reduce_stage_1_tid_res_arr_mem_231119.mem)[flat_tid_231062] =
        local_acc_231125;
    ((double *) reduce_stage_1_tid_res_arr_mem_231121.mem)[flat_tid_231062] =
        local_acc_231126;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236199_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236199_end -
                 futhark_mc_segred_stage_1_parloop_236199_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236199_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236199_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236199_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236194(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231062 = tid;
    int num_tasks_231116 = info.nsubtasks;
    struct futhark_mc_task_236193 *futhark_mc_task_236193 =
                                  (struct futhark_mc_task_236193 *) args;
    struct futhark_context *ctx = futhark_mc_task_236193->ctx;
    uint64_t futhark_mc_segred_task_236194_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236194_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236193->free_n_203490;
    int64_t gtid_213150 = futhark_mc_task_236193->free_gtid_213150;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236193->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236193->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236193->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236193->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_230850 = futhark_mc_task_236193->free_x_230850;
    double x_230851 = futhark_mc_task_236193->free_x_230851;
    int64_t defunc_0_g_res_230854 =
            futhark_mc_task_236193->free_defunc_0_g_res_230854;
    double defunc_2_reduce_res_230857 =
           *futhark_mc_task_236193->retval_defunc_2_reduce_res_230857;
    double defunc_2_reduce_res_230858 =
           *futhark_mc_task_236193->retval_defunc_2_reduce_res_230858;
    double defunc_2_reduce_res_230859 =
           *futhark_mc_task_236193->retval_defunc_2_reduce_res_230859;
    struct memblock mem_230855 = {.desc ="mem_230855", .mem =
                                  futhark_mc_task_236193->retval_mem_230855,
                                  .size =0, .references =NULL};
    struct memblock mem_230856 = {.desc ="mem_230856", .mem =
                                  futhark_mc_task_236193->retval_mem_230856,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_231117_cached_sizze_236195 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231117 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231119_cached_sizze_236196 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231119 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231121_cached_sizze_236197 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231121 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231117_cached_sizze_236195 <
        (size_t) ((int64_t) 8 * num_tasks_231116)) {
        reduce_stage_1_tid_res_arr_mem_231117 =
            realloc(reduce_stage_1_tid_res_arr_mem_231117, (int64_t) 8 *
                    num_tasks_231116);
        reduce_stage_1_tid_res_arr_mem_231117_cached_sizze_236195 =
            (int64_t) 8 * num_tasks_231116;
    }
    if (reduce_stage_1_tid_res_arr_mem_231119_cached_sizze_236196 <
        (size_t) ((int64_t) 8 * num_tasks_231116)) {
        reduce_stage_1_tid_res_arr_mem_231119 =
            realloc(reduce_stage_1_tid_res_arr_mem_231119, (int64_t) 8 *
                    num_tasks_231116);
        reduce_stage_1_tid_res_arr_mem_231119_cached_sizze_236196 =
            (int64_t) 8 * num_tasks_231116;
    }
    if (reduce_stage_1_tid_res_arr_mem_231121_cached_sizze_236197 <
        (size_t) ((int64_t) 8 * num_tasks_231116)) {
        reduce_stage_1_tid_res_arr_mem_231121 =
            realloc(reduce_stage_1_tid_res_arr_mem_231121, (int64_t) 8 *
                    num_tasks_231116);
        reduce_stage_1_tid_res_arr_mem_231121_cached_sizze_236197 =
            (int64_t) 8 * num_tasks_231116;
    }
    
    int64_t iter_231123;
    struct futhark_mc_segred_stage_1_parloop_struct_236198
    futhark_mc_segred_stage_1_parloop_struct_236198;
    
    futhark_mc_segred_stage_1_parloop_struct_236198.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_gtid_213150 =
        gtid_213150;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_x_230850 = x_230850;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_x_230851 = x_230851;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_defunc_0_g_res_230854 =
        defunc_0_g_res_230854;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_mem_230855 =
        mem_230855.mem;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_mem_230856 =
        mem_230856.mem;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_reduce_stage_1_tid_res_arr_mem_231117 =
        reduce_stage_1_tid_res_arr_mem_231117;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_reduce_stage_1_tid_res_arr_mem_231119 =
        reduce_stage_1_tid_res_arr_mem_231119;
    futhark_mc_segred_stage_1_parloop_struct_236198.free_reduce_stage_1_tid_res_arr_mem_231121 =
        reduce_stage_1_tid_res_arr_mem_231121;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236199_task;
    
    futhark_mc_segred_stage_1_parloop_236199_task.name =
        "futhark_mc_segred_stage_1_parloop_236199";
    futhark_mc_segred_stage_1_parloop_236199_task.fn =
        futhark_mc_segred_stage_1_parloop_236199;
    futhark_mc_segred_stage_1_parloop_236199_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236198;
    futhark_mc_segred_stage_1_parloop_236199_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236199_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236199_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236199_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236199_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236199_task);
    
    if (futhark_mc_segred_stage_1_parloop_236199_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236199_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236199_total_end -
                 futhark_mc_segred_stage_1_parloop_236199_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236199_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236199_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236199_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230857 = 0.0;
        defunc_2_reduce_res_230858 = 0.0;
        defunc_2_reduce_res_230859 = 0.0;
    }
    
    double x_231127;
    double x_231128;
    double x_231130;
    double x_231131;
    double x_231133;
    double x_231134;
    
    for (int32_t i_231136 = 0; i_231136 < num_tasks_231116; i_231136++) {
        flat_tid_231062 = i_231136;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231127 = defunc_2_reduce_res_230857;
            }
            // load next params
            {
                x_231128 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231117)[flat_tid_231062];
            }
            // red body
            {
                double defunc_1_op_res_231129 = x_231127 + x_231128;
                
                defunc_2_reduce_res_230857 = defunc_1_op_res_231129;
            }
            // load acc params
            {
                x_231130 = defunc_2_reduce_res_230858;
            }
            // load next params
            {
                x_231131 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231119)[flat_tid_231062];
            }
            // red body
            {
                double defunc_1_op_res_231132 = x_231130 + x_231131;
                
                defunc_2_reduce_res_230858 = defunc_1_op_res_231132;
            }
            // load acc params
            {
                x_231133 = defunc_2_reduce_res_230859;
            }
            // load next params
            {
                x_231134 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231121)[flat_tid_231062];
            }
            // red body
            {
                double defunc_1_op_res_231135 = x_231133 + x_231134;
                
                defunc_2_reduce_res_230859 = defunc_1_op_res_231135;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231117);
        free(reduce_stage_1_tid_res_arr_mem_231119);
        free(reduce_stage_1_tid_res_arr_mem_231121);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236194_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236194_end -
                 futhark_mc_segred_task_236194_start;
        
        ctx->futhark_mc_segred_task_236194_runs[tid]++;
        ctx->futhark_mc_segred_task_236194_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236194_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236193->retval_defunc_2_reduce_res_230857 =
            defunc_2_reduce_res_230857;
        *futhark_mc_task_236193->retval_defunc_2_reduce_res_230858 =
            defunc_2_reduce_res_230858;
        *futhark_mc_task_236193->retval_defunc_2_reduce_res_230859 =
            defunc_2_reduce_res_230859;
        futhark_mc_task_236193->retval_mem_230855 = mem_230855.mem;
        futhark_mc_task_236193->retval_mem_230856 = mem_230856.mem;
    }
    return err;
}
struct futhark_mc_task_236200 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213150;
    unsigned char *free_mem_219293;
    int64_t free_x_230850;
    unsigned char *free_mem_230855;
    unsigned char *free_mem_230856;
    double free_a11_230896;
    double free_b11_230898;
    double free_c11_230899;
    double *retval_defunc_2_reduce_res_230900;
    double *retval_defunc_2_reduce_res_230901;
};
struct futhark_mc_segred_stage_1_parloop_struct_236204 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213150;
    unsigned char *free_mem_219293;
    int64_t free_x_230850;
    unsigned char *free_mem_230855;
    unsigned char *free_mem_230856;
    double free_a11_230896;
    double free_b11_230898;
    double free_c11_230899;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231138;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231140;
};
static int futhark_mc_segred_stage_1_parloop_236205(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231092,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236204
    *futhark_mc_segred_stage_1_parloop_struct_236204 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236204 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236204->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236205_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236205_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236204->free_n_203490;
    int64_t gtid_213150 =
            futhark_mc_segred_stage_1_parloop_struct_236204->free_gtid_213150;
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236204->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_230850 =
            futhark_mc_segred_stage_1_parloop_struct_236204->free_x_230850;
    struct memblock mem_230855 = {.desc ="mem_230855", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236204->free_mem_230855,
                                  .size =0, .references =NULL};
    struct memblock mem_230856 = {.desc ="mem_230856", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236204->free_mem_230856,
                                  .size =0, .references =NULL};
    double a11_230896 =
           futhark_mc_segred_stage_1_parloop_struct_236204->free_a11_230896;
    double b11_230898 =
           futhark_mc_segred_stage_1_parloop_struct_236204->free_b11_230898;
    double c11_230899 =
           futhark_mc_segred_stage_1_parloop_struct_236204->free_c11_230899;
    struct memblock reduce_stage_1_tid_res_arr_mem_231138 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231138",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236204->free_reduce_stage_1_tid_res_arr_mem_231138,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231140 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231140",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236204->free_reduce_stage_1_tid_res_arr_mem_231140,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231142 = start;
    double x_231094;
    double x_231095;
    double x_231097;
    double x_231098;
    double local_acc_231143 = 0.0;
    double local_acc_231144 = 0.0;
    
    for (; iter_231142 < end; iter_231142++) {
        int64_t gtid_231093 = iter_231142;
        double x_231100;
        
        x_231100 = ((double *) mem_230856.mem)[gtid_231093];
        
        double x_231101;
        
        x_231101 = ((double *) mem_230855.mem)[gtid_231093];
        
        bool cond_231102 = sle64(n_203490, gtid_231093);
        double defunc_0_f_res_231103;
        
        if (cond_231102) {
            defunc_0_f_res_231103 = 0.0;
        } else {
            int64_t i_231104 = add64(x_230850, gtid_231093);
            double defunc_0_add_arg_231105;
            
            defunc_0_add_arg_231105 = ((double *) mem_219293.mem)[gtid_213150 *
                                                                  n_203490 +
                                                                  i_231104];
            defunc_0_f_res_231103 = defunc_0_add_arg_231105;
        }
        
        double x_231106 = a11_230896 * x_231100;
        double y_231107 = b11_230898 * x_231101;
        double x_231108 = x_231106 + y_231107;
        double defunc_9_fit_fun_res_231109 = defunc_0_f_res_231103 * x_231108;
        double x_231110 = b11_230898 * x_231100;
        double y_231111 = c11_230899 * x_231101;
        double x_231112 = x_231110 + y_231111;
        double defunc_9_slope_fun_res_231113 = defunc_0_f_res_231103 * x_231112;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_231094 = local_acc_231143;
        }
        // Load next params
        {
            x_231095 = defunc_9_fit_fun_res_231109;
        }
        // Red body
        {
            double defunc_1_op_res_231096 = x_231094 + x_231095;
            
            local_acc_231143 = defunc_1_op_res_231096;
        }
        // Load accum params
        {
            x_231097 = local_acc_231144;
        }
        // Load next params
        {
            x_231098 = defunc_9_slope_fun_res_231113;
        }
        // Red body
        {
            double defunc_1_op_res_231099 = x_231097 + x_231098;
            
            local_acc_231144 = defunc_1_op_res_231099;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231138.mem)[flat_tid_231092] =
        local_acc_231143;
    ((double *) reduce_stage_1_tid_res_arr_mem_231140.mem)[flat_tid_231092] =
        local_acc_231144;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236205_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236205_end -
                 futhark_mc_segred_stage_1_parloop_236205_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236205_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236205_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236205_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236201(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231092 = tid;
    int num_tasks_231137 = info.nsubtasks;
    struct futhark_mc_task_236200 *futhark_mc_task_236200 =
                                  (struct futhark_mc_task_236200 *) args;
    struct futhark_context *ctx = futhark_mc_task_236200->ctx;
    uint64_t futhark_mc_segred_task_236201_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236201_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236200->free_n_203490;
    int64_t gtid_213150 = futhark_mc_task_236200->free_gtid_213150;
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236200->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_230850 = futhark_mc_task_236200->free_x_230850;
    struct memblock mem_230855 = {.desc ="mem_230855", .mem =
                                  futhark_mc_task_236200->free_mem_230855,
                                  .size =0, .references =NULL};
    struct memblock mem_230856 = {.desc ="mem_230856", .mem =
                                  futhark_mc_task_236200->free_mem_230856,
                                  .size =0, .references =NULL};
    double a11_230896 = futhark_mc_task_236200->free_a11_230896;
    double b11_230898 = futhark_mc_task_236200->free_b11_230898;
    double c11_230899 = futhark_mc_task_236200->free_c11_230899;
    double defunc_2_reduce_res_230900 =
           *futhark_mc_task_236200->retval_defunc_2_reduce_res_230900;
    double defunc_2_reduce_res_230901 =
           *futhark_mc_task_236200->retval_defunc_2_reduce_res_230901;
    size_t reduce_stage_1_tid_res_arr_mem_231138_cached_sizze_236202 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231138 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231140_cached_sizze_236203 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231140 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231138_cached_sizze_236202 <
        (size_t) ((int64_t) 8 * num_tasks_231137)) {
        reduce_stage_1_tid_res_arr_mem_231138 =
            realloc(reduce_stage_1_tid_res_arr_mem_231138, (int64_t) 8 *
                    num_tasks_231137);
        reduce_stage_1_tid_res_arr_mem_231138_cached_sizze_236202 =
            (int64_t) 8 * num_tasks_231137;
    }
    if (reduce_stage_1_tid_res_arr_mem_231140_cached_sizze_236203 <
        (size_t) ((int64_t) 8 * num_tasks_231137)) {
        reduce_stage_1_tid_res_arr_mem_231140 =
            realloc(reduce_stage_1_tid_res_arr_mem_231140, (int64_t) 8 *
                    num_tasks_231137);
        reduce_stage_1_tid_res_arr_mem_231140_cached_sizze_236203 =
            (int64_t) 8 * num_tasks_231137;
    }
    
    int64_t iter_231142;
    struct futhark_mc_segred_stage_1_parloop_struct_236204
    futhark_mc_segred_stage_1_parloop_struct_236204;
    
    futhark_mc_segred_stage_1_parloop_struct_236204.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_gtid_213150 =
        gtid_213150;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_mem_219293 =
        mem_219293.mem;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_x_230850 = x_230850;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_mem_230855 =
        mem_230855.mem;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_mem_230856 =
        mem_230856.mem;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_a11_230896 =
        a11_230896;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_b11_230898 =
        b11_230898;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_c11_230899 =
        c11_230899;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_reduce_stage_1_tid_res_arr_mem_231138 =
        reduce_stage_1_tid_res_arr_mem_231138;
    futhark_mc_segred_stage_1_parloop_struct_236204.free_reduce_stage_1_tid_res_arr_mem_231140 =
        reduce_stage_1_tid_res_arr_mem_231140;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236205_task;
    
    futhark_mc_segred_stage_1_parloop_236205_task.name =
        "futhark_mc_segred_stage_1_parloop_236205";
    futhark_mc_segred_stage_1_parloop_236205_task.fn =
        futhark_mc_segred_stage_1_parloop_236205;
    futhark_mc_segred_stage_1_parloop_236205_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236204;
    futhark_mc_segred_stage_1_parloop_236205_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236205_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236205_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236205_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236205_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236205_task);
    
    if (futhark_mc_segred_stage_1_parloop_236205_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236205_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236205_total_end -
                 futhark_mc_segred_stage_1_parloop_236205_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236205_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236205_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236205_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230900 = 0.0;
        defunc_2_reduce_res_230901 = 0.0;
    }
    
    double x_231145;
    double x_231146;
    double x_231148;
    double x_231149;
    
    for (int32_t i_231151 = 0; i_231151 < num_tasks_231137; i_231151++) {
        flat_tid_231092 = i_231151;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231145 = defunc_2_reduce_res_230900;
            }
            // load next params
            {
                x_231146 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231138)[flat_tid_231092];
            }
            // red body
            {
                double defunc_1_op_res_231147 = x_231145 + x_231146;
                
                defunc_2_reduce_res_230900 = defunc_1_op_res_231147;
            }
            // load acc params
            {
                x_231148 = defunc_2_reduce_res_230901;
            }
            // load next params
            {
                x_231149 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231140)[flat_tid_231092];
            }
            // red body
            {
                double defunc_1_op_res_231150 = x_231148 + x_231149;
                
                defunc_2_reduce_res_230901 = defunc_1_op_res_231150;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231138);
        free(reduce_stage_1_tid_res_arr_mem_231140);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236201_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236201_end -
                 futhark_mc_segred_task_236201_start;
        
        ctx->futhark_mc_segred_task_236201_runs[tid]++;
        ctx->futhark_mc_segred_task_236201_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236201_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236200->retval_defunc_2_reduce_res_230900 =
            defunc_2_reduce_res_230900;
        *futhark_mc_task_236200->retval_defunc_2_reduce_res_230901 =
            defunc_2_reduce_res_230901;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236190(void *args, int64_t start,
                                            int64_t end, int flat_tid_230848,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236189
    *futhark_mc_segmap_parloop_struct_236189 =
    (struct futhark_mc_segmap_parloop_struct_236189 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236189->ctx;
    uint64_t futhark_mc_segmap_parloop_236190_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236190_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236189->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236189->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236189->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236189->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236189->free_i_203670;
    int64_t gtid_213150 =
            futhark_mc_segmap_parloop_struct_236189->free_gtid_213150;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236189->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236189->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236189->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236189->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 =
            futhark_mc_segmap_parloop_struct_236189->free_bytes_219472;
    struct memblock mem_219509 = {.desc ="mem_219509", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_219509,
                                  .size =0, .references =NULL};
    struct memblock mem_219512 = {.desc ="mem_219512", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_219512,
                                  .size =0, .references =NULL};
    size_t mem_230855_cached_sizze_236191 = 0;
    unsigned char *mem_230855 = NULL;
    size_t mem_230856_cached_sizze_236192 = 0;
    unsigned char *mem_230856 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231061 = start;
    
    if (mem_230855_cached_sizze_236191 < (size_t) bytes_219472) {
        mem_230855 = realloc(mem_230855, bytes_219472);
        mem_230855_cached_sizze_236191 = bytes_219472;
    }
    if (mem_230856_cached_sizze_236192 < (size_t) bytes_219472) {
        mem_230856 = realloc(mem_230856, bytes_219472);
        mem_230856_cached_sizze_236192 = bytes_219472;
    }
    for (; iter_231061 < end; iter_231061++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231114 = l_n_m_203643;
        int64_t gtid_230849 = iter_231061;
        int64_t remnant_231115 = iter_231061 - gtid_230849;
        int64_t x_230850;
        
        x_230850 = ((int64_t *) mem_217773.mem)[gtid_213150 * l_n_m_203643 +
                                                gtid_230849];
        
        double x_230851;
        
        x_230851 = ((double *) mem_217777.mem)[gtid_213150 * l_n_m_203643 +
                                               gtid_230849];
        
        int64_t min_arg_230852 = mul64(jump_t_203500, gtid_230849);
        int64_t min_res_230853 = smin64(i_203670, min_arg_230852);
        int64_t defunc_0_g_res_230854 = add64((int64_t) 1, min_res_230853);
        double defunc_2_reduce_res_230857;
        double defunc_2_reduce_res_230858;
        double defunc_2_reduce_res_230859;
        int64_t flat_tid_231062 = (int64_t) 0;
        int32_t num_tasks_231116;
        
        defunc_2_reduce_res_230857 = 0.0;
        defunc_2_reduce_res_230858 = 0.0;
        defunc_2_reduce_res_230859 = 0.0;
        
        struct futhark_mc_task_236193 futhark_mc_task_236193;
        
        futhark_mc_task_236193.ctx = ctx;
        futhark_mc_task_236193.free_n_203490 = n_203490;
        futhark_mc_task_236193.free_gtid_213150 = gtid_213150;
        futhark_mc_task_236193.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236193.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236193.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236193.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236193.free_x_230850 = x_230850;
        futhark_mc_task_236193.free_x_230851 = x_230851;
        futhark_mc_task_236193.free_defunc_0_g_res_230854 =
            defunc_0_g_res_230854;
        futhark_mc_task_236193.retval_defunc_2_reduce_res_230857 =
            &defunc_2_reduce_res_230857;
        futhark_mc_task_236193.retval_defunc_2_reduce_res_230858 =
            &defunc_2_reduce_res_230858;
        futhark_mc_task_236193.retval_defunc_2_reduce_res_230859 =
            &defunc_2_reduce_res_230859;
        futhark_mc_task_236193.retval_mem_230855 = mem_230855;
        futhark_mc_task_236193.retval_mem_230856 = mem_230856;
        
        struct scheduler_segop futhark_mc_task_236193_task;
        
        futhark_mc_task_236193_task.args = &futhark_mc_task_236193;
        futhark_mc_task_236193_task.top_level_fn =
            futhark_mc_segred_task_236194;
        futhark_mc_task_236193_task.name = "futhark_mc_segred_task_236194";
        futhark_mc_task_236193_task.iterations = q_l_203495;
        futhark_mc_task_236193_task.task_time =
            &ctx->futhark_mc_segred_task_236194_total_time;
        futhark_mc_task_236193_task.task_iter =
            &ctx->futhark_mc_segred_task_236194_total_iter;
        futhark_mc_task_236193_task.sched = STATIC;
        futhark_mc_task_236193_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236194_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236193_task);
        
        if (futhark_mc_segred_task_236194_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_230892 = defunc_2_reduce_res_230857 *
               defunc_2_reduce_res_230859;
        double y_230893 = defunc_2_reduce_res_230858 *
               defunc_2_reduce_res_230858;
        double y_230894 = x_230892 - y_230893;
        double det1_230895 = 1.0 / y_230894;
        double a11_230896 = defunc_2_reduce_res_230859 * det1_230895;
        double x_230897 = 0.0 - defunc_2_reduce_res_230858;
        double b11_230898 = det1_230895 * x_230897;
        double c11_230899 = defunc_2_reduce_res_230857 * det1_230895;
        double defunc_2_reduce_res_230900;
        double defunc_2_reduce_res_230901;
        int64_t flat_tid_231092 = (int64_t) 0;
        int32_t num_tasks_231137;
        
        defunc_2_reduce_res_230900 = 0.0;
        defunc_2_reduce_res_230901 = 0.0;
        
        struct futhark_mc_task_236200 futhark_mc_task_236200;
        
        futhark_mc_task_236200.ctx = ctx;
        futhark_mc_task_236200.free_n_203490 = n_203490;
        futhark_mc_task_236200.free_gtid_213150 = gtid_213150;
        futhark_mc_task_236200.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236200.free_x_230850 = x_230850;
        futhark_mc_task_236200.free_mem_230855 = mem_230855;
        futhark_mc_task_236200.free_mem_230856 = mem_230856;
        futhark_mc_task_236200.free_a11_230896 = a11_230896;
        futhark_mc_task_236200.free_b11_230898 = b11_230898;
        futhark_mc_task_236200.free_c11_230899 = c11_230899;
        futhark_mc_task_236200.retval_defunc_2_reduce_res_230900 =
            &defunc_2_reduce_res_230900;
        futhark_mc_task_236200.retval_defunc_2_reduce_res_230901 =
            &defunc_2_reduce_res_230901;
        
        struct scheduler_segop futhark_mc_task_236200_task;
        
        futhark_mc_task_236200_task.args = &futhark_mc_task_236200;
        futhark_mc_task_236200_task.top_level_fn =
            futhark_mc_segred_task_236201;
        futhark_mc_task_236200_task.name = "futhark_mc_segred_task_236201";
        futhark_mc_task_236200_task.iterations = q_l_203495;
        futhark_mc_task_236200_task.task_time =
            &ctx->futhark_mc_segred_task_236201_total_time;
        futhark_mc_task_236200_task.task_iter =
            &ctx->futhark_mc_segred_task_236201_total_iter;
        futhark_mc_task_236200_task.sched = STATIC;
        futhark_mc_task_236200_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236201_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236200_task);
        
        if (futhark_mc_segred_task_236201_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219509.mem)[gtid_230849] = defunc_2_reduce_res_230900;
        ((double *) mem_219512.mem)[gtid_230849] = defunc_2_reduce_res_230901;
    }
    
  cleanup:
    { }
    free(mem_230855);
    free(mem_230856);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236190_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236190_end -
                 futhark_mc_segmap_parloop_236190_start;
        
        ctx->futhark_mc_segmap_parloop_236190_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236190_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236190_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236188(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230848 = tid;
    int num_tasks_231001 = info.nsubtasks;
    struct futhark_mc_task_236182 *futhark_mc_task_236182 =
                                  (struct futhark_mc_task_236182 *) args;
    struct futhark_context *ctx = futhark_mc_task_236182->ctx;
    uint64_t futhark_mc_segmap_nested_task_236188_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236188_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236182->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236182->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236182->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236182->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236182->free_i_203670;
    int64_t gtid_213150 = futhark_mc_task_236182->free_gtid_213150;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236182->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236182->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236182->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236182->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236182->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236182->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236182->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 = futhark_mc_task_236182->free_bytes_219472;
    struct memblock mem_219509 = {.desc ="mem_219509", .mem =
                                  futhark_mc_task_236182->free_mem_219509,
                                  .size =0, .references =NULL};
    struct memblock mem_219512 = {.desc ="mem_219512", .mem =
                                  futhark_mc_task_236182->free_mem_219512,
                                  .size =0, .references =NULL};
    int64_t iter_231061;
    struct futhark_mc_segmap_parloop_struct_236189
    futhark_mc_segmap_parloop_struct_236189;
    
    futhark_mc_segmap_parloop_struct_236189.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236189.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236189.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236189.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236189.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236189.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236189.free_gtid_213150 = gtid_213150;
    futhark_mc_segmap_parloop_struct_236189.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236189.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236189.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236189.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236189.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236189.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236189.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236189.free_bytes_219472 = bytes_219472;
    futhark_mc_segmap_parloop_struct_236189.free_mem_219509 = mem_219509.mem;
    futhark_mc_segmap_parloop_struct_236189.free_mem_219512 = mem_219512.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236190_task;
    
    futhark_mc_segmap_parloop_236190_task.name =
        "futhark_mc_segmap_parloop_236190";
    futhark_mc_segmap_parloop_236190_task.fn = futhark_mc_segmap_parloop_236190;
    futhark_mc_segmap_parloop_236190_task.args =
        &futhark_mc_segmap_parloop_struct_236189;
    futhark_mc_segmap_parloop_236190_task.iterations = iterations;
    futhark_mc_segmap_parloop_236190_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236190_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236190_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236190_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236190_task);
    
    if (futhark_mc_segmap_parloop_236190_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236190_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236190_total_end -
                 futhark_mc_segmap_parloop_236190_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236190_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236190_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236190_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236188_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236188_end -
                 futhark_mc_segmap_nested_task_236188_start;
        
        ctx->futhark_mc_segmap_nested_task_236188_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236188_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236188_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236179(void *args, int64_t start,
                                            int64_t end, int flat_tid_213149,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236178
    *futhark_mc_segmap_parloop_struct_236178 =
    (struct futhark_mc_segmap_parloop_struct_236178 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236178->ctx;
    uint64_t futhark_mc_segmap_parloop_236179_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236179_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236178->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236178->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236178->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236178->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236178->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236178->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236178->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236178->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236178->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236178->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236178->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236178->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236178->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236178->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 =
            futhark_mc_segmap_parloop_struct_236178->free_bytes_219472;
    struct memblock mem_219576 = {.desc ="mem_219576", .mem =
                                  futhark_mc_segmap_parloop_struct_236178->free_mem_219576,
                                  .size =0, .references =NULL};
    struct memblock mem_219580 = {.desc ="mem_219580", .mem =
                                  futhark_mc_segmap_parloop_struct_236178->free_mem_219580,
                                  .size =0, .references =NULL};
    size_t mem_219509_cached_sizze_236180 = 0;
    unsigned char *mem_219509 = NULL;
    size_t mem_219512_cached_sizze_236181 = 0;
    unsigned char *mem_219512 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230847 = start;
    
    if (mem_219509_cached_sizze_236180 < (size_t) bytes_217720) {
        mem_219509 = realloc(mem_219509, bytes_217720);
        mem_219509_cached_sizze_236180 = bytes_217720;
    }
    if (mem_219512_cached_sizze_236181 < (size_t) bytes_217720) {
        mem_219512 = realloc(mem_219512, bytes_217720);
        mem_219512_cached_sizze_236181 = bytes_217720;
    }
    for (; iter_230847 < end; iter_230847++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230999 = partition_sizze_203577;
        int64_t gtid_213150 = iter_230847;
        int64_t remnant_231000 = iter_230847 - gtid_213150;
        int64_t flat_tid_230924 = (int64_t) 0;
        int32_t num_tasks_231001;
        int64_t flat_tid_230848 = (int64_t) 0;
        struct futhark_mc_task_236182 futhark_mc_task_236182;
        
        futhark_mc_task_236182.ctx = ctx;
        futhark_mc_task_236182.free_n_203490 = n_203490;
        futhark_mc_task_236182.free_q_l_203495 = q_l_203495;
        futhark_mc_task_236182.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236182.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_236182.free_i_203670 = i_203670;
        futhark_mc_task_236182.free_gtid_213150 = gtid_213150;
        futhark_mc_task_236182.free_mem_217773 = mem_217773.mem;
        futhark_mc_task_236182.free_mem_217777 = mem_217777.mem;
        futhark_mc_task_236182.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236182.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236182.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236182.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236182.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236182.free_bytes_219472 = bytes_219472;
        futhark_mc_task_236182.free_mem_219509 = mem_219509;
        futhark_mc_task_236182.free_mem_219512 = mem_219512;
        
        struct scheduler_segop futhark_mc_task_236182_task;
        
        futhark_mc_task_236182_task.args = &futhark_mc_task_236182;
        futhark_mc_task_236182_task.top_level_fn =
            futhark_mc_segmap_task_236183;
        futhark_mc_task_236182_task.name = "futhark_mc_segmap_task_236183";
        futhark_mc_task_236182_task.iterations = l_n_m_203643;
        futhark_mc_task_236182_task.task_time =
            &ctx->futhark_mc_segmap_task_236183_total_time;
        futhark_mc_task_236182_task.task_iter =
            &ctx->futhark_mc_segmap_task_236183_total_iter;
        futhark_mc_task_236182_task.sched = STATIC;
        futhark_mc_task_236182_task.nested_fn =
            futhark_mc_segmap_nested_task_236188;
        
        int futhark_mc_segmap_task_236183_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236182_task);
        
        if (futhark_mc_segmap_task_236183_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219576.mem + gtid_213150 * l_n_m_203643 * (int64_t) 8,
                    mem_219509 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219580.mem + gtid_213150 * l_n_m_203643 * (int64_t) 8,
                    mem_219512 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219509);
    free(mem_219512);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236179_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236179_end -
                 futhark_mc_segmap_parloop_236179_start;
        
        ctx->futhark_mc_segmap_parloop_236179_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236179_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236179_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236177(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213149 = tid;
    int num_tasks_230758 = info.nsubtasks;
    struct futhark_mc_task_236169 *futhark_mc_task_236169 =
                                  (struct futhark_mc_task_236169 *) args;
    struct futhark_context *ctx = futhark_mc_task_236169->ctx;
    uint64_t futhark_mc_segmap_nested_task_236177_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236177_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236169->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236169->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236169->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236169->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236169->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236169->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236169->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236169->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236169->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236169->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236169->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236169->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236169->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236169->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219472 = futhark_mc_task_236169->free_bytes_219472;
    struct memblock mem_219576 = {.desc ="mem_219576", .mem =
                                  futhark_mc_task_236169->free_mem_219576,
                                  .size =0, .references =NULL};
    struct memblock mem_219580 = {.desc ="mem_219580", .mem =
                                  futhark_mc_task_236169->free_mem_219580,
                                  .size =0, .references =NULL};
    int64_t iter_230847;
    struct futhark_mc_segmap_parloop_struct_236178
    futhark_mc_segmap_parloop_struct_236178;
    
    futhark_mc_segmap_parloop_struct_236178.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236178.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236178.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236178.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236178.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236178.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236178.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236178.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236178.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236178.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236178.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236178.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236178.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236178.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236178.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236178.free_bytes_219472 = bytes_219472;
    futhark_mc_segmap_parloop_struct_236178.free_mem_219576 = mem_219576.mem;
    futhark_mc_segmap_parloop_struct_236178.free_mem_219580 = mem_219580.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236179_task;
    
    futhark_mc_segmap_parloop_236179_task.name =
        "futhark_mc_segmap_parloop_236179";
    futhark_mc_segmap_parloop_236179_task.fn = futhark_mc_segmap_parloop_236179;
    futhark_mc_segmap_parloop_236179_task.args =
        &futhark_mc_segmap_parloop_struct_236178;
    futhark_mc_segmap_parloop_236179_task.iterations = iterations;
    futhark_mc_segmap_parloop_236179_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236179_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236179_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236179_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236179_task);
    
    if (futhark_mc_segmap_parloop_236179_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236179_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236179_total_end -
                 futhark_mc_segmap_parloop_236179_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236179_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236179_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236179_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236177_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236177_end -
                 futhark_mc_segmap_nested_task_236177_start;
        
        ctx->futhark_mc_segmap_nested_task_236177_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236177_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236177_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236206 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219582;
    unsigned char *free_mem_219752;
    unsigned char *free_mem_219756;
};
struct futhark_mc_segmap_parloop_struct_236208 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219582;
    unsigned char *free_mem_219752;
    unsigned char *free_mem_219756;
};
static int futhark_mc_segmap_parloop_236209(void *args, int64_t start,
                                            int64_t end, int flat_tid_213307,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236208
    *futhark_mc_segmap_parloop_struct_236208 =
    (struct futhark_mc_segmap_parloop_struct_236208 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236208->ctx;
    uint64_t futhark_mc_segmap_parloop_236209_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236209_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236208->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236208->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236208->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236208->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236208->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236208->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236208->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236208->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236208->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236208->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236208->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236208->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236208->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236208->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 =
            futhark_mc_segmap_parloop_struct_236208->free_bytes_219582;
    struct memblock mem_219752 = {.desc ="mem_219752", .mem =
                                  futhark_mc_segmap_parloop_struct_236208->free_mem_219752,
                                  .size =0, .references =NULL};
    struct memblock mem_219756 = {.desc ="mem_219756", .mem =
                                  futhark_mc_segmap_parloop_struct_236208->free_mem_219756,
                                  .size =0, .references =NULL};
    size_t mem_219661_cached_sizze_236210 = 0;
    unsigned char *mem_219661 = NULL;
    size_t mem_219664_cached_sizze_236211 = 0;
    unsigned char *mem_219664 = NULL;
    size_t mem_219681_cached_sizze_236212 = 0;
    unsigned char *mem_219681 = NULL;
    size_t mem_219684_cached_sizze_236213 = 0;
    unsigned char *mem_219684 = NULL;
    size_t mem_219711_cached_sizze_236214 = 0;
    unsigned char *mem_219711 = NULL;
    size_t mem_219714_cached_sizze_236215 = 0;
    unsigned char *mem_219714 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231153 = start;
    
    if (mem_219661_cached_sizze_236210 < (size_t) bytes_217720) {
        mem_219661 = realloc(mem_219661, bytes_217720);
        mem_219661_cached_sizze_236210 = bytes_217720;
    }
    if (mem_219664_cached_sizze_236211 < (size_t) bytes_217720) {
        mem_219664 = realloc(mem_219664, bytes_217720);
        mem_219664_cached_sizze_236211 = bytes_217720;
    }
    if (mem_219681_cached_sizze_236212 < (size_t) bytes_219582) {
        mem_219681 = realloc(mem_219681, bytes_219582);
        mem_219681_cached_sizze_236212 = bytes_219582;
    }
    if (mem_219684_cached_sizze_236213 < (size_t) bytes_219582) {
        mem_219684 = realloc(mem_219684, bytes_219582);
        mem_219684_cached_sizze_236213 = bytes_219582;
    }
    if (mem_219711_cached_sizze_236214 < (size_t) bytes_219582) {
        mem_219711 = realloc(mem_219711, bytes_219582);
        mem_219711_cached_sizze_236214 = bytes_219582;
    }
    if (mem_219714_cached_sizze_236215 < (size_t) bytes_219582) {
        mem_219714 = realloc(mem_219714, bytes_219582);
        mem_219714_cached_sizze_236215 = bytes_219582;
    }
    for (; iter_231153 < end; iter_231153++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231271 = partition_sizze_203577;
        int64_t gtid_213308 = iter_231153;
        int64_t remnant_231272 = iter_231153 - gtid_213308;
        
        for (int64_t i_231154 = 0; i_231154 < l_n_m_203643; i_231154++) {
            int64_t x_231157;
            
            x_231157 = ((int64_t *) mem_217773.mem)[gtid_213308 * l_n_m_203643 +
                                                    i_231154];
            
            double x_231158;
            
            x_231158 = ((double *) mem_217777.mem)[gtid_213308 * l_n_m_203643 +
                                                   i_231154];
            
            int64_t min_arg_231159 = mul64(jump_t_203500, i_231154);
            int64_t min_res_231160 = smin64(i_203670, min_arg_231159);
            int64_t defunc_0_g_res_231161 = add64((int64_t) 1, min_res_231160);
            
            for (int64_t i_231166 = 0; i_231166 < q_l_203495; i_231166++) {
                bool cond_231169 = sle64(n_203490, i_231166);
                int64_t defunc_0_f_res_231170;
                
                if (cond_231169) {
                    defunc_0_f_res_231170 = (int64_t) 0;
                } else {
                    int64_t i_231171 = add64(x_231157, i_231166);
                    int64_t defunc_1_add_res_231172 = add64((int64_t) 1,
                                                            i_231171);
                    
                    defunc_0_f_res_231170 = defunc_1_add_res_231172;
                }
                
                double defunc_0_f_res_231173;
                
                if (cond_231169) {
                    defunc_0_f_res_231173 = 0.0;
                } else {
                    int64_t i_231174 = add64(x_231157, i_231166);
                    double defunc_0_add_arg_231175;
                    
                    defunc_0_add_arg_231175 =
                        ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                          (gtid_213308 *
                                                           ctx_param_ext_217867 +
                                                           i_231174 *
                                                           ctx_param_ext_217869)];
                    defunc_0_f_res_231173 = defunc_0_add_arg_231175;
                }
                
                int64_t binop_p_231176 = sub64(defunc_0_f_res_231170,
                                               defunc_0_g_res_231161);
                double defunc_0_f_res_231177 = sitofp_i64_f64(binop_p_231176);
                double abs_res_231178 = fabs(defunc_0_f_res_231177);
                double tmp1_231179 = abs_res_231178 / x_231158;
                double x_231180 = tmp1_231179 * tmp1_231179;
                double y_231181 = tmp1_231179 * x_231180;
                double tmp2_231182 = 1.0 - y_231181;
                double x_231183 = tmp2_231182 * tmp2_231182;
                double tmp3_231184 = tmp2_231182 * x_231183;
                double tmp4_231185 = defunc_0_f_res_231173 * tmp3_231184;
                
                ((double *) mem_219681)[i_231166] = defunc_0_f_res_231177;
                ((double *) mem_219684)[i_231166] = tmp4_231185;
            }
            
            double defunc_2_reduce_res_231190;
            double defunc_2_reduce_res_231191;
            double defunc_2_reduce_res_231192;
            double defunc_2_reduce_res_231193;
            double defunc_2_reduce_res_231194;
            double redout_231198;
            double redout_231199;
            double redout_231200;
            double redout_231201;
            double redout_231202;
            
            redout_231198 = 0.0;
            redout_231199 = 0.0;
            redout_231200 = 0.0;
            redout_231201 = 0.0;
            redout_231202 = 0.0;
            for (int64_t i_231197 = 0; i_231197 < q_l_203495; i_231197++) {
                double x_231205;
                
                x_231205 = ((double *) mem_219681)[i_231197];
                
                double x_231206;
                
                x_231206 = ((double *) mem_219684)[i_231197];
                
                double defunc_1_f_res_231207 = x_231205 * x_231206;
                double defunc_1_f_res_231208 = x_231205 * defunc_1_f_res_231207;
                double defunc_1_f_res_231209 = x_231205 * defunc_1_f_res_231208;
                double defunc_1_f_res_231210 = x_231205 * defunc_1_f_res_231209;
                double defunc_1_op_res_231211 = x_231206 + redout_231198;
                double defunc_1_op_res_231212 = defunc_1_f_res_231207 +
                       redout_231199;
                double defunc_1_op_res_231213 = defunc_1_f_res_231208 +
                       redout_231200;
                double defunc_1_op_res_231214 = defunc_1_f_res_231209 +
                       redout_231201;
                double defunc_1_op_res_231215 = defunc_1_f_res_231210 +
                       redout_231202;
                
                ((double *) mem_219711)[i_231197] = defunc_1_f_res_231208;
                ((double *) mem_219714)[i_231197] = defunc_1_f_res_231207;
                
                double redout_tmp_231277 = defunc_1_op_res_231211;
                double redout_tmp_231278 = defunc_1_op_res_231212;
                double redout_tmp_231279 = defunc_1_op_res_231213;
                double redout_tmp_231280 = defunc_1_op_res_231214;
                double redout_tmp_231281 = defunc_1_op_res_231215;
                
                redout_231198 = redout_tmp_231277;
                redout_231199 = redout_tmp_231278;
                redout_231200 = redout_tmp_231279;
                redout_231201 = redout_tmp_231280;
                redout_231202 = redout_tmp_231281;
            }
            defunc_2_reduce_res_231190 = redout_231198;
            defunc_2_reduce_res_231191 = redout_231199;
            defunc_2_reduce_res_231192 = redout_231200;
            defunc_2_reduce_res_231193 = redout_231201;
            defunc_2_reduce_res_231194 = redout_231202;
            
            double x_231218 = defunc_2_reduce_res_231192 *
                   defunc_2_reduce_res_231194;
            double y_231219 = defunc_2_reduce_res_231193 *
                   defunc_2_reduce_res_231193;
            double a12_231220 = x_231218 - y_231219;
            double x_231221 = defunc_2_reduce_res_231192 *
                   defunc_2_reduce_res_231193;
            double y_231222 = defunc_2_reduce_res_231191 *
                   defunc_2_reduce_res_231194;
            double b12_231223 = x_231221 - y_231222;
            double x_231224 = defunc_2_reduce_res_231191 *
                   defunc_2_reduce_res_231193;
            double y_231225 = defunc_2_reduce_res_231192 *
                   defunc_2_reduce_res_231192;
            double c12_231226 = x_231224 - y_231225;
            double x_231227 = defunc_2_reduce_res_231190 *
                   defunc_2_reduce_res_231194;
            double b2_231228 = x_231227 - y_231225;
            double x_231229 = defunc_2_reduce_res_231191 *
                   defunc_2_reduce_res_231192;
            double y_231230 = defunc_2_reduce_res_231190 *
                   defunc_2_reduce_res_231193;
            double c2_231231 = x_231229 - y_231230;
            double x_231232 = defunc_2_reduce_res_231190 * a12_231220;
            double y_231233 = defunc_2_reduce_res_231191 * b12_231223;
            double x_231234 = x_231232 + y_231233;
            double y_231235 = defunc_2_reduce_res_231192 * c12_231226;
            double y_231236 = x_231234 + y_231235;
            double det_231237 = 1.0 / y_231236;
            double a12_231238 = a12_231220 * det_231237;
            double b12_231239 = b12_231223 * det_231237;
            double c12_231240 = c12_231226 * det_231237;
            double b2_231241 = b2_231228 * det_231237;
            double c2_231242 = c2_231231 * det_231237;
            double defunc_2_reduce_res_231243;
            double defunc_2_reduce_res_231244;
            double redout_231246;
            double redout_231247;
            
            redout_231246 = 0.0;
            redout_231247 = 0.0;
            for (int64_t i_231245 = 0; i_231245 < q_l_203495; i_231245++) {
                double x_231248;
                
                x_231248 = ((double *) mem_219684)[i_231245];
                
                double x_231249;
                
                x_231249 = ((double *) mem_219714)[i_231245];
                
                double x_231250;
                
                x_231250 = ((double *) mem_219711)[i_231245];
                
                bool cond_231251 = sle64(n_203490, i_231245);
                double defunc_0_f_res_231252;
                
                if (cond_231251) {
                    defunc_0_f_res_231252 = 0.0;
                } else {
                    int64_t i_231253 = add64(x_231157, i_231245);
                    double defunc_0_add_arg_231254;
                    
                    defunc_0_add_arg_231254 =
                        ((double *) mem_219293.mem)[gtid_213308 * n_203490 +
                                                    i_231253];
                    defunc_0_f_res_231252 = defunc_0_add_arg_231254;
                }
                
                double x_231255 = a12_231238 * x_231248;
                double y_231256 = b12_231239 * x_231249;
                double x_231257 = x_231255 + y_231256;
                double y_231258 = c12_231240 * x_231250;
                double x_231259 = x_231257 + y_231258;
                double defunc_9_fit_fun_res_231260 = defunc_0_f_res_231252 *
                       x_231259;
                double x_231261 = b12_231239 * x_231248;
                double y_231262 = b2_231241 * x_231249;
                double x_231263 = x_231261 + y_231262;
                double y_231264 = c2_231242 * x_231250;
                double x_231265 = x_231263 + y_231264;
                double defunc_9_slope_fun_res_231266 = defunc_0_f_res_231252 *
                       x_231265;
                double defunc_1_op_res_231267 = defunc_9_fit_fun_res_231260 +
                       redout_231246;
                double defunc_1_op_res_231268 = defunc_9_slope_fun_res_231266 +
                       redout_231247;
                double redout_tmp_231284 = defunc_1_op_res_231267;
                double redout_tmp_231285 = defunc_1_op_res_231268;
                
                redout_231246 = redout_tmp_231284;
                redout_231247 = redout_tmp_231285;
            }
            defunc_2_reduce_res_231243 = redout_231246;
            defunc_2_reduce_res_231244 = redout_231247;
            ((double *) mem_219661)[i_231154] = defunc_2_reduce_res_231243;
            ((double *) mem_219664)[i_231154] = defunc_2_reduce_res_231244;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219752.mem + gtid_213308 * l_n_m_203643 * (int64_t) 8,
                    mem_219661 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219756.mem + gtid_213308 * l_n_m_203643 * (int64_t) 8,
                    mem_219664 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219661);
    free(mem_219664);
    free(mem_219681);
    free(mem_219684);
    free(mem_219711);
    free(mem_219714);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236209_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236209_end -
                 futhark_mc_segmap_parloop_236209_start;
        
        ctx->futhark_mc_segmap_parloop_236209_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236209_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236209_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236207(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213307 = tid;
    int num_tasks_231152 = info.nsubtasks;
    struct futhark_mc_task_236206 *futhark_mc_task_236206 =
                                  (struct futhark_mc_task_236206 *) args;
    struct futhark_context *ctx = futhark_mc_task_236206->ctx;
    uint64_t futhark_mc_segmap_task_236207_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236207_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236206->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236206->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236206->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236206->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236206->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236206->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236206->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236206->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236206->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236206->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236206->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236206->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236206->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236206->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 = futhark_mc_task_236206->free_bytes_219582;
    struct memblock mem_219752 = {.desc ="mem_219752", .mem =
                                  futhark_mc_task_236206->free_mem_219752,
                                  .size =0, .references =NULL};
    struct memblock mem_219756 = {.desc ="mem_219756", .mem =
                                  futhark_mc_task_236206->free_mem_219756,
                                  .size =0, .references =NULL};
    int64_t iter_231153;
    struct futhark_mc_segmap_parloop_struct_236208
    futhark_mc_segmap_parloop_struct_236208;
    
    futhark_mc_segmap_parloop_struct_236208.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236208.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236208.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236208.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236208.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236208.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236208.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236208.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236208.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236208.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236208.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236208.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236208.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236208.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236208.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236208.free_bytes_219582 = bytes_219582;
    futhark_mc_segmap_parloop_struct_236208.free_mem_219752 = mem_219752.mem;
    futhark_mc_segmap_parloop_struct_236208.free_mem_219756 = mem_219756.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236209_task;
    
    futhark_mc_segmap_parloop_236209_task.name =
        "futhark_mc_segmap_parloop_236209";
    futhark_mc_segmap_parloop_236209_task.fn = futhark_mc_segmap_parloop_236209;
    futhark_mc_segmap_parloop_236209_task.args =
        &futhark_mc_segmap_parloop_struct_236208;
    futhark_mc_segmap_parloop_236209_task.iterations = iterations;
    futhark_mc_segmap_parloop_236209_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236209_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236209_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236209_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236209_task);
    
    if (futhark_mc_segmap_parloop_236209_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236209_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236209_total_end -
                 futhark_mc_segmap_parloop_236209_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236209_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236209_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236209_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236207_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236207_end -
                 futhark_mc_segmap_task_236207_start;
        
        ctx->futhark_mc_segmap_task_236207_runs[tid]++;
        ctx->futhark_mc_segmap_task_236207_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236207_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236217 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_bytes_217720;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219582;
    unsigned char *free_mem_219752;
    unsigned char *free_mem_219756;
};
struct futhark_mc_task_236221 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_213437;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219582;
    unsigned char *free_mem_219655;
    unsigned char *free_mem_219658;
};
struct futhark_mc_segmap_parloop_struct_236223 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_213437;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219582;
    unsigned char *free_mem_219655;
    unsigned char *free_mem_219658;
};
static int futhark_mc_segmap_parloop_236224(void *args, int64_t start,
                                            int64_t end, int flat_tid_231403,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236223
    *futhark_mc_segmap_parloop_struct_236223 =
    (struct futhark_mc_segmap_parloop_struct_236223 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236223->ctx;
    uint64_t futhark_mc_segmap_parloop_236224_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236224_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236223->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236223->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236223->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236223->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236223->free_i_203670;
    int64_t gtid_213437 =
            futhark_mc_segmap_parloop_struct_236223->free_gtid_213437;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236223->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236223->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236223->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236223->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236223->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236223->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236223->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 =
            futhark_mc_segmap_parloop_struct_236223->free_bytes_219582;
    struct memblock mem_219655 = {.desc ="mem_219655", .mem =
                                  futhark_mc_segmap_parloop_struct_236223->free_mem_219655,
                                  .size =0, .references =NULL};
    struct memblock mem_219658 = {.desc ="mem_219658", .mem =
                                  futhark_mc_segmap_parloop_struct_236223->free_mem_219658,
                                  .size =0, .references =NULL};
    size_t mem_231410_cached_sizze_236225 = 0;
    unsigned char *mem_231410 = NULL;
    size_t mem_231412_cached_sizze_236226 = 0;
    unsigned char *mem_231412 = NULL;
    size_t mem_231438_cached_sizze_236227 = 0;
    unsigned char *mem_231438 = NULL;
    size_t mem_231440_cached_sizze_236228 = 0;
    unsigned char *mem_231440 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231524 = start;
    
    if (mem_231410_cached_sizze_236225 < (size_t) bytes_219582) {
        mem_231410 = realloc(mem_231410, bytes_219582);
        mem_231410_cached_sizze_236225 = bytes_219582;
    }
    if (mem_231412_cached_sizze_236226 < (size_t) bytes_219582) {
        mem_231412 = realloc(mem_231412, bytes_219582);
        mem_231412_cached_sizze_236226 = bytes_219582;
    }
    if (mem_231438_cached_sizze_236227 < (size_t) bytes_219582) {
        mem_231438 = realloc(mem_231438, bytes_219582);
        mem_231438_cached_sizze_236227 = bytes_219582;
    }
    if (mem_231440_cached_sizze_236228 < (size_t) bytes_219582) {
        mem_231440 = realloc(mem_231440, bytes_219582);
        mem_231440_cached_sizze_236228 = bytes_219582;
    }
    for (; iter_231524 < end; iter_231524++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231592 = l_n_m_203643;
        int64_t gtid_231404 = iter_231524;
        int64_t remnant_231593 = iter_231524 - gtid_231404;
        int64_t x_231405;
        
        x_231405 = ((int64_t *) mem_217773.mem)[gtid_213437 * l_n_m_203643 +
                                                gtid_231404];
        
        double x_231406;
        
        x_231406 = ((double *) mem_217777.mem)[gtid_213437 * l_n_m_203643 +
                                               gtid_231404];
        
        int64_t min_arg_231407 = mul64(jump_t_203500, gtid_231404);
        int64_t min_res_231408 = smin64(i_203670, min_arg_231407);
        int64_t defunc_0_g_res_231409 = add64((int64_t) 1, min_res_231408);
        
        for (int64_t i_231525 = 0; i_231525 < q_l_203495; i_231525++) {
            bool cond_231528 = sle64(n_203490, i_231525);
            int64_t defunc_0_f_res_231529;
            
            if (cond_231528) {
                defunc_0_f_res_231529 = (int64_t) 0;
            } else {
                int64_t i_231530 = add64(x_231405, i_231525);
                int64_t defunc_1_add_res_231531 = add64((int64_t) 1, i_231530);
                
                defunc_0_f_res_231529 = defunc_1_add_res_231531;
            }
            
            double defunc_0_f_res_231532;
            
            if (cond_231528) {
                defunc_0_f_res_231532 = 0.0;
            } else {
                int64_t i_231533 = add64(x_231405, i_231525);
                double defunc_0_add_arg_231534;
                
                defunc_0_add_arg_231534 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_213437 *
                                                       ctx_param_ext_217867 +
                                                       i_231533 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_231532 = defunc_0_add_arg_231534;
            }
            
            int64_t binop_p_231535 = sub64(defunc_0_f_res_231529,
                                           defunc_0_g_res_231409);
            double defunc_0_f_res_231536 = sitofp_i64_f64(binop_p_231535);
            double abs_res_231537 = fabs(defunc_0_f_res_231536);
            double tmp1_231538 = abs_res_231537 / x_231406;
            double x_231539 = tmp1_231538 * tmp1_231538;
            double y_231540 = tmp1_231538 * x_231539;
            double tmp2_231541 = 1.0 - y_231540;
            double x_231542 = tmp2_231541 * tmp2_231541;
            double tmp3_231543 = tmp2_231541 * x_231542;
            double tmp4_231544 = defunc_0_f_res_231532 * tmp3_231543;
            
            ((double *) mem_231410)[i_231525] = defunc_0_f_res_231536;
            ((double *) mem_231412)[i_231525] = tmp4_231544;
        }
        
        double defunc_2_reduce_res_231442;
        double defunc_2_reduce_res_231443;
        double defunc_2_reduce_res_231444;
        double defunc_2_reduce_res_231445;
        double defunc_2_reduce_res_231446;
        double redout_231548;
        double redout_231549;
        double redout_231550;
        double redout_231551;
        double redout_231552;
        
        redout_231548 = 0.0;
        redout_231549 = 0.0;
        redout_231550 = 0.0;
        redout_231551 = 0.0;
        redout_231552 = 0.0;
        for (int64_t i_231547 = 0; i_231547 < q_l_203495; i_231547++) {
            double x_231555;
            
            x_231555 = ((double *) mem_231410)[i_231547];
            
            double x_231556;
            
            x_231556 = ((double *) mem_231412)[i_231547];
            
            double defunc_1_f_res_231557 = x_231555 * x_231556;
            double defunc_1_f_res_231558 = x_231555 * defunc_1_f_res_231557;
            double defunc_1_f_res_231559 = x_231555 * defunc_1_f_res_231558;
            double defunc_1_f_res_231560 = x_231555 * defunc_1_f_res_231559;
            double defunc_1_op_res_231561 = x_231556 + redout_231548;
            double defunc_1_op_res_231562 = defunc_1_f_res_231557 +
                   redout_231549;
            double defunc_1_op_res_231563 = defunc_1_f_res_231558 +
                   redout_231550;
            double defunc_1_op_res_231564 = defunc_1_f_res_231559 +
                   redout_231551;
            double defunc_1_op_res_231565 = defunc_1_f_res_231560 +
                   redout_231552;
            
            ((double *) mem_231438)[i_231547] = defunc_1_f_res_231558;
            ((double *) mem_231440)[i_231547] = defunc_1_f_res_231557;
            
            double redout_tmp_231596 = defunc_1_op_res_231561;
            double redout_tmp_231597 = defunc_1_op_res_231562;
            double redout_tmp_231598 = defunc_1_op_res_231563;
            double redout_tmp_231599 = defunc_1_op_res_231564;
            double redout_tmp_231600 = defunc_1_op_res_231565;
            
            redout_231548 = redout_tmp_231596;
            redout_231549 = redout_tmp_231597;
            redout_231550 = redout_tmp_231598;
            redout_231551 = redout_tmp_231599;
            redout_231552 = redout_tmp_231600;
        }
        defunc_2_reduce_res_231442 = redout_231548;
        defunc_2_reduce_res_231443 = redout_231549;
        defunc_2_reduce_res_231444 = redout_231550;
        defunc_2_reduce_res_231445 = redout_231551;
        defunc_2_reduce_res_231446 = redout_231552;
        
        double x_231470 = defunc_2_reduce_res_231444 *
               defunc_2_reduce_res_231446;
        double y_231471 = defunc_2_reduce_res_231445 *
               defunc_2_reduce_res_231445;
        double a12_231472 = x_231470 - y_231471;
        double x_231473 = defunc_2_reduce_res_231444 *
               defunc_2_reduce_res_231445;
        double y_231474 = defunc_2_reduce_res_231443 *
               defunc_2_reduce_res_231446;
        double b12_231475 = x_231473 - y_231474;
        double x_231476 = defunc_2_reduce_res_231443 *
               defunc_2_reduce_res_231445;
        double y_231477 = defunc_2_reduce_res_231444 *
               defunc_2_reduce_res_231444;
        double c12_231478 = x_231476 - y_231477;
        double x_231479 = defunc_2_reduce_res_231442 *
               defunc_2_reduce_res_231446;
        double b2_231480 = x_231479 - y_231477;
        double x_231481 = defunc_2_reduce_res_231443 *
               defunc_2_reduce_res_231444;
        double y_231482 = defunc_2_reduce_res_231442 *
               defunc_2_reduce_res_231445;
        double c2_231483 = x_231481 - y_231482;
        double x_231484 = defunc_2_reduce_res_231442 * a12_231472;
        double y_231485 = defunc_2_reduce_res_231443 * b12_231475;
        double x_231486 = x_231484 + y_231485;
        double y_231487 = defunc_2_reduce_res_231444 * c12_231478;
        double y_231488 = x_231486 + y_231487;
        double det_231489 = 1.0 / y_231488;
        double a12_231490 = a12_231472 * det_231489;
        double b12_231491 = b12_231475 * det_231489;
        double c12_231492 = c12_231478 * det_231489;
        double b2_231493 = b2_231480 * det_231489;
        double c2_231494 = c2_231483 * det_231489;
        double defunc_2_reduce_res_231495;
        double defunc_2_reduce_res_231496;
        double redout_231569;
        double redout_231570;
        
        redout_231569 = 0.0;
        redout_231570 = 0.0;
        for (int64_t i_231568 = 0; i_231568 < q_l_203495; i_231568++) {
            double x_231571;
            
            x_231571 = ((double *) mem_231412)[i_231568];
            
            double x_231572;
            
            x_231572 = ((double *) mem_231440)[i_231568];
            
            double x_231573;
            
            x_231573 = ((double *) mem_231438)[i_231568];
            
            bool cond_231574 = sle64(n_203490, i_231568);
            double defunc_0_f_res_231575;
            
            if (cond_231574) {
                defunc_0_f_res_231575 = 0.0;
            } else {
                int64_t i_231576 = add64(x_231405, i_231568);
                double defunc_0_add_arg_231577;
                
                defunc_0_add_arg_231577 =
                    ((double *) mem_219293.mem)[gtid_213437 * n_203490 +
                                                i_231576];
                defunc_0_f_res_231575 = defunc_0_add_arg_231577;
            }
            
            double x_231578 = a12_231490 * x_231571;
            double y_231579 = b12_231491 * x_231572;
            double x_231580 = x_231578 + y_231579;
            double y_231581 = c12_231492 * x_231573;
            double x_231582 = x_231580 + y_231581;
            double defunc_9_fit_fun_res_231583 = defunc_0_f_res_231575 *
                   x_231582;
            double x_231584 = b12_231491 * x_231571;
            double y_231585 = b2_231493 * x_231572;
            double x_231586 = x_231584 + y_231585;
            double y_231587 = c2_231494 * x_231573;
            double x_231588 = x_231586 + y_231587;
            double defunc_9_slope_fun_res_231589 = defunc_0_f_res_231575 *
                   x_231588;
            double defunc_1_op_res_231590 = defunc_9_fit_fun_res_231583 +
                   redout_231569;
            double defunc_1_op_res_231591 = defunc_9_slope_fun_res_231589 +
                   redout_231570;
            double redout_tmp_231603 = defunc_1_op_res_231590;
            double redout_tmp_231604 = defunc_1_op_res_231591;
            
            redout_231569 = redout_tmp_231603;
            redout_231570 = redout_tmp_231604;
        }
        defunc_2_reduce_res_231495 = redout_231569;
        defunc_2_reduce_res_231496 = redout_231570;
        ((double *) mem_219655.mem)[gtid_231404] = defunc_2_reduce_res_231495;
        ((double *) mem_219658.mem)[gtid_231404] = defunc_2_reduce_res_231496;
    }
    
  cleanup:
    { }
    free(mem_231410);
    free(mem_231412);
    free(mem_231438);
    free(mem_231440);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236224_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236224_end -
                 futhark_mc_segmap_parloop_236224_start;
        
        ctx->futhark_mc_segmap_parloop_236224_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236224_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236224_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236222(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231403 = tid;
    int num_tasks_231523 = info.nsubtasks;
    struct futhark_mc_task_236221 *futhark_mc_task_236221 =
                                  (struct futhark_mc_task_236221 *) args;
    struct futhark_context *ctx = futhark_mc_task_236221->ctx;
    uint64_t futhark_mc_segmap_task_236222_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236222_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236221->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236221->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236221->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236221->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236221->free_i_203670;
    int64_t gtid_213437 = futhark_mc_task_236221->free_gtid_213437;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236221->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236221->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236221->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236221->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236221->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236221->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236221->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 = futhark_mc_task_236221->free_bytes_219582;
    struct memblock mem_219655 = {.desc ="mem_219655", .mem =
                                  futhark_mc_task_236221->free_mem_219655,
                                  .size =0, .references =NULL};
    struct memblock mem_219658 = {.desc ="mem_219658", .mem =
                                  futhark_mc_task_236221->free_mem_219658,
                                  .size =0, .references =NULL};
    int64_t iter_231524;
    struct futhark_mc_segmap_parloop_struct_236223
    futhark_mc_segmap_parloop_struct_236223;
    
    futhark_mc_segmap_parloop_struct_236223.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236223.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236223.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236223.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236223.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236223.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236223.free_gtid_213437 = gtid_213437;
    futhark_mc_segmap_parloop_struct_236223.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236223.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236223.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236223.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236223.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236223.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236223.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236223.free_bytes_219582 = bytes_219582;
    futhark_mc_segmap_parloop_struct_236223.free_mem_219655 = mem_219655.mem;
    futhark_mc_segmap_parloop_struct_236223.free_mem_219658 = mem_219658.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236224_task;
    
    futhark_mc_segmap_parloop_236224_task.name =
        "futhark_mc_segmap_parloop_236224";
    futhark_mc_segmap_parloop_236224_task.fn = futhark_mc_segmap_parloop_236224;
    futhark_mc_segmap_parloop_236224_task.args =
        &futhark_mc_segmap_parloop_struct_236223;
    futhark_mc_segmap_parloop_236224_task.iterations = iterations;
    futhark_mc_segmap_parloop_236224_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236224_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236224_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236224_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236224_task);
    
    if (futhark_mc_segmap_parloop_236224_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236224_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236224_total_end -
                 futhark_mc_segmap_parloop_236224_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236224_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236224_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236224_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236222_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236222_end -
                 futhark_mc_segmap_task_236222_start;
        
        ctx->futhark_mc_segmap_task_236222_runs[tid]++;
        ctx->futhark_mc_segmap_task_236222_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236222_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236230 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_jump_t_203500;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_gtid_213437;
    unsigned char *free_mem_217773;
    unsigned char *free_mem_217777;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219293;
    int64_t free_bytes_219582;
    unsigned char *free_mem_219655;
    unsigned char *free_mem_219658;
};
struct futhark_mc_task_236236 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_gtid_213437;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_231289;
    double free_x_231290;
    int64_t free_defunc_0_g_res_231293;
    unsigned char *free_mem_231294;
    unsigned char *free_mem_231295;
};
struct futhark_mc_segmap_parloop_struct_236238 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_l_203495;
    int64_t free_gtid_213437;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    int64_t free_x_231289;
    double free_x_231290;
    int64_t free_defunc_0_g_res_231293;
    unsigned char *free_mem_231294;
    unsigned char *free_mem_231295;
};
static int futhark_mc_segmap_parloop_236239(void *args, int64_t start,
                                            int64_t end, int flat_tid_231606,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236238
    *futhark_mc_segmap_parloop_struct_236238 =
    (struct futhark_mc_segmap_parloop_struct_236238 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236238->ctx;
    uint64_t futhark_mc_segmap_parloop_236239_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236239_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236238->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236238->free_q_l_203495;
    int64_t gtid_213437 =
            futhark_mc_segmap_parloop_struct_236238->free_gtid_213437;
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236238->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236238->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236238->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236238->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_231289 = futhark_mc_segmap_parloop_struct_236238->free_x_231289;
    double x_231290 = futhark_mc_segmap_parloop_struct_236238->free_x_231290;
    int64_t defunc_0_g_res_231293 =
            futhark_mc_segmap_parloop_struct_236238->free_defunc_0_g_res_231293;
    struct memblock mem_231294 = {.desc ="mem_231294", .mem =
                                  futhark_mc_segmap_parloop_struct_236238->free_mem_231294,
                                  .size =0, .references =NULL};
    struct memblock mem_231295 = {.desc ="mem_231295", .mem =
                                  futhark_mc_segmap_parloop_struct_236238->free_mem_231295,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231678 = start;
    
    for (; iter_231678 < end; iter_231678++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231683 = q_l_203495;
        int64_t gtid_231607 = iter_231678;
        int64_t remnant_231684 = iter_231678 - gtid_231607;
        bool cond_231608 = sle64(n_203490, gtid_231607);
        int64_t defunc_0_f_res_231609;
        
        if (cond_231608) {
            defunc_0_f_res_231609 = (int64_t) 0;
        } else {
            int64_t i_231679 = add64(x_231289, gtid_231607);
            int64_t defunc_1_add_res_231680 = add64((int64_t) 1, i_231679);
            
            defunc_0_f_res_231609 = defunc_1_add_res_231680;
        }
        
        double defunc_0_f_res_231612;
        
        if (cond_231608) {
            defunc_0_f_res_231612 = 0.0;
        } else {
            int64_t i_231681 = add64(x_231289, gtid_231607);
            double defunc_0_add_arg_231682;
            
            defunc_0_add_arg_231682 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_213437 *
                                                   ctx_param_ext_217867 +
                                                   i_231681 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_231612 = defunc_0_add_arg_231682;
        }
        
        int64_t binop_p_231615 = sub64(defunc_0_f_res_231609,
                                       defunc_0_g_res_231293);
        double defunc_0_f_res_231616 = sitofp_i64_f64(binop_p_231615);
        double abs_res_231617 = fabs(defunc_0_f_res_231616);
        double tmp1_231618 = abs_res_231617 / x_231290;
        double x_231619 = tmp1_231618 * tmp1_231618;
        double y_231620 = tmp1_231618 * x_231619;
        double tmp2_231621 = 1.0 - y_231620;
        double x_231622 = tmp2_231621 * tmp2_231621;
        double tmp3_231623 = tmp2_231621 * x_231622;
        double tmp4_231624 = defunc_0_f_res_231612 * tmp3_231623;
        
        ((double *) mem_231294.mem)[gtid_231607] = defunc_0_f_res_231616;
        ((double *) mem_231295.mem)[gtid_231607] = tmp4_231624;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236239_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236239_end -
                 futhark_mc_segmap_parloop_236239_start;
        
        ctx->futhark_mc_segmap_parloop_236239_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236239_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236239_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236237(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231606 = tid;
    int num_tasks_231677 = info.nsubtasks;
    struct futhark_mc_task_236236 *futhark_mc_task_236236 =
                                  (struct futhark_mc_task_236236 *) args;
    struct futhark_context *ctx = futhark_mc_task_236236->ctx;
    uint64_t futhark_mc_segmap_task_236237_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236237_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236236->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236236->free_q_l_203495;
    int64_t gtid_213437 = futhark_mc_task_236236->free_gtid_213437;
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236236->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236236->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236236->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236236->free_mem_param_217871,
                                        .size =0, .references =NULL};
    int64_t x_231289 = futhark_mc_task_236236->free_x_231289;
    double x_231290 = futhark_mc_task_236236->free_x_231290;
    int64_t defunc_0_g_res_231293 =
            futhark_mc_task_236236->free_defunc_0_g_res_231293;
    struct memblock mem_231294 = {.desc ="mem_231294", .mem =
                                  futhark_mc_task_236236->free_mem_231294,
                                  .size =0, .references =NULL};
    struct memblock mem_231295 = {.desc ="mem_231295", .mem =
                                  futhark_mc_task_236236->free_mem_231295,
                                  .size =0, .references =NULL};
    int64_t iter_231678;
    struct futhark_mc_segmap_parloop_struct_236238
    futhark_mc_segmap_parloop_struct_236238;
    
    futhark_mc_segmap_parloop_struct_236238.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236238.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236238.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236238.free_gtid_213437 = gtid_213437;
    futhark_mc_segmap_parloop_struct_236238.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236238.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236238.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236238.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236238.free_x_231289 = x_231289;
    futhark_mc_segmap_parloop_struct_236238.free_x_231290 = x_231290;
    futhark_mc_segmap_parloop_struct_236238.free_defunc_0_g_res_231293 =
        defunc_0_g_res_231293;
    futhark_mc_segmap_parloop_struct_236238.free_mem_231294 = mem_231294.mem;
    futhark_mc_segmap_parloop_struct_236238.free_mem_231295 = mem_231295.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236239_task;
    
    futhark_mc_segmap_parloop_236239_task.name =
        "futhark_mc_segmap_parloop_236239";
    futhark_mc_segmap_parloop_236239_task.fn = futhark_mc_segmap_parloop_236239;
    futhark_mc_segmap_parloop_236239_task.args =
        &futhark_mc_segmap_parloop_struct_236238;
    futhark_mc_segmap_parloop_236239_task.iterations = iterations;
    futhark_mc_segmap_parloop_236239_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236239_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236239_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236239_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236239_task);
    
    if (futhark_mc_segmap_parloop_236239_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236239_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236239_total_end -
                 futhark_mc_segmap_parloop_236239_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236239_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236239_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236239_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236237_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236237_end -
                 futhark_mc_segmap_task_236237_start;
        
        ctx->futhark_mc_segmap_task_236237_runs[tid]++;
        ctx->futhark_mc_segmap_task_236237_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236237_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236240 {
    struct futhark_context *ctx;
    unsigned char *free_mem_231294;
    unsigned char *free_mem_231295;
    double *retval_defunc_2_reduce_res_231319;
    double *retval_defunc_2_reduce_res_231320;
    double *retval_defunc_2_reduce_res_231321;
    double *retval_defunc_2_reduce_res_231322;
    double *retval_defunc_2_reduce_res_231323;
    unsigned char *retval_mem_231317;
    unsigned char *retval_mem_231318;
};
struct futhark_mc_segred_stage_1_parloop_struct_236247 {
    struct futhark_context *ctx;
    unsigned char *free_mem_231294;
    unsigned char *free_mem_231295;
    unsigned char *free_mem_231317;
    unsigned char *free_mem_231318;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231686;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231688;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231690;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231692;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231694;
};
static int futhark_mc_segred_stage_1_parloop_236248(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231625,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236247
    *futhark_mc_segred_stage_1_parloop_struct_236247 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236247 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236247->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236248_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236248_start = get_wall_time();
    
    struct memblock mem_231294 = {.desc ="mem_231294", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236247->free_mem_231294,
                                  .size =0, .references =NULL};
    struct memblock mem_231295 = {.desc ="mem_231295", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236247->free_mem_231295,
                                  .size =0, .references =NULL};
    struct memblock mem_231317 = {.desc ="mem_231317", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236247->free_mem_231317,
                                  .size =0, .references =NULL};
    struct memblock mem_231318 = {.desc ="mem_231318", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236247->free_mem_231318,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231686 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231686",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236247->free_reduce_stage_1_tid_res_arr_mem_231686,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231688 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231688",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236247->free_reduce_stage_1_tid_res_arr_mem_231688,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231690 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231690",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236247->free_reduce_stage_1_tid_res_arr_mem_231690,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231692 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231692",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236247->free_reduce_stage_1_tid_res_arr_mem_231692,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231694 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231694",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236247->free_reduce_stage_1_tid_res_arr_mem_231694,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231696 = start;
    double x_231627;
    double x_231628;
    double x_231630;
    double x_231631;
    double x_231633;
    double x_231634;
    double x_231636;
    double x_231637;
    double x_231639;
    double x_231640;
    double local_acc_231697 = 0.0;
    double local_acc_231698 = 0.0;
    double local_acc_231699 = 0.0;
    double local_acc_231700 = 0.0;
    double local_acc_231701 = 0.0;
    
    for (; iter_231696 < end; iter_231696++) {
        int64_t gtid_231626 = iter_231696;
        double x_231642;
        
        x_231642 = ((double *) mem_231294.mem)[gtid_231626];
        
        double x_231643;
        
        x_231643 = ((double *) mem_231295.mem)[gtid_231626];
        
        double defunc_1_f_res_231644 = x_231642 * x_231643;
        double defunc_1_f_res_231645 = x_231642 * defunc_1_f_res_231644;
        double defunc_1_f_res_231646 = x_231642 * defunc_1_f_res_231645;
        double defunc_1_f_res_231647 = x_231642 * defunc_1_f_res_231646;
        
        // save map-out results
        {
            ((double *) mem_231317.mem)[gtid_231626] = defunc_1_f_res_231645;
            ((double *) mem_231318.mem)[gtid_231626] = defunc_1_f_res_231644;
        }
        // Load accum params
        {
            x_231627 = local_acc_231697;
        }
        // Load next params
        {
            x_231628 = x_231643;
        }
        // Red body
        {
            double defunc_1_op_res_231629 = x_231627 + x_231628;
            
            local_acc_231697 = defunc_1_op_res_231629;
        }
        // Load accum params
        {
            x_231630 = local_acc_231698;
        }
        // Load next params
        {
            x_231631 = defunc_1_f_res_231644;
        }
        // Red body
        {
            double defunc_1_op_res_231632 = x_231630 + x_231631;
            
            local_acc_231698 = defunc_1_op_res_231632;
        }
        // Load accum params
        {
            x_231633 = local_acc_231699;
        }
        // Load next params
        {
            x_231634 = defunc_1_f_res_231645;
        }
        // Red body
        {
            double defunc_1_op_res_231635 = x_231633 + x_231634;
            
            local_acc_231699 = defunc_1_op_res_231635;
        }
        // Load accum params
        {
            x_231636 = local_acc_231700;
        }
        // Load next params
        {
            x_231637 = defunc_1_f_res_231646;
        }
        // Red body
        {
            double defunc_1_op_res_231638 = x_231636 + x_231637;
            
            local_acc_231700 = defunc_1_op_res_231638;
        }
        // Load accum params
        {
            x_231639 = local_acc_231701;
        }
        // Load next params
        {
            x_231640 = defunc_1_f_res_231647;
        }
        // Red body
        {
            double defunc_1_op_res_231641 = x_231639 + x_231640;
            
            local_acc_231701 = defunc_1_op_res_231641;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231686.mem)[flat_tid_231625] =
        local_acc_231697;
    ((double *) reduce_stage_1_tid_res_arr_mem_231688.mem)[flat_tid_231625] =
        local_acc_231698;
    ((double *) reduce_stage_1_tid_res_arr_mem_231690.mem)[flat_tid_231625] =
        local_acc_231699;
    ((double *) reduce_stage_1_tid_res_arr_mem_231692.mem)[flat_tid_231625] =
        local_acc_231700;
    ((double *) reduce_stage_1_tid_res_arr_mem_231694.mem)[flat_tid_231625] =
        local_acc_231701;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236248_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236248_end -
                 futhark_mc_segred_stage_1_parloop_236248_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236248_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236248_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236248_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236241(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231625 = tid;
    int num_tasks_231685 = info.nsubtasks;
    struct futhark_mc_task_236240 *futhark_mc_task_236240 =
                                  (struct futhark_mc_task_236240 *) args;
    struct futhark_context *ctx = futhark_mc_task_236240->ctx;
    uint64_t futhark_mc_segred_task_236241_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236241_start = get_wall_time();
    
    struct memblock mem_231294 = {.desc ="mem_231294", .mem =
                                  futhark_mc_task_236240->free_mem_231294,
                                  .size =0, .references =NULL};
    struct memblock mem_231295 = {.desc ="mem_231295", .mem =
                                  futhark_mc_task_236240->free_mem_231295,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_231319 =
           *futhark_mc_task_236240->retval_defunc_2_reduce_res_231319;
    double defunc_2_reduce_res_231320 =
           *futhark_mc_task_236240->retval_defunc_2_reduce_res_231320;
    double defunc_2_reduce_res_231321 =
           *futhark_mc_task_236240->retval_defunc_2_reduce_res_231321;
    double defunc_2_reduce_res_231322 =
           *futhark_mc_task_236240->retval_defunc_2_reduce_res_231322;
    double defunc_2_reduce_res_231323 =
           *futhark_mc_task_236240->retval_defunc_2_reduce_res_231323;
    struct memblock mem_231317 = {.desc ="mem_231317", .mem =
                                  futhark_mc_task_236240->retval_mem_231317,
                                  .size =0, .references =NULL};
    struct memblock mem_231318 = {.desc ="mem_231318", .mem =
                                  futhark_mc_task_236240->retval_mem_231318,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_231686_cached_sizze_236242 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231686 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231688_cached_sizze_236243 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231688 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231690_cached_sizze_236244 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231690 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231692_cached_sizze_236245 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231692 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231694_cached_sizze_236246 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231694 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231686_cached_sizze_236242 <
        (size_t) ((int64_t) 8 * num_tasks_231685)) {
        reduce_stage_1_tid_res_arr_mem_231686 =
            realloc(reduce_stage_1_tid_res_arr_mem_231686, (int64_t) 8 *
                    num_tasks_231685);
        reduce_stage_1_tid_res_arr_mem_231686_cached_sizze_236242 =
            (int64_t) 8 * num_tasks_231685;
    }
    if (reduce_stage_1_tid_res_arr_mem_231688_cached_sizze_236243 <
        (size_t) ((int64_t) 8 * num_tasks_231685)) {
        reduce_stage_1_tid_res_arr_mem_231688 =
            realloc(reduce_stage_1_tid_res_arr_mem_231688, (int64_t) 8 *
                    num_tasks_231685);
        reduce_stage_1_tid_res_arr_mem_231688_cached_sizze_236243 =
            (int64_t) 8 * num_tasks_231685;
    }
    if (reduce_stage_1_tid_res_arr_mem_231690_cached_sizze_236244 <
        (size_t) ((int64_t) 8 * num_tasks_231685)) {
        reduce_stage_1_tid_res_arr_mem_231690 =
            realloc(reduce_stage_1_tid_res_arr_mem_231690, (int64_t) 8 *
                    num_tasks_231685);
        reduce_stage_1_tid_res_arr_mem_231690_cached_sizze_236244 =
            (int64_t) 8 * num_tasks_231685;
    }
    if (reduce_stage_1_tid_res_arr_mem_231692_cached_sizze_236245 <
        (size_t) ((int64_t) 8 * num_tasks_231685)) {
        reduce_stage_1_tid_res_arr_mem_231692 =
            realloc(reduce_stage_1_tid_res_arr_mem_231692, (int64_t) 8 *
                    num_tasks_231685);
        reduce_stage_1_tid_res_arr_mem_231692_cached_sizze_236245 =
            (int64_t) 8 * num_tasks_231685;
    }
    if (reduce_stage_1_tid_res_arr_mem_231694_cached_sizze_236246 <
        (size_t) ((int64_t) 8 * num_tasks_231685)) {
        reduce_stage_1_tid_res_arr_mem_231694 =
            realloc(reduce_stage_1_tid_res_arr_mem_231694, (int64_t) 8 *
                    num_tasks_231685);
        reduce_stage_1_tid_res_arr_mem_231694_cached_sizze_236246 =
            (int64_t) 8 * num_tasks_231685;
    }
    
    int64_t iter_231696;
    struct futhark_mc_segred_stage_1_parloop_struct_236247
    futhark_mc_segred_stage_1_parloop_struct_236247;
    
    futhark_mc_segred_stage_1_parloop_struct_236247.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_mem_231294 =
        mem_231294.mem;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_mem_231295 =
        mem_231295.mem;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_mem_231317 =
        mem_231317.mem;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_mem_231318 =
        mem_231318.mem;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_reduce_stage_1_tid_res_arr_mem_231686 =
        reduce_stage_1_tid_res_arr_mem_231686;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_reduce_stage_1_tid_res_arr_mem_231688 =
        reduce_stage_1_tid_res_arr_mem_231688;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_reduce_stage_1_tid_res_arr_mem_231690 =
        reduce_stage_1_tid_res_arr_mem_231690;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_reduce_stage_1_tid_res_arr_mem_231692 =
        reduce_stage_1_tid_res_arr_mem_231692;
    futhark_mc_segred_stage_1_parloop_struct_236247.free_reduce_stage_1_tid_res_arr_mem_231694 =
        reduce_stage_1_tid_res_arr_mem_231694;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236248_task;
    
    futhark_mc_segred_stage_1_parloop_236248_task.name =
        "futhark_mc_segred_stage_1_parloop_236248";
    futhark_mc_segred_stage_1_parloop_236248_task.fn =
        futhark_mc_segred_stage_1_parloop_236248;
    futhark_mc_segred_stage_1_parloop_236248_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236247;
    futhark_mc_segred_stage_1_parloop_236248_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236248_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236248_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236248_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236248_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236248_task);
    
    if (futhark_mc_segred_stage_1_parloop_236248_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236248_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236248_total_end -
                 futhark_mc_segred_stage_1_parloop_236248_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236248_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236248_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236248_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_231319 = 0.0;
        defunc_2_reduce_res_231320 = 0.0;
        defunc_2_reduce_res_231321 = 0.0;
        defunc_2_reduce_res_231322 = 0.0;
        defunc_2_reduce_res_231323 = 0.0;
    }
    
    double x_231702;
    double x_231703;
    double x_231705;
    double x_231706;
    double x_231708;
    double x_231709;
    double x_231711;
    double x_231712;
    double x_231714;
    double x_231715;
    
    for (int32_t i_231717 = 0; i_231717 < num_tasks_231685; i_231717++) {
        flat_tid_231625 = i_231717;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231702 = defunc_2_reduce_res_231319;
            }
            // load next params
            {
                x_231703 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231686)[flat_tid_231625];
            }
            // red body
            {
                double defunc_1_op_res_231704 = x_231702 + x_231703;
                
                defunc_2_reduce_res_231319 = defunc_1_op_res_231704;
            }
            // load acc params
            {
                x_231705 = defunc_2_reduce_res_231320;
            }
            // load next params
            {
                x_231706 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231688)[flat_tid_231625];
            }
            // red body
            {
                double defunc_1_op_res_231707 = x_231705 + x_231706;
                
                defunc_2_reduce_res_231320 = defunc_1_op_res_231707;
            }
            // load acc params
            {
                x_231708 = defunc_2_reduce_res_231321;
            }
            // load next params
            {
                x_231709 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231690)[flat_tid_231625];
            }
            // red body
            {
                double defunc_1_op_res_231710 = x_231708 + x_231709;
                
                defunc_2_reduce_res_231321 = defunc_1_op_res_231710;
            }
            // load acc params
            {
                x_231711 = defunc_2_reduce_res_231322;
            }
            // load next params
            {
                x_231712 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231692)[flat_tid_231625];
            }
            // red body
            {
                double defunc_1_op_res_231713 = x_231711 + x_231712;
                
                defunc_2_reduce_res_231322 = defunc_1_op_res_231713;
            }
            // load acc params
            {
                x_231714 = defunc_2_reduce_res_231323;
            }
            // load next params
            {
                x_231715 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231694)[flat_tid_231625];
            }
            // red body
            {
                double defunc_1_op_res_231716 = x_231714 + x_231715;
                
                defunc_2_reduce_res_231323 = defunc_1_op_res_231716;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231686);
        free(reduce_stage_1_tid_res_arr_mem_231688);
        free(reduce_stage_1_tid_res_arr_mem_231690);
        free(reduce_stage_1_tid_res_arr_mem_231692);
        free(reduce_stage_1_tid_res_arr_mem_231694);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236241_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236241_end -
                 futhark_mc_segred_task_236241_start;
        
        ctx->futhark_mc_segred_task_236241_runs[tid]++;
        ctx->futhark_mc_segred_task_236241_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236241_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236240->retval_defunc_2_reduce_res_231319 =
            defunc_2_reduce_res_231319;
        *futhark_mc_task_236240->retval_defunc_2_reduce_res_231320 =
            defunc_2_reduce_res_231320;
        *futhark_mc_task_236240->retval_defunc_2_reduce_res_231321 =
            defunc_2_reduce_res_231321;
        *futhark_mc_task_236240->retval_defunc_2_reduce_res_231322 =
            defunc_2_reduce_res_231322;
        *futhark_mc_task_236240->retval_defunc_2_reduce_res_231323 =
            defunc_2_reduce_res_231323;
        futhark_mc_task_236240->retval_mem_231317 = mem_231317.mem;
        futhark_mc_task_236240->retval_mem_231318 = mem_231318.mem;
    }
    return err;
}
struct futhark_mc_task_236249 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213437;
    unsigned char *free_mem_219293;
    int64_t free_x_231289;
    unsigned char *free_mem_231295;
    unsigned char *free_mem_231317;
    unsigned char *free_mem_231318;
    double free_a12_231369;
    double free_b12_231370;
    double free_c12_231371;
    double free_b2_231372;
    double free_c2_231373;
    double *retval_defunc_2_reduce_res_231374;
    double *retval_defunc_2_reduce_res_231375;
};
struct futhark_mc_segred_stage_1_parloop_struct_236253 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213437;
    unsigned char *free_mem_219293;
    int64_t free_x_231289;
    unsigned char *free_mem_231295;
    unsigned char *free_mem_231317;
    unsigned char *free_mem_231318;
    double free_a12_231369;
    double free_b12_231370;
    double free_c12_231371;
    double free_b2_231372;
    double free_c2_231373;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231719;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231721;
};
static int futhark_mc_segred_stage_1_parloop_236254(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231648,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236253
    *futhark_mc_segred_stage_1_parloop_struct_236253 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236253 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236253->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236254_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236254_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236253->free_n_203490;
    int64_t gtid_213437 =
            futhark_mc_segred_stage_1_parloop_struct_236253->free_gtid_213437;
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236253->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_231289 =
            futhark_mc_segred_stage_1_parloop_struct_236253->free_x_231289;
    struct memblock mem_231295 = {.desc ="mem_231295", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236253->free_mem_231295,
                                  .size =0, .references =NULL};
    struct memblock mem_231317 = {.desc ="mem_231317", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236253->free_mem_231317,
                                  .size =0, .references =NULL};
    struct memblock mem_231318 = {.desc ="mem_231318", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236253->free_mem_231318,
                                  .size =0, .references =NULL};
    double a12_231369 =
           futhark_mc_segred_stage_1_parloop_struct_236253->free_a12_231369;
    double b12_231370 =
           futhark_mc_segred_stage_1_parloop_struct_236253->free_b12_231370;
    double c12_231371 =
           futhark_mc_segred_stage_1_parloop_struct_236253->free_c12_231371;
    double b2_231372 =
           futhark_mc_segred_stage_1_parloop_struct_236253->free_b2_231372;
    double c2_231373 =
           futhark_mc_segred_stage_1_parloop_struct_236253->free_c2_231373;
    struct memblock reduce_stage_1_tid_res_arr_mem_231719 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231719",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236253->free_reduce_stage_1_tid_res_arr_mem_231719,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231721 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231721",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236253->free_reduce_stage_1_tid_res_arr_mem_231721,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231723 = start;
    double x_231650;
    double x_231651;
    double x_231653;
    double x_231654;
    double local_acc_231724 = 0.0;
    double local_acc_231725 = 0.0;
    
    for (; iter_231723 < end; iter_231723++) {
        int64_t gtid_231649 = iter_231723;
        double x_231656;
        
        x_231656 = ((double *) mem_231295.mem)[gtid_231649];
        
        double x_231657;
        
        x_231657 = ((double *) mem_231318.mem)[gtid_231649];
        
        double x_231658;
        
        x_231658 = ((double *) mem_231317.mem)[gtid_231649];
        
        bool cond_231659 = sle64(n_203490, gtid_231649);
        double defunc_0_f_res_231660;
        
        if (cond_231659) {
            defunc_0_f_res_231660 = 0.0;
        } else {
            int64_t i_231661 = add64(x_231289, gtid_231649);
            double defunc_0_add_arg_231662;
            
            defunc_0_add_arg_231662 = ((double *) mem_219293.mem)[gtid_213437 *
                                                                  n_203490 +
                                                                  i_231661];
            defunc_0_f_res_231660 = defunc_0_add_arg_231662;
        }
        
        double x_231663 = a12_231369 * x_231656;
        double y_231664 = b12_231370 * x_231657;
        double x_231665 = x_231663 + y_231664;
        double y_231666 = c12_231371 * x_231658;
        double x_231667 = x_231665 + y_231666;
        double defunc_9_fit_fun_res_231668 = defunc_0_f_res_231660 * x_231667;
        double x_231669 = b12_231370 * x_231656;
        double y_231670 = b2_231372 * x_231657;
        double x_231671 = x_231669 + y_231670;
        double y_231672 = c2_231373 * x_231658;
        double x_231673 = x_231671 + y_231672;
        double defunc_9_slope_fun_res_231674 = defunc_0_f_res_231660 * x_231673;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_231650 = local_acc_231724;
        }
        // Load next params
        {
            x_231651 = defunc_9_fit_fun_res_231668;
        }
        // Red body
        {
            double defunc_1_op_res_231652 = x_231650 + x_231651;
            
            local_acc_231724 = defunc_1_op_res_231652;
        }
        // Load accum params
        {
            x_231653 = local_acc_231725;
        }
        // Load next params
        {
            x_231654 = defunc_9_slope_fun_res_231674;
        }
        // Red body
        {
            double defunc_1_op_res_231655 = x_231653 + x_231654;
            
            local_acc_231725 = defunc_1_op_res_231655;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231719.mem)[flat_tid_231648] =
        local_acc_231724;
    ((double *) reduce_stage_1_tid_res_arr_mem_231721.mem)[flat_tid_231648] =
        local_acc_231725;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236254_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236254_end -
                 futhark_mc_segred_stage_1_parloop_236254_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236254_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236254_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236254_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236250(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231648 = tid;
    int num_tasks_231718 = info.nsubtasks;
    struct futhark_mc_task_236249 *futhark_mc_task_236249 =
                                  (struct futhark_mc_task_236249 *) args;
    struct futhark_context *ctx = futhark_mc_task_236249->ctx;
    uint64_t futhark_mc_segred_task_236250_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236250_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236249->free_n_203490;
    int64_t gtid_213437 = futhark_mc_task_236249->free_gtid_213437;
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236249->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t x_231289 = futhark_mc_task_236249->free_x_231289;
    struct memblock mem_231295 = {.desc ="mem_231295", .mem =
                                  futhark_mc_task_236249->free_mem_231295,
                                  .size =0, .references =NULL};
    struct memblock mem_231317 = {.desc ="mem_231317", .mem =
                                  futhark_mc_task_236249->free_mem_231317,
                                  .size =0, .references =NULL};
    struct memblock mem_231318 = {.desc ="mem_231318", .mem =
                                  futhark_mc_task_236249->free_mem_231318,
                                  .size =0, .references =NULL};
    double a12_231369 = futhark_mc_task_236249->free_a12_231369;
    double b12_231370 = futhark_mc_task_236249->free_b12_231370;
    double c12_231371 = futhark_mc_task_236249->free_c12_231371;
    double b2_231372 = futhark_mc_task_236249->free_b2_231372;
    double c2_231373 = futhark_mc_task_236249->free_c2_231373;
    double defunc_2_reduce_res_231374 =
           *futhark_mc_task_236249->retval_defunc_2_reduce_res_231374;
    double defunc_2_reduce_res_231375 =
           *futhark_mc_task_236249->retval_defunc_2_reduce_res_231375;
    size_t reduce_stage_1_tid_res_arr_mem_231719_cached_sizze_236251 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231719 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231721_cached_sizze_236252 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231721 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231719_cached_sizze_236251 <
        (size_t) ((int64_t) 8 * num_tasks_231718)) {
        reduce_stage_1_tid_res_arr_mem_231719 =
            realloc(reduce_stage_1_tid_res_arr_mem_231719, (int64_t) 8 *
                    num_tasks_231718);
        reduce_stage_1_tid_res_arr_mem_231719_cached_sizze_236251 =
            (int64_t) 8 * num_tasks_231718;
    }
    if (reduce_stage_1_tid_res_arr_mem_231721_cached_sizze_236252 <
        (size_t) ((int64_t) 8 * num_tasks_231718)) {
        reduce_stage_1_tid_res_arr_mem_231721 =
            realloc(reduce_stage_1_tid_res_arr_mem_231721, (int64_t) 8 *
                    num_tasks_231718);
        reduce_stage_1_tid_res_arr_mem_231721_cached_sizze_236252 =
            (int64_t) 8 * num_tasks_231718;
    }
    
    int64_t iter_231723;
    struct futhark_mc_segred_stage_1_parloop_struct_236253
    futhark_mc_segred_stage_1_parloop_struct_236253;
    
    futhark_mc_segred_stage_1_parloop_struct_236253.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_gtid_213437 =
        gtid_213437;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_mem_219293 =
        mem_219293.mem;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_x_231289 = x_231289;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_mem_231295 =
        mem_231295.mem;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_mem_231317 =
        mem_231317.mem;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_mem_231318 =
        mem_231318.mem;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_a12_231369 =
        a12_231369;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_b12_231370 =
        b12_231370;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_c12_231371 =
        c12_231371;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_b2_231372 = b2_231372;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_c2_231373 = c2_231373;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_reduce_stage_1_tid_res_arr_mem_231719 =
        reduce_stage_1_tid_res_arr_mem_231719;
    futhark_mc_segred_stage_1_parloop_struct_236253.free_reduce_stage_1_tid_res_arr_mem_231721 =
        reduce_stage_1_tid_res_arr_mem_231721;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236254_task;
    
    futhark_mc_segred_stage_1_parloop_236254_task.name =
        "futhark_mc_segred_stage_1_parloop_236254";
    futhark_mc_segred_stage_1_parloop_236254_task.fn =
        futhark_mc_segred_stage_1_parloop_236254;
    futhark_mc_segred_stage_1_parloop_236254_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236253;
    futhark_mc_segred_stage_1_parloop_236254_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236254_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236254_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236254_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236254_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236254_task);
    
    if (futhark_mc_segred_stage_1_parloop_236254_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236254_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236254_total_end -
                 futhark_mc_segred_stage_1_parloop_236254_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236254_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236254_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236254_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_231374 = 0.0;
        defunc_2_reduce_res_231375 = 0.0;
    }
    
    double x_231726;
    double x_231727;
    double x_231729;
    double x_231730;
    
    for (int32_t i_231732 = 0; i_231732 < num_tasks_231718; i_231732++) {
        flat_tid_231648 = i_231732;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231726 = defunc_2_reduce_res_231374;
            }
            // load next params
            {
                x_231727 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231719)[flat_tid_231648];
            }
            // red body
            {
                double defunc_1_op_res_231728 = x_231726 + x_231727;
                
                defunc_2_reduce_res_231374 = defunc_1_op_res_231728;
            }
            // load acc params
            {
                x_231729 = defunc_2_reduce_res_231375;
            }
            // load next params
            {
                x_231730 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231721)[flat_tid_231648];
            }
            // red body
            {
                double defunc_1_op_res_231731 = x_231729 + x_231730;
                
                defunc_2_reduce_res_231375 = defunc_1_op_res_231731;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231719);
        free(reduce_stage_1_tid_res_arr_mem_231721);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236250_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236250_end -
                 futhark_mc_segred_task_236250_start;
        
        ctx->futhark_mc_segred_task_236250_runs[tid]++;
        ctx->futhark_mc_segred_task_236250_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236250_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236249->retval_defunc_2_reduce_res_231374 =
            defunc_2_reduce_res_231374;
        *futhark_mc_task_236249->retval_defunc_2_reduce_res_231375 =
            defunc_2_reduce_res_231375;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236231(void *args, int64_t start,
                                            int64_t end, int flat_tid_231287,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236230
    *futhark_mc_segmap_parloop_struct_236230 =
    (struct futhark_mc_segmap_parloop_struct_236230 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236230->ctx;
    uint64_t futhark_mc_segmap_parloop_236231_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236231_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236230->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236230->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236230->free_jump_t_203500;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236230->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236230->free_i_203670;
    int64_t gtid_213437 =
            futhark_mc_segmap_parloop_struct_236230->free_gtid_213437;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236230->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236230->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236230->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236230->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236230->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236230->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236230->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 =
            futhark_mc_segmap_parloop_struct_236230->free_bytes_219582;
    struct memblock mem_219655 = {.desc ="mem_219655", .mem =
                                  futhark_mc_segmap_parloop_struct_236230->free_mem_219655,
                                  .size =0, .references =NULL};
    struct memblock mem_219658 = {.desc ="mem_219658", .mem =
                                  futhark_mc_segmap_parloop_struct_236230->free_mem_219658,
                                  .size =0, .references =NULL};
    size_t mem_231294_cached_sizze_236232 = 0;
    unsigned char *mem_231294 = NULL;
    size_t mem_231295_cached_sizze_236233 = 0;
    unsigned char *mem_231295 = NULL;
    size_t mem_231317_cached_sizze_236234 = 0;
    unsigned char *mem_231317 = NULL;
    size_t mem_231318_cached_sizze_236235 = 0;
    unsigned char *mem_231318 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231605 = start;
    
    if (mem_231294_cached_sizze_236232 < (size_t) bytes_219582) {
        mem_231294 = realloc(mem_231294, bytes_219582);
        mem_231294_cached_sizze_236232 = bytes_219582;
    }
    if (mem_231295_cached_sizze_236233 < (size_t) bytes_219582) {
        mem_231295 = realloc(mem_231295, bytes_219582);
        mem_231295_cached_sizze_236233 = bytes_219582;
    }
    if (mem_231317_cached_sizze_236234 < (size_t) bytes_219582) {
        mem_231317 = realloc(mem_231317, bytes_219582);
        mem_231317_cached_sizze_236234 = bytes_219582;
    }
    if (mem_231318_cached_sizze_236235 < (size_t) bytes_219582) {
        mem_231318 = realloc(mem_231318, bytes_219582);
        mem_231318_cached_sizze_236235 = bytes_219582;
    }
    for (; iter_231605 < end; iter_231605++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231675 = l_n_m_203643;
        int64_t gtid_231288 = iter_231605;
        int64_t remnant_231676 = iter_231605 - gtid_231288;
        int64_t x_231289;
        
        x_231289 = ((int64_t *) mem_217773.mem)[gtid_213437 * l_n_m_203643 +
                                                gtid_231288];
        
        double x_231290;
        
        x_231290 = ((double *) mem_217777.mem)[gtid_213437 * l_n_m_203643 +
                                               gtid_231288];
        
        int64_t min_arg_231291 = mul64(jump_t_203500, gtid_231288);
        int64_t min_res_231292 = smin64(i_203670, min_arg_231291);
        int64_t defunc_0_g_res_231293 = add64((int64_t) 1, min_res_231292);
        int64_t flat_tid_231606 = (int64_t) 0;
        int32_t num_tasks_231677;
        struct futhark_mc_task_236236 futhark_mc_task_236236;
        
        futhark_mc_task_236236.ctx = ctx;
        futhark_mc_task_236236.free_n_203490 = n_203490;
        futhark_mc_task_236236.free_q_l_203495 = q_l_203495;
        futhark_mc_task_236236.free_gtid_213437 = gtid_213437;
        futhark_mc_task_236236.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236236.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236236.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236236.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236236.free_x_231289 = x_231289;
        futhark_mc_task_236236.free_x_231290 = x_231290;
        futhark_mc_task_236236.free_defunc_0_g_res_231293 =
            defunc_0_g_res_231293;
        futhark_mc_task_236236.free_mem_231294 = mem_231294;
        futhark_mc_task_236236.free_mem_231295 = mem_231295;
        
        struct scheduler_segop futhark_mc_task_236236_task;
        
        futhark_mc_task_236236_task.args = &futhark_mc_task_236236;
        futhark_mc_task_236236_task.top_level_fn =
            futhark_mc_segmap_task_236237;
        futhark_mc_task_236236_task.name = "futhark_mc_segmap_task_236237";
        futhark_mc_task_236236_task.iterations = q_l_203495;
        futhark_mc_task_236236_task.task_time =
            &ctx->futhark_mc_segmap_task_236237_total_time;
        futhark_mc_task_236236_task.task_iter =
            &ctx->futhark_mc_segmap_task_236237_total_iter;
        futhark_mc_task_236236_task.sched = STATIC;
        futhark_mc_task_236236_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236237_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236236_task);
        
        if (futhark_mc_segmap_task_236237_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double defunc_2_reduce_res_231319;
        double defunc_2_reduce_res_231320;
        double defunc_2_reduce_res_231321;
        double defunc_2_reduce_res_231322;
        double defunc_2_reduce_res_231323;
        int64_t flat_tid_231625 = (int64_t) 0;
        int32_t num_tasks_231685;
        
        defunc_2_reduce_res_231319 = 0.0;
        defunc_2_reduce_res_231320 = 0.0;
        defunc_2_reduce_res_231321 = 0.0;
        defunc_2_reduce_res_231322 = 0.0;
        defunc_2_reduce_res_231323 = 0.0;
        
        struct futhark_mc_task_236240 futhark_mc_task_236240;
        
        futhark_mc_task_236240.ctx = ctx;
        futhark_mc_task_236240.free_mem_231294 = mem_231294;
        futhark_mc_task_236240.free_mem_231295 = mem_231295;
        futhark_mc_task_236240.retval_defunc_2_reduce_res_231319 =
            &defunc_2_reduce_res_231319;
        futhark_mc_task_236240.retval_defunc_2_reduce_res_231320 =
            &defunc_2_reduce_res_231320;
        futhark_mc_task_236240.retval_defunc_2_reduce_res_231321 =
            &defunc_2_reduce_res_231321;
        futhark_mc_task_236240.retval_defunc_2_reduce_res_231322 =
            &defunc_2_reduce_res_231322;
        futhark_mc_task_236240.retval_defunc_2_reduce_res_231323 =
            &defunc_2_reduce_res_231323;
        futhark_mc_task_236240.retval_mem_231317 = mem_231317;
        futhark_mc_task_236240.retval_mem_231318 = mem_231318;
        
        struct scheduler_segop futhark_mc_task_236240_task;
        
        futhark_mc_task_236240_task.args = &futhark_mc_task_236240;
        futhark_mc_task_236240_task.top_level_fn =
            futhark_mc_segred_task_236241;
        futhark_mc_task_236240_task.name = "futhark_mc_segred_task_236241";
        futhark_mc_task_236240_task.iterations = q_l_203495;
        futhark_mc_task_236240_task.task_time =
            &ctx->futhark_mc_segred_task_236241_total_time;
        futhark_mc_task_236240_task.task_iter =
            &ctx->futhark_mc_segred_task_236241_total_iter;
        futhark_mc_task_236240_task.sched = STATIC;
        futhark_mc_task_236240_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236241_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236240_task);
        
        if (futhark_mc_segred_task_236241_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_231349 = defunc_2_reduce_res_231321 *
               defunc_2_reduce_res_231323;
        double y_231350 = defunc_2_reduce_res_231322 *
               defunc_2_reduce_res_231322;
        double a12_231351 = x_231349 - y_231350;
        double x_231352 = defunc_2_reduce_res_231321 *
               defunc_2_reduce_res_231322;
        double y_231353 = defunc_2_reduce_res_231320 *
               defunc_2_reduce_res_231323;
        double b12_231354 = x_231352 - y_231353;
        double x_231355 = defunc_2_reduce_res_231320 *
               defunc_2_reduce_res_231322;
        double y_231356 = defunc_2_reduce_res_231321 *
               defunc_2_reduce_res_231321;
        double c12_231357 = x_231355 - y_231356;
        double x_231358 = defunc_2_reduce_res_231319 *
               defunc_2_reduce_res_231323;
        double b2_231359 = x_231358 - y_231356;
        double x_231360 = defunc_2_reduce_res_231320 *
               defunc_2_reduce_res_231321;
        double y_231361 = defunc_2_reduce_res_231319 *
               defunc_2_reduce_res_231322;
        double c2_231362 = x_231360 - y_231361;
        double x_231363 = defunc_2_reduce_res_231319 * a12_231351;
        double y_231364 = defunc_2_reduce_res_231320 * b12_231354;
        double x_231365 = x_231363 + y_231364;
        double y_231366 = defunc_2_reduce_res_231321 * c12_231357;
        double y_231367 = x_231365 + y_231366;
        double det_231368 = 1.0 / y_231367;
        double a12_231369 = a12_231351 * det_231368;
        double b12_231370 = b12_231354 * det_231368;
        double c12_231371 = c12_231357 * det_231368;
        double b2_231372 = b2_231359 * det_231368;
        double c2_231373 = c2_231362 * det_231368;
        double defunc_2_reduce_res_231374;
        double defunc_2_reduce_res_231375;
        int64_t flat_tid_231648 = (int64_t) 0;
        int32_t num_tasks_231718;
        
        defunc_2_reduce_res_231374 = 0.0;
        defunc_2_reduce_res_231375 = 0.0;
        
        struct futhark_mc_task_236249 futhark_mc_task_236249;
        
        futhark_mc_task_236249.ctx = ctx;
        futhark_mc_task_236249.free_n_203490 = n_203490;
        futhark_mc_task_236249.free_gtid_213437 = gtid_213437;
        futhark_mc_task_236249.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236249.free_x_231289 = x_231289;
        futhark_mc_task_236249.free_mem_231295 = mem_231295;
        futhark_mc_task_236249.free_mem_231317 = mem_231317;
        futhark_mc_task_236249.free_mem_231318 = mem_231318;
        futhark_mc_task_236249.free_a12_231369 = a12_231369;
        futhark_mc_task_236249.free_b12_231370 = b12_231370;
        futhark_mc_task_236249.free_c12_231371 = c12_231371;
        futhark_mc_task_236249.free_b2_231372 = b2_231372;
        futhark_mc_task_236249.free_c2_231373 = c2_231373;
        futhark_mc_task_236249.retval_defunc_2_reduce_res_231374 =
            &defunc_2_reduce_res_231374;
        futhark_mc_task_236249.retval_defunc_2_reduce_res_231375 =
            &defunc_2_reduce_res_231375;
        
        struct scheduler_segop futhark_mc_task_236249_task;
        
        futhark_mc_task_236249_task.args = &futhark_mc_task_236249;
        futhark_mc_task_236249_task.top_level_fn =
            futhark_mc_segred_task_236250;
        futhark_mc_task_236249_task.name = "futhark_mc_segred_task_236250";
        futhark_mc_task_236249_task.iterations = q_l_203495;
        futhark_mc_task_236249_task.task_time =
            &ctx->futhark_mc_segred_task_236250_total_time;
        futhark_mc_task_236249_task.task_iter =
            &ctx->futhark_mc_segred_task_236250_total_iter;
        futhark_mc_task_236249_task.sched = STATIC;
        futhark_mc_task_236249_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236250_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236249_task);
        
        if (futhark_mc_segred_task_236250_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219655.mem)[gtid_231288] = defunc_2_reduce_res_231374;
        ((double *) mem_219658.mem)[gtid_231288] = defunc_2_reduce_res_231375;
    }
    
  cleanup:
    { }
    free(mem_231294);
    free(mem_231295);
    free(mem_231317);
    free(mem_231318);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236231_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236231_end -
                 futhark_mc_segmap_parloop_236231_start;
        
        ctx->futhark_mc_segmap_parloop_236231_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236231_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236231_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236229(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231287 = tid;
    int num_tasks_231523 = info.nsubtasks;
    struct futhark_mc_task_236221 *futhark_mc_task_236221 =
                                  (struct futhark_mc_task_236221 *) args;
    struct futhark_context *ctx = futhark_mc_task_236221->ctx;
    uint64_t futhark_mc_segmap_nested_task_236229_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236229_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236221->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236221->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236221->free_jump_t_203500;
    int64_t l_n_m_203643 = futhark_mc_task_236221->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236221->free_i_203670;
    int64_t gtid_213437 = futhark_mc_task_236221->free_gtid_213437;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236221->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236221->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236221->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236221->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236221->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236221->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236221->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 = futhark_mc_task_236221->free_bytes_219582;
    struct memblock mem_219655 = {.desc ="mem_219655", .mem =
                                  futhark_mc_task_236221->free_mem_219655,
                                  .size =0, .references =NULL};
    struct memblock mem_219658 = {.desc ="mem_219658", .mem =
                                  futhark_mc_task_236221->free_mem_219658,
                                  .size =0, .references =NULL};
    int64_t iter_231605;
    struct futhark_mc_segmap_parloop_struct_236230
    futhark_mc_segmap_parloop_struct_236230;
    
    futhark_mc_segmap_parloop_struct_236230.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236230.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236230.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236230.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236230.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236230.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236230.free_gtid_213437 = gtid_213437;
    futhark_mc_segmap_parloop_struct_236230.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236230.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236230.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236230.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236230.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236230.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236230.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236230.free_bytes_219582 = bytes_219582;
    futhark_mc_segmap_parloop_struct_236230.free_mem_219655 = mem_219655.mem;
    futhark_mc_segmap_parloop_struct_236230.free_mem_219658 = mem_219658.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236231_task;
    
    futhark_mc_segmap_parloop_236231_task.name =
        "futhark_mc_segmap_parloop_236231";
    futhark_mc_segmap_parloop_236231_task.fn = futhark_mc_segmap_parloop_236231;
    futhark_mc_segmap_parloop_236231_task.args =
        &futhark_mc_segmap_parloop_struct_236230;
    futhark_mc_segmap_parloop_236231_task.iterations = iterations;
    futhark_mc_segmap_parloop_236231_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236231_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236231_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236231_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236231_task);
    
    if (futhark_mc_segmap_parloop_236231_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236231_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236231_total_end -
                 futhark_mc_segmap_parloop_236231_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236231_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236231_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236231_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236229_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236229_end -
                 futhark_mc_segmap_nested_task_236229_start;
        
        ctx->futhark_mc_segmap_nested_task_236229_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236229_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236229_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236218(void *args, int64_t start,
                                            int64_t end, int flat_tid_213436,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236217
    *futhark_mc_segmap_parloop_struct_236217 =
    (struct futhark_mc_segmap_parloop_struct_236217 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236217->ctx;
    uint64_t futhark_mc_segmap_parloop_236218_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236218_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236217->free_n_203490;
    int64_t q_l_203495 =
            futhark_mc_segmap_parloop_struct_236217->free_q_l_203495;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236217->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236217->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236217->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236217->free_i_203670;
    int64_t bytes_217720 =
            futhark_mc_segmap_parloop_struct_236217->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236217->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236217->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236217->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236217->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 =
            futhark_mc_segmap_parloop_struct_236217->free_bytes_219582;
    struct memblock mem_219752 = {.desc ="mem_219752", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_219752,
                                  .size =0, .references =NULL};
    struct memblock mem_219756 = {.desc ="mem_219756", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_219756,
                                  .size =0, .references =NULL};
    size_t mem_219655_cached_sizze_236219 = 0;
    unsigned char *mem_219655 = NULL;
    size_t mem_219658_cached_sizze_236220 = 0;
    unsigned char *mem_219658 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231286 = start;
    
    if (mem_219655_cached_sizze_236219 < (size_t) bytes_217720) {
        mem_219655 = realloc(mem_219655, bytes_217720);
        mem_219655_cached_sizze_236219 = bytes_217720;
    }
    if (mem_219658_cached_sizze_236220 < (size_t) bytes_217720) {
        mem_219658 = realloc(mem_219658, bytes_217720);
        mem_219658_cached_sizze_236220 = bytes_217720;
    }
    for (; iter_231286 < end; iter_231286++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231521 = partition_sizze_203577;
        int64_t gtid_213437 = iter_231286;
        int64_t remnant_231522 = iter_231286 - gtid_213437;
        int64_t flat_tid_231403 = (int64_t) 0;
        int32_t num_tasks_231523;
        int64_t flat_tid_231287 = (int64_t) 0;
        struct futhark_mc_task_236221 futhark_mc_task_236221;
        
        futhark_mc_task_236221.ctx = ctx;
        futhark_mc_task_236221.free_n_203490 = n_203490;
        futhark_mc_task_236221.free_q_l_203495 = q_l_203495;
        futhark_mc_task_236221.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236221.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_236221.free_i_203670 = i_203670;
        futhark_mc_task_236221.free_gtid_213437 = gtid_213437;
        futhark_mc_task_236221.free_mem_217773 = mem_217773.mem;
        futhark_mc_task_236221.free_mem_217777 = mem_217777.mem;
        futhark_mc_task_236221.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236221.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236221.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236221.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236221.free_mem_219293 = mem_219293.mem;
        futhark_mc_task_236221.free_bytes_219582 = bytes_219582;
        futhark_mc_task_236221.free_mem_219655 = mem_219655;
        futhark_mc_task_236221.free_mem_219658 = mem_219658;
        
        struct scheduler_segop futhark_mc_task_236221_task;
        
        futhark_mc_task_236221_task.args = &futhark_mc_task_236221;
        futhark_mc_task_236221_task.top_level_fn =
            futhark_mc_segmap_task_236222;
        futhark_mc_task_236221_task.name = "futhark_mc_segmap_task_236222";
        futhark_mc_task_236221_task.iterations = l_n_m_203643;
        futhark_mc_task_236221_task.task_time =
            &ctx->futhark_mc_segmap_task_236222_total_time;
        futhark_mc_task_236221_task.task_iter =
            &ctx->futhark_mc_segmap_task_236222_total_iter;
        futhark_mc_task_236221_task.sched = STATIC;
        futhark_mc_task_236221_task.nested_fn =
            futhark_mc_segmap_nested_task_236229;
        
        int futhark_mc_segmap_task_236222_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236221_task);
        
        if (futhark_mc_segmap_task_236222_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219752.mem + gtid_213437 * l_n_m_203643 * (int64_t) 8,
                    mem_219655 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
        if (l_n_m_203643 * (int64_t) 8 > 0)
            memmove(mem_219756.mem + gtid_213437 * l_n_m_203643 * (int64_t) 8,
                    mem_219658 + (int64_t) 0, l_n_m_203643 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219655);
    free(mem_219658);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236218_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236218_end -
                 futhark_mc_segmap_parloop_236218_start;
        
        ctx->futhark_mc_segmap_parloop_236218_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236218_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236218_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236216(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213436 = tid;
    int num_tasks_231152 = info.nsubtasks;
    struct futhark_mc_task_236206 *futhark_mc_task_236206 =
                                  (struct futhark_mc_task_236206 *) args;
    struct futhark_context *ctx = futhark_mc_task_236206->ctx;
    uint64_t futhark_mc_segmap_nested_task_236216_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236216_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236206->free_n_203490;
    int64_t q_l_203495 = futhark_mc_task_236206->free_q_l_203495;
    int64_t jump_t_203500 = futhark_mc_task_236206->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236206->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236206->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236206->free_i_203670;
    int64_t bytes_217720 = futhark_mc_task_236206->free_bytes_217720;
    struct memblock mem_217773 = {.desc ="mem_217773", .mem =
                                  futhark_mc_task_236206->free_mem_217773,
                                  .size =0, .references =NULL};
    struct memblock mem_217777 = {.desc ="mem_217777", .mem =
                                  futhark_mc_task_236206->free_mem_217777,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236206->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236206->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236206->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236206->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219293 = {.desc ="mem_219293", .mem =
                                  futhark_mc_task_236206->free_mem_219293,
                                  .size =0, .references =NULL};
    int64_t bytes_219582 = futhark_mc_task_236206->free_bytes_219582;
    struct memblock mem_219752 = {.desc ="mem_219752", .mem =
                                  futhark_mc_task_236206->free_mem_219752,
                                  .size =0, .references =NULL};
    struct memblock mem_219756 = {.desc ="mem_219756", .mem =
                                  futhark_mc_task_236206->free_mem_219756,
                                  .size =0, .references =NULL};
    int64_t iter_231286;
    struct futhark_mc_segmap_parloop_struct_236217
    futhark_mc_segmap_parloop_struct_236217;
    
    futhark_mc_segmap_parloop_struct_236217.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236217.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236217.free_q_l_203495 = q_l_203495;
    futhark_mc_segmap_parloop_struct_236217.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236217.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236217.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236217.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236217.free_bytes_217720 = bytes_217720;
    futhark_mc_segmap_parloop_struct_236217.free_mem_217773 = mem_217773.mem;
    futhark_mc_segmap_parloop_struct_236217.free_mem_217777 = mem_217777.mem;
    futhark_mc_segmap_parloop_struct_236217.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236217.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236217.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236217.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236217.free_mem_219293 = mem_219293.mem;
    futhark_mc_segmap_parloop_struct_236217.free_bytes_219582 = bytes_219582;
    futhark_mc_segmap_parloop_struct_236217.free_mem_219752 = mem_219752.mem;
    futhark_mc_segmap_parloop_struct_236217.free_mem_219756 = mem_219756.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236218_task;
    
    futhark_mc_segmap_parloop_236218_task.name =
        "futhark_mc_segmap_parloop_236218";
    futhark_mc_segmap_parloop_236218_task.fn = futhark_mc_segmap_parloop_236218;
    futhark_mc_segmap_parloop_236218_task.args =
        &futhark_mc_segmap_parloop_struct_236217;
    futhark_mc_segmap_parloop_236218_task.iterations = iterations;
    futhark_mc_segmap_parloop_236218_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236218_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236218_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236218_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236218_task);
    
    if (futhark_mc_segmap_parloop_236218_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236218_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236218_total_end -
                 futhark_mc_segmap_parloop_236218_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236218_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236218_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236218_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236216_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236216_end -
                 futhark_mc_segmap_nested_task_236216_start;
        
        ctx->futhark_mc_segmap_nested_task_236216_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236216_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236216_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236255 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_l_203501;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_y_205786;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_219761;
    unsigned char *free_ext_mem_219762;
    unsigned char *free_mem_219784;
};
struct futhark_mc_segmap_parloop_struct_236257 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_l_203501;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_y_205786;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_219761;
    unsigned char *free_ext_mem_219762;
    unsigned char *free_mem_219784;
};
static int futhark_mc_segmap_parloop_236258(void *args, int64_t start,
                                            int64_t end, int flat_tid_213668,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236257
    *futhark_mc_segmap_parloop_struct_236257 =
    (struct futhark_mc_segmap_parloop_struct_236257 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236257->ctx;
    uint64_t futhark_mc_segmap_parloop_236258_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236258_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236257->free_n_203490;
    int64_t jump_l_203501 =
            futhark_mc_segmap_parloop_struct_236257->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236257->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236257->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236257->free_i_203670;
    int64_t y_205786 = futhark_mc_segmap_parloop_struct_236257->free_y_205786;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236257->free_bytes_217302;
    struct memblock ext_mem_219761 = {.desc ="ext_mem_219761", .mem =
                                      futhark_mc_segmap_parloop_struct_236257->free_ext_mem_219761,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219762 = {.desc ="ext_mem_219762", .mem =
                                      futhark_mc_segmap_parloop_struct_236257->free_ext_mem_219762,
                                      .size =0, .references =NULL};
    struct memblock mem_219784 = {.desc ="mem_219784", .mem =
                                  futhark_mc_segmap_parloop_struct_236257->free_mem_219784,
                                  .size =0, .references =NULL};
    size_t mem_219768_cached_sizze_236259 = 0;
    unsigned char *mem_219768 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231734 = start;
    
    if (mem_219768_cached_sizze_236259 < (size_t) bytes_217302) {
        mem_219768 = realloc(mem_219768, bytes_217302);
        mem_219768_cached_sizze_236259 = bytes_217302;
    }
    for (; iter_231734 < end; iter_231734++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231784 = partition_sizze_203577;
        int64_t gtid_213669 = iter_231734;
        int64_t remnant_231785 = iter_231734 - gtid_213669;
        
        for (int64_t i_231735 = 0; i_231735 < n_203490; i_231735++) {
            int64_t m_v_231737 = sdiv64(i_231735, jump_l_203501);
            bool cond_231738 = m_v_231737 == y_205786;
            int64_t j_231739;
            
            if (cond_231738) {
                int64_t j_t_res_231740 = sub64(m_v_231737, (int64_t) 1);
                
                j_231739 = j_t_res_231740;
            } else {
                j_231739 = m_v_231737;
            }
            
            int64_t min_arg_231741 = mul64(jump_l_203501, j_231739);
            int64_t min_res_231742 = smin64(i_203670, min_arg_231741);
            int64_t defunc_0_m_fun_arg_231743 = add64((int64_t) 1, j_231739);
            int64_t min_arg_231744 = mul64(jump_l_203501,
                                           defunc_0_m_fun_arg_231743);
            int64_t min_res_231745 = smin64(i_203670, min_arg_231744);
            int64_t i64_arg_231746 = sub64(min_res_231745, min_res_231742);
            double i64_res_231747 = sitofp_i64_f64(i64_arg_231746);
            int64_t i64_arg_231748 = sub64(i_231735, min_res_231742);
            double i64_res_231749 = sitofp_i64_f64(i64_arg_231748);
            double u_231750 = i64_res_231749 / i64_res_231747;
            double u2_231751 = u_231750 * u_231750;
            double u3_231752 = u_231750 * u2_231751;
            double x_231753 = 2.0 * u3_231752;
            double y_231754 = 3.0 * u2_231751;
            double x_231755 = x_231753 - y_231754;
            double x_231756 = 1.0 + x_231755;
            bool x_231757 = sle64((int64_t) 0, j_231739);
            bool y_231758 = slt64(j_231739, l_n_m_203643);
            bool bounds_check_231759 = x_231757 && y_231758;
            bool index_certs_231760;
            
            if (!bounds_check_231759) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) j_231739,
                              "] out of bounds for array of shape [",
                              (long long) l_n_m_203643, "].",
                              "-> #0  loess.fut:536:27-33\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:252:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:250:15-253:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double y_231761;
            
            y_231761 = ((double *) ext_mem_219762.mem)[gtid_213669 *
                                                       l_n_m_203643 + j_231739];
            
            double x_231762 = x_231756 * y_231761;
            double x_231763 = y_231754 - x_231753;
            bool x_231764 = sle64((int64_t) 0, defunc_0_m_fun_arg_231743);
            bool y_231765 = slt64(defunc_0_m_fun_arg_231743, l_n_m_203643);
            bool bounds_check_231766 = x_231764 && y_231765;
            bool index_certs_231767;
            
            if (!bounds_check_231766) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) defunc_0_m_fun_arg_231743,
                              "] out of bounds for array of shape [",
                              (long long) l_n_m_203643, "].",
                              "-> #0  loess.fut:537:27-37\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:252:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:250:15-253:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double y_231768;
            
            y_231768 = ((double *) ext_mem_219762.mem)[gtid_213669 *
                                                       l_n_m_203643 +
                                                       defunc_0_m_fun_arg_231743];
            
            double y_231769 = x_231763 * y_231768;
            double x_231770 = x_231762 + y_231769;
            double y_231771 = 2.0 * u2_231751;
            double x_231772 = u3_231752 - y_231771;
            double x_231773 = u_231750 + x_231772;
            double y_231774;
            
            y_231774 = ((double *) ext_mem_219761.mem)[gtid_213669 *
                                                       l_n_m_203643 + j_231739];
            
            double x_231775 = x_231773 * y_231774;
            double y_231776 = i64_res_231747 * x_231775;
            double x_231777 = x_231770 + y_231776;
            double x_231778 = u3_231752 - u2_231751;
            double y_231779;
            
            y_231779 = ((double *) ext_mem_219761.mem)[gtid_213669 *
                                                       l_n_m_203643 +
                                                       defunc_0_m_fun_arg_231743];
            
            double x_231780 = x_231778 * y_231779;
            double y_231781 = i64_res_231747 * x_231780;
            double defunc_4_interpolate_proc_res_231782 = x_231777 + y_231781;
            
            ((double *) mem_219768)[i_231735] =
                defunc_4_interpolate_proc_res_231782;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_219784.mem + gtid_213669 * n_203490 * (int64_t) 8,
                    mem_219768 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219768);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236258_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236258_end -
                 futhark_mc_segmap_parloop_236258_start;
        
        ctx->futhark_mc_segmap_parloop_236258_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236258_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236258_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236256(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213668 = tid;
    int num_tasks_231733 = info.nsubtasks;
    struct futhark_mc_task_236255 *futhark_mc_task_236255 =
                                  (struct futhark_mc_task_236255 *) args;
    struct futhark_context *ctx = futhark_mc_task_236255->ctx;
    uint64_t futhark_mc_segmap_task_236256_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236256_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236255->free_n_203490;
    int64_t jump_l_203501 = futhark_mc_task_236255->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236255->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236255->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236255->free_i_203670;
    int64_t y_205786 = futhark_mc_task_236255->free_y_205786;
    int64_t bytes_217302 = futhark_mc_task_236255->free_bytes_217302;
    struct memblock ext_mem_219761 = {.desc ="ext_mem_219761", .mem =
                                      futhark_mc_task_236255->free_ext_mem_219761,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219762 = {.desc ="ext_mem_219762", .mem =
                                      futhark_mc_task_236255->free_ext_mem_219762,
                                      .size =0, .references =NULL};
    struct memblock mem_219784 = {.desc ="mem_219784", .mem =
                                  futhark_mc_task_236255->free_mem_219784,
                                  .size =0, .references =NULL};
    int64_t iter_231734;
    struct futhark_mc_segmap_parloop_struct_236257
    futhark_mc_segmap_parloop_struct_236257;
    
    futhark_mc_segmap_parloop_struct_236257.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236257.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236257.free_jump_l_203501 = jump_l_203501;
    futhark_mc_segmap_parloop_struct_236257.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236257.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236257.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236257.free_y_205786 = y_205786;
    futhark_mc_segmap_parloop_struct_236257.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236257.free_ext_mem_219761 =
        ext_mem_219761.mem;
    futhark_mc_segmap_parloop_struct_236257.free_ext_mem_219762 =
        ext_mem_219762.mem;
    futhark_mc_segmap_parloop_struct_236257.free_mem_219784 = mem_219784.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236258_task;
    
    futhark_mc_segmap_parloop_236258_task.name =
        "futhark_mc_segmap_parloop_236258";
    futhark_mc_segmap_parloop_236258_task.fn = futhark_mc_segmap_parloop_236258;
    futhark_mc_segmap_parloop_236258_task.args =
        &futhark_mc_segmap_parloop_struct_236257;
    futhark_mc_segmap_parloop_236258_task.iterations = iterations;
    futhark_mc_segmap_parloop_236258_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236258_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236258_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236258_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236258_task);
    
    if (futhark_mc_segmap_parloop_236258_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236258_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236258_total_end -
                 futhark_mc_segmap_parloop_236258_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236258_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236258_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236258_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236256_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236256_end -
                 futhark_mc_segmap_task_236256_start;
        
        ctx->futhark_mc_segmap_task_236256_runs[tid]++;
        ctx->futhark_mc_segmap_task_236256_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236256_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236261 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_l_203501;
    int64_t free_partition_sizze_203577;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_y_205786;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_219761;
    unsigned char *free_ext_mem_219762;
    unsigned char *free_mem_219784;
};
struct futhark_mc_task_236264 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_l_203501;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_y_205786;
    int64_t free_gtid_213675;
    unsigned char *free_ext_mem_219761;
    unsigned char *free_ext_mem_219762;
    unsigned char *free_mem_219765;
};
struct futhark_mc_segmap_parloop_struct_236266 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_l_203501;
    int64_t free_l_n_m_203643;
    int64_t free_i_203670;
    int64_t free_y_205786;
    int64_t free_gtid_213675;
    unsigned char *free_ext_mem_219761;
    unsigned char *free_ext_mem_219762;
    unsigned char *free_mem_219765;
};
static int futhark_mc_segmap_parloop_236267(void *args, int64_t start,
                                            int64_t end, int flat_tid_231788,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236266
    *futhark_mc_segmap_parloop_struct_236266 =
    (struct futhark_mc_segmap_parloop_struct_236266 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236266->ctx;
    uint64_t futhark_mc_segmap_parloop_236267_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236267_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236266->free_n_203490;
    int64_t jump_l_203501 =
            futhark_mc_segmap_parloop_struct_236266->free_jump_l_203501;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236266->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236266->free_i_203670;
    int64_t y_205786 = futhark_mc_segmap_parloop_struct_236266->free_y_205786;
    int64_t gtid_213675 =
            futhark_mc_segmap_parloop_struct_236266->free_gtid_213675;
    struct memblock ext_mem_219761 = {.desc ="ext_mem_219761", .mem =
                                      futhark_mc_segmap_parloop_struct_236266->free_ext_mem_219761,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219762 = {.desc ="ext_mem_219762", .mem =
                                      futhark_mc_segmap_parloop_struct_236266->free_ext_mem_219762,
                                      .size =0, .references =NULL};
    struct memblock mem_219765 = {.desc ="mem_219765", .mem =
                                  futhark_mc_segmap_parloop_struct_236266->free_mem_219765,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231839 = start;
    
    for (; iter_231839 < end; iter_231839++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231841 = n_203490;
        int64_t gtid_231789 = iter_231839;
        int64_t remnant_231842 = iter_231839 - gtid_231789;
        int64_t m_v_231790 = sdiv64(gtid_231789, jump_l_203501);
        bool cond_231791 = m_v_231790 == y_205786;
        int64_t j_231792;
        
        if (cond_231791) {
            int64_t j_t_res_231840 = sub64(m_v_231790, (int64_t) 1);
            
            j_231792 = j_t_res_231840;
        } else {
            j_231792 = m_v_231790;
        }
        
        int64_t min_arg_231794 = mul64(jump_l_203501, j_231792);
        int64_t min_res_231795 = smin64(i_203670, min_arg_231794);
        int64_t defunc_0_m_fun_arg_231796 = add64((int64_t) 1, j_231792);
        int64_t min_arg_231797 = mul64(jump_l_203501,
                                       defunc_0_m_fun_arg_231796);
        int64_t min_res_231798 = smin64(i_203670, min_arg_231797);
        int64_t i64_arg_231799 = sub64(min_res_231798, min_res_231795);
        double i64_res_231800 = sitofp_i64_f64(i64_arg_231799);
        int64_t i64_arg_231801 = sub64(gtid_231789, min_res_231795);
        double i64_res_231802 = sitofp_i64_f64(i64_arg_231801);
        double u_231803 = i64_res_231802 / i64_res_231800;
        double u2_231804 = u_231803 * u_231803;
        double u3_231805 = u_231803 * u2_231804;
        double x_231806 = 2.0 * u3_231805;
        double y_231807 = 3.0 * u2_231804;
        double x_231808 = x_231806 - y_231807;
        double x_231809 = 1.0 + x_231808;
        bool x_231810 = sle64((int64_t) 0, j_231792);
        bool y_231811 = slt64(j_231792, l_n_m_203643);
        bool bounds_check_231812 = x_231810 && y_231811;
        bool index_certs_231813;
        
        if (!bounds_check_231812) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) j_231792,
                                   "] out of bounds for array of shape [",
                                   (long long) l_n_m_203643, "].",
                                   "-> #0  loess.fut:536:27-33\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:252:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:250:15-253:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        double y_231814;
        
        y_231814 = ((double *) ext_mem_219762.mem)[gtid_213675 * l_n_m_203643 +
                                                   j_231792];
        
        double x_231815 = x_231809 * y_231814;
        double x_231816 = y_231807 - x_231806;
        bool x_231817 = sle64((int64_t) 0, defunc_0_m_fun_arg_231796);
        bool y_231818 = slt64(defunc_0_m_fun_arg_231796, l_n_m_203643);
        bool bounds_check_231819 = x_231817 && y_231818;
        bool index_certs_231820;
        
        if (!bounds_check_231819) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [",
                                   (long long) defunc_0_m_fun_arg_231796,
                                   "] out of bounds for array of shape [",
                                   (long long) l_n_m_203643, "].",
                                   "-> #0  loess.fut:537:27-37\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:252:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:250:15-253:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        double y_231821;
        
        y_231821 = ((double *) ext_mem_219762.mem)[gtid_213675 * l_n_m_203643 +
                                                   defunc_0_m_fun_arg_231796];
        
        double y_231822 = x_231816 * y_231821;
        double x_231823 = x_231815 + y_231822;
        double y_231824 = 2.0 * u2_231804;
        double x_231825 = u3_231805 - y_231824;
        double x_231826 = u_231803 + x_231825;
        double y_231827;
        
        y_231827 = ((double *) ext_mem_219761.mem)[gtid_213675 * l_n_m_203643 +
                                                   j_231792];
        
        double x_231828 = x_231826 * y_231827;
        double y_231829 = i64_res_231800 * x_231828;
        double x_231830 = x_231823 + y_231829;
        double x_231831 = u3_231805 - u2_231804;
        double y_231832;
        
        y_231832 = ((double *) ext_mem_219761.mem)[gtid_213675 * l_n_m_203643 +
                                                   defunc_0_m_fun_arg_231796];
        
        double x_231833 = x_231831 * y_231832;
        double y_231834 = i64_res_231800 * x_231833;
        double defunc_4_interpolate_proc_res_231835 = x_231830 + y_231834;
        
        ((double *) mem_219765.mem)[gtid_231789] =
            defunc_4_interpolate_proc_res_231835;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236267_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236267_end -
                 futhark_mc_segmap_parloop_236267_start;
        
        ctx->futhark_mc_segmap_parloop_236267_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236267_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236267_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236265(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231788 = tid;
    int num_tasks_231838 = info.nsubtasks;
    struct futhark_mc_task_236264 *futhark_mc_task_236264 =
                                  (struct futhark_mc_task_236264 *) args;
    struct futhark_context *ctx = futhark_mc_task_236264->ctx;
    uint64_t futhark_mc_segmap_task_236265_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236265_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236264->free_n_203490;
    int64_t jump_l_203501 = futhark_mc_task_236264->free_jump_l_203501;
    int64_t l_n_m_203643 = futhark_mc_task_236264->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236264->free_i_203670;
    int64_t y_205786 = futhark_mc_task_236264->free_y_205786;
    int64_t gtid_213675 = futhark_mc_task_236264->free_gtid_213675;
    struct memblock ext_mem_219761 = {.desc ="ext_mem_219761", .mem =
                                      futhark_mc_task_236264->free_ext_mem_219761,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219762 = {.desc ="ext_mem_219762", .mem =
                                      futhark_mc_task_236264->free_ext_mem_219762,
                                      .size =0, .references =NULL};
    struct memblock mem_219765 = {.desc ="mem_219765", .mem =
                                  futhark_mc_task_236264->free_mem_219765,
                                  .size =0, .references =NULL};
    int64_t iter_231839;
    struct futhark_mc_segmap_parloop_struct_236266
    futhark_mc_segmap_parloop_struct_236266;
    
    futhark_mc_segmap_parloop_struct_236266.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236266.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236266.free_jump_l_203501 = jump_l_203501;
    futhark_mc_segmap_parloop_struct_236266.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236266.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236266.free_y_205786 = y_205786;
    futhark_mc_segmap_parloop_struct_236266.free_gtid_213675 = gtid_213675;
    futhark_mc_segmap_parloop_struct_236266.free_ext_mem_219761 =
        ext_mem_219761.mem;
    futhark_mc_segmap_parloop_struct_236266.free_ext_mem_219762 =
        ext_mem_219762.mem;
    futhark_mc_segmap_parloop_struct_236266.free_mem_219765 = mem_219765.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236267_task;
    
    futhark_mc_segmap_parloop_236267_task.name =
        "futhark_mc_segmap_parloop_236267";
    futhark_mc_segmap_parloop_236267_task.fn = futhark_mc_segmap_parloop_236267;
    futhark_mc_segmap_parloop_236267_task.args =
        &futhark_mc_segmap_parloop_struct_236266;
    futhark_mc_segmap_parloop_236267_task.iterations = iterations;
    futhark_mc_segmap_parloop_236267_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236267_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236267_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236267_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236267_task);
    
    if (futhark_mc_segmap_parloop_236267_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236267_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236267_total_end -
                 futhark_mc_segmap_parloop_236267_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236267_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236267_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236267_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236265_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236265_end -
                 futhark_mc_segmap_task_236265_start;
        
        ctx->futhark_mc_segmap_task_236265_runs[tid]++;
        ctx->futhark_mc_segmap_task_236265_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236265_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236262(void *args, int64_t start,
                                            int64_t end, int flat_tid_213674,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236261
    *futhark_mc_segmap_parloop_struct_236261 =
    (struct futhark_mc_segmap_parloop_struct_236261 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236261->ctx;
    uint64_t futhark_mc_segmap_parloop_236262_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236262_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236261->free_n_203490;
    int64_t jump_l_203501 =
            futhark_mc_segmap_parloop_struct_236261->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236261->free_partition_sizze_203577;
    int64_t l_n_m_203643 =
            futhark_mc_segmap_parloop_struct_236261->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236261->free_i_203670;
    int64_t y_205786 = futhark_mc_segmap_parloop_struct_236261->free_y_205786;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236261->free_bytes_217302;
    struct memblock ext_mem_219761 = {.desc ="ext_mem_219761", .mem =
                                      futhark_mc_segmap_parloop_struct_236261->free_ext_mem_219761,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219762 = {.desc ="ext_mem_219762", .mem =
                                      futhark_mc_segmap_parloop_struct_236261->free_ext_mem_219762,
                                      .size =0, .references =NULL};
    struct memblock mem_219784 = {.desc ="mem_219784", .mem =
                                  futhark_mc_segmap_parloop_struct_236261->free_mem_219784,
                                  .size =0, .references =NULL};
    size_t mem_219765_cached_sizze_236263 = 0;
    unsigned char *mem_219765 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231787 = start;
    
    if (mem_219765_cached_sizze_236263 < (size_t) bytes_217302) {
        mem_219765 = realloc(mem_219765, bytes_217302);
        mem_219765_cached_sizze_236263 = bytes_217302;
    }
    for (; iter_231787 < end; iter_231787++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231836 = partition_sizze_203577;
        int64_t gtid_213675 = iter_231787;
        int64_t remnant_231837 = iter_231787 - gtid_213675;
        int64_t flat_tid_231788 = (int64_t) 0;
        int32_t num_tasks_231838;
        struct futhark_mc_task_236264 futhark_mc_task_236264;
        
        futhark_mc_task_236264.ctx = ctx;
        futhark_mc_task_236264.free_n_203490 = n_203490;
        futhark_mc_task_236264.free_jump_l_203501 = jump_l_203501;
        futhark_mc_task_236264.free_l_n_m_203643 = l_n_m_203643;
        futhark_mc_task_236264.free_i_203670 = i_203670;
        futhark_mc_task_236264.free_y_205786 = y_205786;
        futhark_mc_task_236264.free_gtid_213675 = gtid_213675;
        futhark_mc_task_236264.free_ext_mem_219761 = ext_mem_219761.mem;
        futhark_mc_task_236264.free_ext_mem_219762 = ext_mem_219762.mem;
        futhark_mc_task_236264.free_mem_219765 = mem_219765;
        
        struct scheduler_segop futhark_mc_task_236264_task;
        
        futhark_mc_task_236264_task.args = &futhark_mc_task_236264;
        futhark_mc_task_236264_task.top_level_fn =
            futhark_mc_segmap_task_236265;
        futhark_mc_task_236264_task.name = "futhark_mc_segmap_task_236265";
        futhark_mc_task_236264_task.iterations = n_203490;
        futhark_mc_task_236264_task.task_time =
            &ctx->futhark_mc_segmap_task_236265_total_time;
        futhark_mc_task_236264_task.task_iter =
            &ctx->futhark_mc_segmap_task_236265_total_iter;
        futhark_mc_task_236264_task.sched = STATIC;
        futhark_mc_task_236264_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236265_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236264_task);
        
        if (futhark_mc_segmap_task_236265_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_219784.mem + gtid_213675 * n_203490 * (int64_t) 8,
                    mem_219765 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219765);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236262_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236262_end -
                 futhark_mc_segmap_parloop_236262_start;
        
        ctx->futhark_mc_segmap_parloop_236262_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236262_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236262_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236260(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213674 = tid;
    int num_tasks_231733 = info.nsubtasks;
    struct futhark_mc_task_236255 *futhark_mc_task_236255 =
                                  (struct futhark_mc_task_236255 *) args;
    struct futhark_context *ctx = futhark_mc_task_236255->ctx;
    uint64_t futhark_mc_segmap_nested_task_236260_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236260_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236255->free_n_203490;
    int64_t jump_l_203501 = futhark_mc_task_236255->free_jump_l_203501;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236255->free_partition_sizze_203577;
    int64_t l_n_m_203643 = futhark_mc_task_236255->free_l_n_m_203643;
    int64_t i_203670 = futhark_mc_task_236255->free_i_203670;
    int64_t y_205786 = futhark_mc_task_236255->free_y_205786;
    int64_t bytes_217302 = futhark_mc_task_236255->free_bytes_217302;
    struct memblock ext_mem_219761 = {.desc ="ext_mem_219761", .mem =
                                      futhark_mc_task_236255->free_ext_mem_219761,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219762 = {.desc ="ext_mem_219762", .mem =
                                      futhark_mc_task_236255->free_ext_mem_219762,
                                      .size =0, .references =NULL};
    struct memblock mem_219784 = {.desc ="mem_219784", .mem =
                                  futhark_mc_task_236255->free_mem_219784,
                                  .size =0, .references =NULL};
    int64_t iter_231787;
    struct futhark_mc_segmap_parloop_struct_236261
    futhark_mc_segmap_parloop_struct_236261;
    
    futhark_mc_segmap_parloop_struct_236261.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236261.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236261.free_jump_l_203501 = jump_l_203501;
    futhark_mc_segmap_parloop_struct_236261.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236261.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_segmap_parloop_struct_236261.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236261.free_y_205786 = y_205786;
    futhark_mc_segmap_parloop_struct_236261.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236261.free_ext_mem_219761 =
        ext_mem_219761.mem;
    futhark_mc_segmap_parloop_struct_236261.free_ext_mem_219762 =
        ext_mem_219762.mem;
    futhark_mc_segmap_parloop_struct_236261.free_mem_219784 = mem_219784.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236262_task;
    
    futhark_mc_segmap_parloop_236262_task.name =
        "futhark_mc_segmap_parloop_236262";
    futhark_mc_segmap_parloop_236262_task.fn = futhark_mc_segmap_parloop_236262;
    futhark_mc_segmap_parloop_236262_task.args =
        &futhark_mc_segmap_parloop_struct_236261;
    futhark_mc_segmap_parloop_236262_task.iterations = iterations;
    futhark_mc_segmap_parloop_236262_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236262_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236262_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236262_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236262_task);
    
    if (futhark_mc_segmap_parloop_236262_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236262_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236262_total_end -
                 futhark_mc_segmap_parloop_236262_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236262_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236262_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236262_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236260_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236260_end -
                 futhark_mc_segmap_nested_task_236260_start;
        
        ctx->futhark_mc_segmap_nested_task_236260_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236260_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236260_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236268 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_bytes_217302;
    unsigned char *free_mem_219218;
    unsigned char *free_ext_mem_219785;
    int64_t free_ext_219786;
    unsigned char *free_mem_219808;
};
struct futhark_mc_segmap_parloop_struct_236270 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_bytes_217302;
    unsigned char *free_mem_219218;
    unsigned char *free_ext_mem_219785;
    int64_t free_ext_219786;
    unsigned char *free_mem_219808;
};
static int futhark_mc_segmap_parloop_236271(void *args, int64_t start,
                                            int64_t end, int flat_tid_213728,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236270
    *futhark_mc_segmap_parloop_struct_236270 =
    (struct futhark_mc_segmap_parloop_struct_236270 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236270->ctx;
    uint64_t futhark_mc_segmap_parloop_236271_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236271_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236270->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_236270->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236270->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_236270->free_C_len_203634;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236270->free_bytes_217302;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_236270->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219785 = {.desc ="ext_mem_219785", .mem =
                                      futhark_mc_segmap_parloop_struct_236270->free_ext_mem_219785,
                                      .size =0, .references =NULL};
    int64_t ext_219786 =
            futhark_mc_segmap_parloop_struct_236270->free_ext_219786;
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236270->free_mem_219808,
                                  .size =0, .references =NULL};
    size_t mem_219792_cached_sizze_236272 = 0;
    unsigned char *mem_219792 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231844 = start;
    
    if (mem_219792_cached_sizze_236272 < (size_t) bytes_217302) {
        mem_219792 = realloc(mem_219792, bytes_217302);
        mem_219792_cached_sizze_236272 = bytes_217302;
    }
    for (; iter_231844 < end; iter_231844++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231852 = partition_sizze_203577;
        int64_t gtid_213729 = iter_231844;
        int64_t remnant_231853 = iter_231844 - gtid_213729;
        
        for (int64_t i_231845 = 0; i_231845 < n_203490; i_231845++) {
            int64_t slice_231847 = n_p_203492 + i_231845;
            double x_231848;
            
            x_231848 = ((double *) mem_219218.mem)[gtid_213729 * C_len_203634 +
                                                   slice_231847];
            
            double x_231849;
            
            x_231849 = ((double *) ext_mem_219785.mem)[gtid_213729 *
                                                       ext_219786 + i_231845];
            
            double defunc_1_f_res_231850 = x_231848 - x_231849;
            
            ((double *) mem_219792)[i_231845] = defunc_1_f_res_231850;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_219808.mem + gtid_213729 * n_203490 * (int64_t) 8,
                    mem_219792 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219792);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236271_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236271_end -
                 futhark_mc_segmap_parloop_236271_start;
        
        ctx->futhark_mc_segmap_parloop_236271_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236271_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236271_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236269(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213728 = tid;
    int num_tasks_231843 = info.nsubtasks;
    struct futhark_mc_task_236268 *futhark_mc_task_236268 =
                                  (struct futhark_mc_task_236268 *) args;
    struct futhark_context *ctx = futhark_mc_task_236268->ctx;
    uint64_t futhark_mc_segmap_task_236269_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236269_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236268->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_236268->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236268->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_236268->free_C_len_203634;
    int64_t bytes_217302 = futhark_mc_task_236268->free_bytes_217302;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_236268->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219785 = {.desc ="ext_mem_219785", .mem =
                                      futhark_mc_task_236268->free_ext_mem_219785,
                                      .size =0, .references =NULL};
    int64_t ext_219786 = futhark_mc_task_236268->free_ext_219786;
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236268->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t iter_231844;
    struct futhark_mc_segmap_parloop_struct_236270
    futhark_mc_segmap_parloop_struct_236270;
    
    futhark_mc_segmap_parloop_struct_236270.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236270.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236270.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_236270.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236270.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_236270.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236270.free_mem_219218 = mem_219218.mem;
    futhark_mc_segmap_parloop_struct_236270.free_ext_mem_219785 =
        ext_mem_219785.mem;
    futhark_mc_segmap_parloop_struct_236270.free_ext_219786 = ext_219786;
    futhark_mc_segmap_parloop_struct_236270.free_mem_219808 = mem_219808.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236271_task;
    
    futhark_mc_segmap_parloop_236271_task.name =
        "futhark_mc_segmap_parloop_236271";
    futhark_mc_segmap_parloop_236271_task.fn = futhark_mc_segmap_parloop_236271;
    futhark_mc_segmap_parloop_236271_task.args =
        &futhark_mc_segmap_parloop_struct_236270;
    futhark_mc_segmap_parloop_236271_task.iterations = iterations;
    futhark_mc_segmap_parloop_236271_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236271_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236271_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236271_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236271_task);
    
    if (futhark_mc_segmap_parloop_236271_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236271_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236271_total_end -
                 futhark_mc_segmap_parloop_236271_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236271_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236271_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236271_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236269_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236269_end -
                 futhark_mc_segmap_task_236269_start;
        
        ctx->futhark_mc_segmap_task_236269_runs[tid]++;
        ctx->futhark_mc_segmap_task_236269_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236269_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236274 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_partition_sizze_203577;
    int64_t free_C_len_203634;
    int64_t free_bytes_217302;
    unsigned char *free_mem_219218;
    unsigned char *free_ext_mem_219785;
    int64_t free_ext_219786;
    unsigned char *free_mem_219808;
};
struct futhark_mc_task_236277 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_C_len_203634;
    int64_t free_gtid_213735;
    unsigned char *free_mem_219218;
    unsigned char *free_ext_mem_219785;
    int64_t free_ext_219786;
    unsigned char *free_mem_219789;
};
struct futhark_mc_segmap_parloop_struct_236279 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_n_p_203492;
    int64_t free_C_len_203634;
    int64_t free_gtid_213735;
    unsigned char *free_mem_219218;
    unsigned char *free_ext_mem_219785;
    int64_t free_ext_219786;
    unsigned char *free_mem_219789;
};
static int futhark_mc_segmap_parloop_236280(void *args, int64_t start,
                                            int64_t end, int flat_tid_231856,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236279
    *futhark_mc_segmap_parloop_struct_236279 =
    (struct futhark_mc_segmap_parloop_struct_236279 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236279->ctx;
    uint64_t futhark_mc_segmap_parloop_236280_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236280_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236279->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_236279->free_n_p_203492;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_236279->free_C_len_203634;
    int64_t gtid_213735 =
            futhark_mc_segmap_parloop_struct_236279->free_gtid_213735;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_236279->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219785 = {.desc ="ext_mem_219785", .mem =
                                      futhark_mc_segmap_parloop_struct_236279->free_ext_mem_219785,
                                      .size =0, .references =NULL};
    int64_t ext_219786 =
            futhark_mc_segmap_parloop_struct_236279->free_ext_219786;
    struct memblock mem_219789 = {.desc ="mem_219789", .mem =
                                  futhark_mc_segmap_parloop_struct_236279->free_mem_219789,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231865 = start;
    
    for (; iter_231865 < end; iter_231865++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231866 = n_203490;
        int64_t gtid_231857 = iter_231865;
        int64_t remnant_231867 = iter_231865 - gtid_231857;
        int64_t slice_231858 = n_p_203492 + gtid_231857;
        double x_231859;
        
        x_231859 = ((double *) mem_219218.mem)[gtid_213735 * C_len_203634 +
                                               slice_231858];
        
        double x_231860;
        
        x_231860 = ((double *) ext_mem_219785.mem)[gtid_213735 * ext_219786 +
                                                   gtid_231857];
        
        double defunc_1_f_res_231861 = x_231859 - x_231860;
        
        ((double *) mem_219789.mem)[gtid_231857] = defunc_1_f_res_231861;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236280_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236280_end -
                 futhark_mc_segmap_parloop_236280_start;
        
        ctx->futhark_mc_segmap_parloop_236280_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236280_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236280_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236278(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231856 = tid;
    int num_tasks_231864 = info.nsubtasks;
    struct futhark_mc_task_236277 *futhark_mc_task_236277 =
                                  (struct futhark_mc_task_236277 *) args;
    struct futhark_context *ctx = futhark_mc_task_236277->ctx;
    uint64_t futhark_mc_segmap_task_236278_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236278_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236277->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_236277->free_n_p_203492;
    int64_t C_len_203634 = futhark_mc_task_236277->free_C_len_203634;
    int64_t gtid_213735 = futhark_mc_task_236277->free_gtid_213735;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_236277->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219785 = {.desc ="ext_mem_219785", .mem =
                                      futhark_mc_task_236277->free_ext_mem_219785,
                                      .size =0, .references =NULL};
    int64_t ext_219786 = futhark_mc_task_236277->free_ext_219786;
    struct memblock mem_219789 = {.desc ="mem_219789", .mem =
                                  futhark_mc_task_236277->free_mem_219789,
                                  .size =0, .references =NULL};
    int64_t iter_231865;
    struct futhark_mc_segmap_parloop_struct_236279
    futhark_mc_segmap_parloop_struct_236279;
    
    futhark_mc_segmap_parloop_struct_236279.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236279.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236279.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_236279.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_236279.free_gtid_213735 = gtid_213735;
    futhark_mc_segmap_parloop_struct_236279.free_mem_219218 = mem_219218.mem;
    futhark_mc_segmap_parloop_struct_236279.free_ext_mem_219785 =
        ext_mem_219785.mem;
    futhark_mc_segmap_parloop_struct_236279.free_ext_219786 = ext_219786;
    futhark_mc_segmap_parloop_struct_236279.free_mem_219789 = mem_219789.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236280_task;
    
    futhark_mc_segmap_parloop_236280_task.name =
        "futhark_mc_segmap_parloop_236280";
    futhark_mc_segmap_parloop_236280_task.fn = futhark_mc_segmap_parloop_236280;
    futhark_mc_segmap_parloop_236280_task.args =
        &futhark_mc_segmap_parloop_struct_236279;
    futhark_mc_segmap_parloop_236280_task.iterations = iterations;
    futhark_mc_segmap_parloop_236280_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236280_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236280_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236280_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236280_task);
    
    if (futhark_mc_segmap_parloop_236280_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236280_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236280_total_end -
                 futhark_mc_segmap_parloop_236280_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236280_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236280_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236280_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236278_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236278_end -
                 futhark_mc_segmap_task_236278_start;
        
        ctx->futhark_mc_segmap_task_236278_runs[tid]++;
        ctx->futhark_mc_segmap_task_236278_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236278_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236275(void *args, int64_t start,
                                            int64_t end, int flat_tid_213734,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236274
    *futhark_mc_segmap_parloop_struct_236274 =
    (struct futhark_mc_segmap_parloop_struct_236274 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236274->ctx;
    uint64_t futhark_mc_segmap_parloop_236275_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236275_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236274->free_n_203490;
    int64_t n_p_203492 =
            futhark_mc_segmap_parloop_struct_236274->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236274->free_partition_sizze_203577;
    int64_t C_len_203634 =
            futhark_mc_segmap_parloop_struct_236274->free_C_len_203634;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236274->free_bytes_217302;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_segmap_parloop_struct_236274->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219785 = {.desc ="ext_mem_219785", .mem =
                                      futhark_mc_segmap_parloop_struct_236274->free_ext_mem_219785,
                                      .size =0, .references =NULL};
    int64_t ext_219786 =
            futhark_mc_segmap_parloop_struct_236274->free_ext_219786;
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236274->free_mem_219808,
                                  .size =0, .references =NULL};
    size_t mem_219789_cached_sizze_236276 = 0;
    unsigned char *mem_219789 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231855 = start;
    
    if (mem_219789_cached_sizze_236276 < (size_t) bytes_217302) {
        mem_219789 = realloc(mem_219789, bytes_217302);
        mem_219789_cached_sizze_236276 = bytes_217302;
    }
    for (; iter_231855 < end; iter_231855++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231862 = partition_sizze_203577;
        int64_t gtid_213735 = iter_231855;
        int64_t remnant_231863 = iter_231855 - gtid_213735;
        int64_t flat_tid_231856 = (int64_t) 0;
        int32_t num_tasks_231864;
        struct futhark_mc_task_236277 futhark_mc_task_236277;
        
        futhark_mc_task_236277.ctx = ctx;
        futhark_mc_task_236277.free_n_203490 = n_203490;
        futhark_mc_task_236277.free_n_p_203492 = n_p_203492;
        futhark_mc_task_236277.free_C_len_203634 = C_len_203634;
        futhark_mc_task_236277.free_gtid_213735 = gtid_213735;
        futhark_mc_task_236277.free_mem_219218 = mem_219218.mem;
        futhark_mc_task_236277.free_ext_mem_219785 = ext_mem_219785.mem;
        futhark_mc_task_236277.free_ext_219786 = ext_219786;
        futhark_mc_task_236277.free_mem_219789 = mem_219789;
        
        struct scheduler_segop futhark_mc_task_236277_task;
        
        futhark_mc_task_236277_task.args = &futhark_mc_task_236277;
        futhark_mc_task_236277_task.top_level_fn =
            futhark_mc_segmap_task_236278;
        futhark_mc_task_236277_task.name = "futhark_mc_segmap_task_236278";
        futhark_mc_task_236277_task.iterations = n_203490;
        futhark_mc_task_236277_task.task_time =
            &ctx->futhark_mc_segmap_task_236278_total_time;
        futhark_mc_task_236277_task.task_iter =
            &ctx->futhark_mc_segmap_task_236278_total_iter;
        futhark_mc_task_236277_task.sched = STATIC;
        futhark_mc_task_236277_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236278_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236277_task);
        
        if (futhark_mc_segmap_task_236278_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_219808.mem + gtid_213735 * n_203490 * (int64_t) 8,
                    mem_219789 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219789);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236275_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236275_end -
                 futhark_mc_segmap_parloop_236275_start;
        
        ctx->futhark_mc_segmap_parloop_236275_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236275_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236275_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236273(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213734 = tid;
    int num_tasks_231843 = info.nsubtasks;
    struct futhark_mc_task_236268 *futhark_mc_task_236268 =
                                  (struct futhark_mc_task_236268 *) args;
    struct futhark_context *ctx = futhark_mc_task_236268->ctx;
    uint64_t futhark_mc_segmap_nested_task_236273_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236273_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236268->free_n_203490;
    int64_t n_p_203492 = futhark_mc_task_236268->free_n_p_203492;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236268->free_partition_sizze_203577;
    int64_t C_len_203634 = futhark_mc_task_236268->free_C_len_203634;
    int64_t bytes_217302 = futhark_mc_task_236268->free_bytes_217302;
    struct memblock mem_219218 = {.desc ="mem_219218", .mem =
                                  futhark_mc_task_236268->free_mem_219218,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219785 = {.desc ="ext_mem_219785", .mem =
                                      futhark_mc_task_236268->free_ext_mem_219785,
                                      .size =0, .references =NULL};
    int64_t ext_219786 = futhark_mc_task_236268->free_ext_219786;
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236268->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t iter_231855;
    struct futhark_mc_segmap_parloop_struct_236274
    futhark_mc_segmap_parloop_struct_236274;
    
    futhark_mc_segmap_parloop_struct_236274.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236274.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236274.free_n_p_203492 = n_p_203492;
    futhark_mc_segmap_parloop_struct_236274.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236274.free_C_len_203634 = C_len_203634;
    futhark_mc_segmap_parloop_struct_236274.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236274.free_mem_219218 = mem_219218.mem;
    futhark_mc_segmap_parloop_struct_236274.free_ext_mem_219785 =
        ext_mem_219785.mem;
    futhark_mc_segmap_parloop_struct_236274.free_ext_219786 = ext_219786;
    futhark_mc_segmap_parloop_struct_236274.free_mem_219808 = mem_219808.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236275_task;
    
    futhark_mc_segmap_parloop_236275_task.name =
        "futhark_mc_segmap_parloop_236275";
    futhark_mc_segmap_parloop_236275_task.fn = futhark_mc_segmap_parloop_236275;
    futhark_mc_segmap_parloop_236275_task.args =
        &futhark_mc_segmap_parloop_struct_236274;
    futhark_mc_segmap_parloop_236275_task.iterations = iterations;
    futhark_mc_segmap_parloop_236275_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236275_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236275_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236275_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236275_task);
    
    if (futhark_mc_segmap_parloop_236275_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236275_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236275_total_end -
                 futhark_mc_segmap_parloop_236275_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236275_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236275_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236275_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236273_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236273_end -
                 futhark_mc_segmap_nested_task_236273_start;
        
        ctx->futhark_mc_segmap_nested_task_236273_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236273_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236273_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236281 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219888;
};
struct futhark_mc_segmap_parloop_struct_236283 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219888;
};
static int futhark_mc_segmap_parloop_236284(void *args, int64_t start,
                                            int64_t end, int flat_tid_213744,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236283
    *futhark_mc_segmap_parloop_struct_236283 =
    (struct futhark_mc_segmap_parloop_struct_236283 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236283->ctx;
    uint64_t futhark_mc_segmap_parloop_236284_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236284_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236283->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236283->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236283->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236283->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236283->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236283->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236283->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236283->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236283->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236283->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236283->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236283->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236283->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236283->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236283->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236283->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236283->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236283->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219888 = {.desc ="mem_219888", .mem =
                                  futhark_mc_segmap_parloop_struct_236283->free_mem_219888,
                                  .size =0, .references =NULL};
    size_t mem_219827_cached_sizze_236285 = 0;
    unsigned char *mem_219827 = NULL;
    size_t mem_219842_cached_sizze_236286 = 0;
    unsigned char *mem_219842 = NULL;
    size_t mem_219845_cached_sizze_236287 = 0;
    unsigned char *mem_219845 = NULL;
    size_t mem_219872_cached_sizze_236288 = 0;
    unsigned char *mem_219872 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231871 = start;
    
    if (mem_219827_cached_sizze_236285 < (size_t) bytes_217302) {
        mem_219827 = realloc(mem_219827, bytes_217302);
        mem_219827_cached_sizze_236285 = bytes_217302;
    }
    if (mem_219842_cached_sizze_236286 < (size_t) bytes_217302) {
        mem_219842 = realloc(mem_219842, bytes_217302);
        mem_219842_cached_sizze_236286 = bytes_217302;
    }
    if (mem_219845_cached_sizze_236287 < (size_t) bytes_217302) {
        mem_219845 = realloc(mem_219845, bytes_217302);
        mem_219845_cached_sizze_236287 = bytes_217302;
    }
    if (mem_219872_cached_sizze_236288 < (size_t) bytes_217782) {
        mem_219872 = realloc(mem_219872, bytes_217782);
        mem_219872_cached_sizze_236288 = bytes_217782;
    }
    for (; iter_231871 < end; iter_231871++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231953 = partition_sizze_203577;
        int64_t gtid_213745 = iter_231871;
        int64_t remnant_231954 = iter_231871 - gtid_213745;
        int64_t x_205861;
        
        x_205861 = ((int64_t *) mem_217343.mem)[gtid_213745];
        for (int64_t i_231872 = 0; i_231872 < n_203490; i_231872++) {
            double x_231874;
            
            x_231874 = ((double *) mem_217297.mem)[gtid_213745 * n_203490 +
                                                   i_231872];
            
            double x_231875;
            
            x_231875 = ((double *) mem_219808.mem)[gtid_213745 * n_203490 +
                                                   i_231872];
            
            double defunc_1_f_res_231876 = x_231874 - x_231875;
            
            ((double *) mem_219827)[i_231872] = defunc_1_f_res_231876;
        }
        for (int64_t i_231878 = 0; i_231878 < n_203490; i_231878++) {
            int64_t x_231881;
            
            x_231881 = ((int64_t *) mem_217340.mem)[gtid_213745 * n_203490 +
                                                    i_231878];
            
            bool cond_231882 = sle64((int64_t) 0, x_231881);
            double defunc_0_f_res_231883;
            
            if (cond_231882) {
                bool y_231884 = slt64(x_231881, n_203490);
                bool bounds_check_231885 = cond_231882 && y_231884;
                bool index_certs_231886;
                
                if (!bounds_check_231885) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_231881,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_231887;
                
                defunc_0_f_res_t_res_231887 = ((double *) mem_219827)[x_231881];
                defunc_0_f_res_231883 = defunc_0_f_res_t_res_231887;
            } else {
                defunc_0_f_res_231883 = 0.0;
            }
            
            double defunc_0_f_res_231888;
            
            if (cond_231882) {
                bool y_231889 = slt64(x_231881, n_203490);
                bool bounds_check_231890 = cond_231882 && y_231889;
                bool index_certs_231891;
                
                if (!bounds_check_231890) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_231881,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_231892;
                
                defunc_0_f_res_t_res_231892 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_213745 *
                                                       ctx_param_ext_217867 +
                                                       x_231881 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_231888 = defunc_0_f_res_t_res_231892;
            } else {
                defunc_0_f_res_231888 = 0.0;
            }
            ((double *) mem_219842)[i_231878] = defunc_0_f_res_231888;
            ((double *) mem_219845)[i_231878] = defunc_0_f_res_231883;
        }
        for (int64_t i_231895 = 0; i_231895 < t_n_m_203650; i_231895++) {
            int64_t x_231897;
            
            x_231897 = ((int64_t *) mem_217835.mem)[gtid_213745 * t_n_m_203650 +
                                                    i_231895];
            
            double x_231898;
            
            x_231898 = ((double *) mem_217839.mem)[gtid_213745 * t_n_m_203650 +
                                                   i_231895];
            
            int64_t min_arg_231899 = mul64(jump_t_203500, i_231895);
            int64_t min_res_231900 = smin64(i_203670, min_arg_231899);
            int64_t defunc_0_g_res_231901 = add64((int64_t) 1, min_res_231900);
            double defunc_2_reduce_res_231902;
            double redout_231904 = 0.0;
            
            for (int64_t i_231903 = 0; i_231903 < q_t_203494; i_231903++) {
                bool cond_231905 = sle64(x_205861, i_231903);
                int64_t defunc_0_f_res_231906;
                
                if (cond_231905) {
                    defunc_0_f_res_231906 = (int64_t) 0;
                } else {
                    int64_t i_231907 = add64(x_231897, i_231903);
                    int64_t defunc_0_add_arg_231908;
                    
                    defunc_0_add_arg_231908 =
                        ((int64_t *) mem_217340.mem)[gtid_213745 * n_203490 +
                                                     i_231907];
                    
                    int64_t defunc_1_add_res_231909 = add64((int64_t) 1,
                                                            defunc_0_add_arg_231908);
                    
                    defunc_0_f_res_231906 = defunc_1_add_res_231909;
                }
                
                double defunc_0_f_res_231910;
                
                if (cond_231905) {
                    defunc_0_f_res_231910 = 0.0;
                } else {
                    int64_t i_231911 = add64(x_231897, i_231903);
                    double defunc_0_add_arg_231912;
                    
                    defunc_0_add_arg_231912 = ((double *) mem_219842)[i_231911];
                    defunc_0_f_res_231910 = defunc_0_add_arg_231912;
                }
                
                int64_t binop_p_231913 = sub64(defunc_0_f_res_231906,
                                               defunc_0_g_res_231901);
                double defunc_0_f_res_231914 = sitofp_i64_f64(binop_p_231913);
                double abs_res_231915 = fabs(defunc_0_f_res_231914);
                double tmp1_231916 = abs_res_231915 / x_231898;
                double x_231917 = tmp1_231916 * tmp1_231916;
                double y_231918 = tmp1_231916 * x_231917;
                double tmp2_231919 = 1.0 - y_231918;
                double x_231920 = tmp2_231919 * tmp2_231919;
                double tmp3_231921 = tmp2_231919 * x_231920;
                double w_j_231922 = defunc_0_f_res_231910 * tmp3_231921;
                double defunc_1_op_res_231923 = w_j_231922 + redout_231904;
                double redout_tmp_231959 = defunc_1_op_res_231923;
                
                redout_231904 = redout_tmp_231959;
            }
            defunc_2_reduce_res_231902 = redout_231904;
            
            double a0_231924 = 1.0 / defunc_2_reduce_res_231902;
            double defunc_2_reduce_res_231925;
            double redout_231927 = 0.0;
            
            for (int64_t i_231926 = 0; i_231926 < q_t_203494; i_231926++) {
                bool cond_231928 = sle64(x_205861, i_231926);
                int64_t defunc_0_f_res_231929;
                
                if (cond_231928) {
                    defunc_0_f_res_231929 = (int64_t) 0;
                } else {
                    int64_t i_231930 = add64(x_231897, i_231926);
                    int64_t defunc_0_add_arg_231931;
                    
                    defunc_0_add_arg_231931 =
                        ((int64_t *) mem_217340.mem)[gtid_213745 * n_203490 +
                                                     i_231930];
                    
                    int64_t defunc_1_add_res_231932 = add64((int64_t) 1,
                                                            defunc_0_add_arg_231931);
                    
                    defunc_0_f_res_231929 = defunc_1_add_res_231932;
                }
                
                double defunc_0_f_res_231933;
                
                if (cond_231928) {
                    defunc_0_f_res_231933 = 0.0;
                } else {
                    int64_t i_231934 = add64(x_231897, i_231926);
                    double defunc_0_add_arg_231935;
                    
                    defunc_0_add_arg_231935 = ((double *) mem_219842)[i_231934];
                    defunc_0_f_res_231933 = defunc_0_add_arg_231935;
                }
                
                int64_t binop_p_231936 = sub64(defunc_0_f_res_231929,
                                               defunc_0_g_res_231901);
                double defunc_0_f_res_231937 = sitofp_i64_f64(binop_p_231936);
                double abs_res_231938 = fabs(defunc_0_f_res_231937);
                double tmp1_231939 = abs_res_231938 / x_231898;
                double x_231940 = tmp1_231939 * tmp1_231939;
                double y_231941 = tmp1_231939 * x_231940;
                double tmp2_231942 = 1.0 - y_231941;
                double x_231943 = tmp2_231942 * tmp2_231942;
                double tmp3_231944 = tmp2_231942 * x_231943;
                double tmp4_231945 = defunc_0_f_res_231933 * tmp3_231944;
                double defunc_0_f_res_231946;
                
                if (cond_231928) {
                    defunc_0_f_res_231946 = 0.0;
                } else {
                    int64_t i_231947 = add64(x_231897, i_231926);
                    double defunc_0_add_arg_231948;
                    
                    defunc_0_add_arg_231948 = ((double *) mem_219845)[i_231947];
                    defunc_0_f_res_231946 = defunc_0_add_arg_231948;
                }
                
                double x_231949 = a0_231924 * tmp4_231945;
                double defunc_9_fit_fun_res_231950 = defunc_0_f_res_231946 *
                       x_231949;
                double defunc_1_op_res_231951 = defunc_9_fit_fun_res_231950 +
                       redout_231927;
                double redout_tmp_231960 = defunc_1_op_res_231951;
                
                redout_231927 = redout_tmp_231960;
            }
            defunc_2_reduce_res_231925 = redout_231927;
            ((double *) mem_219872)[i_231895] = defunc_2_reduce_res_231925;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_219888.mem + gtid_213745 * t_n_m_203650 * (int64_t) 8,
                    mem_219872 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219827);
    free(mem_219842);
    free(mem_219845);
    free(mem_219872);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236284_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236284_end -
                 futhark_mc_segmap_parloop_236284_start;
        
        ctx->futhark_mc_segmap_parloop_236284_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236284_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236284_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236282(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213744 = tid;
    int num_tasks_231870 = info.nsubtasks;
    struct futhark_mc_task_236281 *futhark_mc_task_236281 =
                                  (struct futhark_mc_task_236281 *) args;
    struct futhark_context *ctx = futhark_mc_task_236281->ctx;
    uint64_t futhark_mc_segmap_task_236282_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236282_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236281->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236281->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236281->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236281->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236281->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236281->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236281->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236281->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236281->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236281->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236281->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236281->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236281->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236281->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236281->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236281->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236281->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236281->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219888 = {.desc ="mem_219888", .mem =
                                  futhark_mc_task_236281->free_mem_219888,
                                  .size =0, .references =NULL};
    int64_t iter_231871;
    struct futhark_mc_segmap_parloop_struct_236283
    futhark_mc_segmap_parloop_struct_236283;
    
    futhark_mc_segmap_parloop_struct_236283.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236283.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236283.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236283.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236283.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236283.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236283.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236283.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236283.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236283.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236283.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236283.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236283.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236283.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236283.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236283.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236283.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236283.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236283.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236283.free_mem_219888 = mem_219888.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236284_task;
    
    futhark_mc_segmap_parloop_236284_task.name =
        "futhark_mc_segmap_parloop_236284";
    futhark_mc_segmap_parloop_236284_task.fn = futhark_mc_segmap_parloop_236284;
    futhark_mc_segmap_parloop_236284_task.args =
        &futhark_mc_segmap_parloop_struct_236283;
    futhark_mc_segmap_parloop_236284_task.iterations = iterations;
    futhark_mc_segmap_parloop_236284_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236284_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236284_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236284_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236284_task);
    
    if (futhark_mc_segmap_parloop_236284_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236284_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236284_total_end -
                 futhark_mc_segmap_parloop_236284_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236284_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236284_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236284_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236282_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236282_end -
                 futhark_mc_segmap_task_236282_start;
        
        ctx->futhark_mc_segmap_task_236282_runs[tid]++;
        ctx->futhark_mc_segmap_task_236282_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236282_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236290 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219888;
};
struct futhark_mc_task_236296 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219815;
};
struct futhark_mc_segmap_parloop_struct_236298 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219815;
};
static int futhark_mc_segmap_parloop_236299(void *args, int64_t start,
                                            int64_t end, int flat_tid_231962,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236298
    *futhark_mc_segmap_parloop_struct_236298 =
    (struct futhark_mc_segmap_parloop_struct_236298 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236298->ctx;
    uint64_t futhark_mc_segmap_parloop_236299_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236299_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236298->free_n_203490;
    int64_t gtid_213825 =
            futhark_mc_segmap_parloop_struct_236298->free_gtid_213825;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236298->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236298->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219815 = {.desc ="mem_219815", .mem =
                                  futhark_mc_segmap_parloop_struct_236298->free_mem_219815,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232102 = start;
    
    for (; iter_232102 < end; iter_232102++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232103 = n_203490;
        int64_t gtid_231963 = iter_232102;
        int64_t remnant_232104 = iter_232102 - gtid_231963;
        double x_231964;
        
        x_231964 = ((double *) mem_217297.mem)[gtid_213825 * n_203490 +
                                               gtid_231963];
        
        double x_231965;
        
        x_231965 = ((double *) mem_219808.mem)[gtid_213825 * n_203490 +
                                               gtid_231963];
        
        double defunc_1_f_res_231966 = x_231964 - x_231965;
        
        ((double *) mem_219815.mem)[gtid_231963] = defunc_1_f_res_231966;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236299_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236299_end -
                 futhark_mc_segmap_parloop_236299_start;
        
        ctx->futhark_mc_segmap_parloop_236299_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236299_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236299_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236297(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231962 = tid;
    int num_tasks_232101 = info.nsubtasks;
    struct futhark_mc_task_236296 *futhark_mc_task_236296 =
                                  (struct futhark_mc_task_236296 *) args;
    struct futhark_context *ctx = futhark_mc_task_236296->ctx;
    uint64_t futhark_mc_segmap_task_236297_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236297_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236296->free_n_203490;
    int64_t gtid_213825 = futhark_mc_task_236296->free_gtid_213825;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236296->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236296->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219815 = {.desc ="mem_219815", .mem =
                                  futhark_mc_task_236296->free_mem_219815,
                                  .size =0, .references =NULL};
    int64_t iter_232102;
    struct futhark_mc_segmap_parloop_struct_236298
    futhark_mc_segmap_parloop_struct_236298;
    
    futhark_mc_segmap_parloop_struct_236298.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236298.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236298.free_gtid_213825 = gtid_213825;
    futhark_mc_segmap_parloop_struct_236298.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236298.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236298.free_mem_219815 = mem_219815.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236299_task;
    
    futhark_mc_segmap_parloop_236299_task.name =
        "futhark_mc_segmap_parloop_236299";
    futhark_mc_segmap_parloop_236299_task.fn = futhark_mc_segmap_parloop_236299;
    futhark_mc_segmap_parloop_236299_task.args =
        &futhark_mc_segmap_parloop_struct_236298;
    futhark_mc_segmap_parloop_236299_task.iterations = iterations;
    futhark_mc_segmap_parloop_236299_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236299_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236299_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236299_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236299_task);
    
    if (futhark_mc_segmap_parloop_236299_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236299_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236299_total_end -
                 futhark_mc_segmap_parloop_236299_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236299_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236299_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236299_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236297_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236297_end -
                 futhark_mc_segmap_task_236297_start;
        
        ctx->futhark_mc_segmap_task_236297_runs[tid]++;
        ctx->futhark_mc_segmap_task_236297_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236297_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236300 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219815;
    unsigned char *free_mem_219818;
    unsigned char *free_mem_219821;
};
struct futhark_mc_segmap_parloop_struct_236302 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219815;
    unsigned char *free_mem_219818;
    unsigned char *free_mem_219821;
};
static int futhark_mc_segmap_parloop_236303(void *args, int64_t start,
                                            int64_t end, int flat_tid_231967,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236302
    *futhark_mc_segmap_parloop_struct_236302 =
    (struct futhark_mc_segmap_parloop_struct_236302 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236302->ctx;
    uint64_t futhark_mc_segmap_parloop_236303_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236303_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236302->free_n_203490;
    int64_t gtid_213825 =
            futhark_mc_segmap_parloop_struct_236302->free_gtid_213825;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236302->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236302->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236302->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236302->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236302->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219815 = {.desc ="mem_219815", .mem =
                                  futhark_mc_segmap_parloop_struct_236302->free_mem_219815,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_segmap_parloop_struct_236302->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_segmap_parloop_struct_236302->free_mem_219821,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232106 = start;
    
    for (; iter_232106 < end; iter_232106++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232115 = n_203490;
        int64_t gtid_231968 = iter_232106;
        int64_t remnant_232116 = iter_232106 - gtid_231968;
        int64_t x_231969;
        
        x_231969 = ((int64_t *) mem_217340.mem)[gtid_213825 * n_203490 +
                                                gtid_231968];
        
        bool cond_231970 = sle64((int64_t) 0, x_231969);
        double defunc_0_f_res_231971;
        
        if (cond_231970) {
            bool y_232107 = slt64(x_231969, n_203490);
            bool bounds_check_232108 = cond_231970 && y_232107;
            bool index_certs_232109;
            
            if (!bounds_check_232108) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_231969,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_232110;
            
            defunc_0_f_res_t_res_232110 = ((double *) mem_219815.mem)[x_231969];
            defunc_0_f_res_231971 = defunc_0_f_res_t_res_232110;
        } else {
            defunc_0_f_res_231971 = 0.0;
        }
        
        double defunc_0_f_res_231976;
        
        if (cond_231970) {
            bool y_232111 = slt64(x_231969, n_203490);
            bool bounds_check_232112 = cond_231970 && y_232111;
            bool index_certs_232113;
            
            if (!bounds_check_232112) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_231969,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_232114;
            
            defunc_0_f_res_t_res_232114 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_213825 *
                                                   ctx_param_ext_217867 +
                                                   x_231969 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_231976 = defunc_0_f_res_t_res_232114;
        } else {
            defunc_0_f_res_231976 = 0.0;
        }
        ((double *) mem_219818.mem)[gtid_231968] = defunc_0_f_res_231976;
        ((double *) mem_219821.mem)[gtid_231968] = defunc_0_f_res_231971;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236303_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236303_end -
                 futhark_mc_segmap_parloop_236303_start;
        
        ctx->futhark_mc_segmap_parloop_236303_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236303_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236303_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236301(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231967 = tid;
    int num_tasks_232105 = info.nsubtasks;
    struct futhark_mc_task_236300 *futhark_mc_task_236300 =
                                  (struct futhark_mc_task_236300 *) args;
    struct futhark_context *ctx = futhark_mc_task_236300->ctx;
    uint64_t futhark_mc_segmap_task_236301_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236301_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236300->free_n_203490;
    int64_t gtid_213825 = futhark_mc_task_236300->free_gtid_213825;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236300->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236300->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236300->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236300->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236300->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219815 = {.desc ="mem_219815", .mem =
                                  futhark_mc_task_236300->free_mem_219815,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_task_236300->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_task_236300->free_mem_219821,
                                  .size =0, .references =NULL};
    int64_t iter_232106;
    struct futhark_mc_segmap_parloop_struct_236302
    futhark_mc_segmap_parloop_struct_236302;
    
    futhark_mc_segmap_parloop_struct_236302.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236302.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236302.free_gtid_213825 = gtid_213825;
    futhark_mc_segmap_parloop_struct_236302.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236302.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236302.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236302.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236302.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236302.free_mem_219815 = mem_219815.mem;
    futhark_mc_segmap_parloop_struct_236302.free_mem_219818 = mem_219818.mem;
    futhark_mc_segmap_parloop_struct_236302.free_mem_219821 = mem_219821.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236303_task;
    
    futhark_mc_segmap_parloop_236303_task.name =
        "futhark_mc_segmap_parloop_236303";
    futhark_mc_segmap_parloop_236303_task.fn = futhark_mc_segmap_parloop_236303;
    futhark_mc_segmap_parloop_236303_task.args =
        &futhark_mc_segmap_parloop_struct_236302;
    futhark_mc_segmap_parloop_236303_task.iterations = iterations;
    futhark_mc_segmap_parloop_236303_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236303_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236303_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236303_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236303_task);
    
    if (futhark_mc_segmap_parloop_236303_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236303_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236303_total_end -
                 futhark_mc_segmap_parloop_236303_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236303_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236303_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236303_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236301_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236301_end -
                 futhark_mc_segmap_task_236301_start;
        
        ctx->futhark_mc_segmap_task_236301_runs[tid]++;
        ctx->futhark_mc_segmap_task_236301_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236301_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236304 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_213825;
    int64_t free_x_213830;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219818;
    unsigned char *free_mem_219821;
    unsigned char *free_mem_219824;
};
struct futhark_mc_segmap_parloop_struct_236306 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_213825;
    int64_t free_x_213830;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219818;
    unsigned char *free_mem_219821;
    unsigned char *free_mem_219824;
};
static int futhark_mc_segmap_parloop_236307(void *args, int64_t start,
                                            int64_t end, int flat_tid_232042,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236306
    *futhark_mc_segmap_parloop_struct_236306 =
    (struct futhark_mc_segmap_parloop_struct_236306 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236306->ctx;
    uint64_t futhark_mc_segmap_parloop_236307_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236307_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236306->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236306->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236306->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236306->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236306->free_i_203670;
    int64_t gtid_213825 =
            futhark_mc_segmap_parloop_struct_236306->free_gtid_213825;
    int64_t x_213830 = futhark_mc_segmap_parloop_struct_236306->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236306->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236306->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236306->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_segmap_parloop_struct_236306->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_segmap_parloop_struct_236306->free_mem_219821,
                                  .size =0, .references =NULL};
    struct memblock mem_219824 = {.desc ="mem_219824", .mem =
                                  futhark_mc_segmap_parloop_struct_236306->free_mem_219824,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232118 = start;
    
    for (; iter_232118 < end; iter_232118++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232166 = t_n_m_203650;
        int64_t gtid_232043 = iter_232118;
        int64_t remnant_232167 = iter_232118 - gtid_232043;
        int64_t x_232044;
        
        x_232044 = ((int64_t *) mem_217835.mem)[gtid_213825 * t_n_m_203650 +
                                                gtid_232043];
        
        double x_232045;
        
        x_232045 = ((double *) mem_217839.mem)[gtid_213825 * t_n_m_203650 +
                                               gtid_232043];
        
        int64_t min_arg_232046 = mul64(jump_t_203500, gtid_232043);
        int64_t min_res_232047 = smin64(i_203670, min_arg_232046);
        int64_t defunc_0_g_res_232048 = add64((int64_t) 1, min_res_232047);
        double defunc_2_reduce_res_232049;
        double redout_232120 = 0.0;
        
        for (int64_t i_232119 = 0; i_232119 < q_t_203494; i_232119++) {
            bool cond_232121 = sle64(x_213830, i_232119);
            int64_t defunc_0_f_res_232122;
            
            if (cond_232121) {
                defunc_0_f_res_232122 = (int64_t) 0;
            } else {
                int64_t i_232123 = add64(x_232044, i_232119);
                int64_t defunc_0_add_arg_232124;
                
                defunc_0_add_arg_232124 =
                    ((int64_t *) mem_217340.mem)[gtid_213825 * n_203490 +
                                                 i_232123];
                
                int64_t defunc_1_add_res_232125 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232124);
                
                defunc_0_f_res_232122 = defunc_1_add_res_232125;
            }
            
            double defunc_0_f_res_232126;
            
            if (cond_232121) {
                defunc_0_f_res_232126 = 0.0;
            } else {
                int64_t i_232127 = add64(x_232044, i_232119);
                double defunc_0_add_arg_232128;
                
                defunc_0_add_arg_232128 = ((double *) mem_219818.mem)[i_232127];
                defunc_0_f_res_232126 = defunc_0_add_arg_232128;
            }
            
            int64_t binop_p_232129 = sub64(defunc_0_f_res_232122,
                                           defunc_0_g_res_232048);
            double defunc_0_f_res_232130 = sitofp_i64_f64(binop_p_232129);
            double abs_res_232131 = fabs(defunc_0_f_res_232130);
            double tmp1_232132 = abs_res_232131 / x_232045;
            double x_232133 = tmp1_232132 * tmp1_232132;
            double y_232134 = tmp1_232132 * x_232133;
            double tmp2_232135 = 1.0 - y_232134;
            double x_232136 = tmp2_232135 * tmp2_232135;
            double tmp3_232137 = tmp2_232135 * x_232136;
            double w_j_232138 = defunc_0_f_res_232126 * tmp3_232137;
            double defunc_1_op_res_232139 = w_j_232138 + redout_232120;
            double redout_tmp_232168 = defunc_1_op_res_232139;
            
            redout_232120 = redout_tmp_232168;
        }
        defunc_2_reduce_res_232049 = redout_232120;
        
        double a0_232071 = 1.0 / defunc_2_reduce_res_232049;
        double defunc_2_reduce_res_232072;
        double redout_232141 = 0.0;
        
        for (int64_t i_232140 = 0; i_232140 < q_t_203494; i_232140++) {
            bool cond_232142 = sle64(x_213830, i_232140);
            int64_t defunc_0_f_res_232143;
            
            if (cond_232142) {
                defunc_0_f_res_232143 = (int64_t) 0;
            } else {
                int64_t i_232144 = add64(x_232044, i_232140);
                int64_t defunc_0_add_arg_232145;
                
                defunc_0_add_arg_232145 =
                    ((int64_t *) mem_217340.mem)[gtid_213825 * n_203490 +
                                                 i_232144];
                
                int64_t defunc_1_add_res_232146 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232145);
                
                defunc_0_f_res_232143 = defunc_1_add_res_232146;
            }
            
            double defunc_0_f_res_232147;
            
            if (cond_232142) {
                defunc_0_f_res_232147 = 0.0;
            } else {
                int64_t i_232148 = add64(x_232044, i_232140);
                double defunc_0_add_arg_232149;
                
                defunc_0_add_arg_232149 = ((double *) mem_219818.mem)[i_232148];
                defunc_0_f_res_232147 = defunc_0_add_arg_232149;
            }
            
            int64_t binop_p_232150 = sub64(defunc_0_f_res_232143,
                                           defunc_0_g_res_232048);
            double defunc_0_f_res_232151 = sitofp_i64_f64(binop_p_232150);
            double abs_res_232152 = fabs(defunc_0_f_res_232151);
            double tmp1_232153 = abs_res_232152 / x_232045;
            double x_232154 = tmp1_232153 * tmp1_232153;
            double y_232155 = tmp1_232153 * x_232154;
            double tmp2_232156 = 1.0 - y_232155;
            double x_232157 = tmp2_232156 * tmp2_232156;
            double tmp3_232158 = tmp2_232156 * x_232157;
            double tmp4_232159 = defunc_0_f_res_232147 * tmp3_232158;
            double defunc_0_f_res_232160;
            
            if (cond_232142) {
                defunc_0_f_res_232160 = 0.0;
            } else {
                int64_t i_232161 = add64(x_232044, i_232140);
                double defunc_0_add_arg_232162;
                
                defunc_0_add_arg_232162 = ((double *) mem_219821.mem)[i_232161];
                defunc_0_f_res_232160 = defunc_0_add_arg_232162;
            }
            
            double x_232163 = a0_232071 * tmp4_232159;
            double defunc_9_fit_fun_res_232164 = defunc_0_f_res_232160 *
                   x_232163;
            double defunc_1_op_res_232165 = defunc_9_fit_fun_res_232164 +
                   redout_232141;
            double redout_tmp_232169 = defunc_1_op_res_232165;
            
            redout_232141 = redout_tmp_232169;
        }
        defunc_2_reduce_res_232072 = redout_232141;
        ((double *) mem_219824.mem)[gtid_232043] = defunc_2_reduce_res_232072;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236307_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236307_end -
                 futhark_mc_segmap_parloop_236307_start;
        
        ctx->futhark_mc_segmap_parloop_236307_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236307_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236307_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236305(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232042 = tid;
    int num_tasks_232117 = info.nsubtasks;
    struct futhark_mc_task_236304 *futhark_mc_task_236304 =
                                  (struct futhark_mc_task_236304 *) args;
    struct futhark_context *ctx = futhark_mc_task_236304->ctx;
    uint64_t futhark_mc_segmap_task_236305_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236305_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236304->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236304->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236304->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236304->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236304->free_i_203670;
    int64_t gtid_213825 = futhark_mc_task_236304->free_gtid_213825;
    int64_t x_213830 = futhark_mc_task_236304->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236304->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236304->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236304->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_task_236304->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_task_236304->free_mem_219821,
                                  .size =0, .references =NULL};
    struct memblock mem_219824 = {.desc ="mem_219824", .mem =
                                  futhark_mc_task_236304->free_mem_219824,
                                  .size =0, .references =NULL};
    int64_t iter_232118;
    struct futhark_mc_segmap_parloop_struct_236306
    futhark_mc_segmap_parloop_struct_236306;
    
    futhark_mc_segmap_parloop_struct_236306.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236306.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236306.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236306.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236306.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236306.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236306.free_gtid_213825 = gtid_213825;
    futhark_mc_segmap_parloop_struct_236306.free_x_213830 = x_213830;
    futhark_mc_segmap_parloop_struct_236306.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236306.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236306.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236306.free_mem_219818 = mem_219818.mem;
    futhark_mc_segmap_parloop_struct_236306.free_mem_219821 = mem_219821.mem;
    futhark_mc_segmap_parloop_struct_236306.free_mem_219824 = mem_219824.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236307_task;
    
    futhark_mc_segmap_parloop_236307_task.name =
        "futhark_mc_segmap_parloop_236307";
    futhark_mc_segmap_parloop_236307_task.fn = futhark_mc_segmap_parloop_236307;
    futhark_mc_segmap_parloop_236307_task.args =
        &futhark_mc_segmap_parloop_struct_236306;
    futhark_mc_segmap_parloop_236307_task.iterations = iterations;
    futhark_mc_segmap_parloop_236307_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236307_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236307_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236307_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236307_task);
    
    if (futhark_mc_segmap_parloop_236307_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236307_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236307_total_end -
                 futhark_mc_segmap_parloop_236307_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236307_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236307_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236307_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236305_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236305_end -
                 futhark_mc_segmap_task_236305_start;
        
        ctx->futhark_mc_segmap_task_236305_runs[tid]++;
        ctx->futhark_mc_segmap_task_236305_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236305_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236309 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_213825;
    int64_t free_x_213830;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219818;
    unsigned char *free_mem_219821;
    unsigned char *free_mem_219824;
};
struct futhark_mc_task_236311 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    int64_t free_x_213830;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219818;
    int64_t free_x_231983;
    double free_x_231984;
    int64_t free_defunc_0_g_res_231987;
    double *retval_defunc_2_reduce_res_231988;
};
struct futhark_mc_segred_stage_1_parloop_struct_236314 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    int64_t free_x_213830;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219818;
    int64_t free_x_231983;
    double free_x_231984;
    int64_t free_defunc_0_g_res_231987;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232225;
};
static int futhark_mc_segred_stage_1_parloop_236315(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232171,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236314
    *futhark_mc_segred_stage_1_parloop_struct_236314 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236314 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236314->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236315_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236315_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236314->free_n_203490;
    int64_t gtid_213825 =
            futhark_mc_segred_stage_1_parloop_struct_236314->free_gtid_213825;
    int64_t x_213830 =
            futhark_mc_segred_stage_1_parloop_struct_236314->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236314->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236314->free_mem_219818,
                                  .size =0, .references =NULL};
    int64_t x_231983 =
            futhark_mc_segred_stage_1_parloop_struct_236314->free_x_231983;
    double x_231984 =
           futhark_mc_segred_stage_1_parloop_struct_236314->free_x_231984;
    int64_t defunc_0_g_res_231987 =
            futhark_mc_segred_stage_1_parloop_struct_236314->free_defunc_0_g_res_231987;
    struct memblock reduce_stage_1_tid_res_arr_mem_232225 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232225",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236314->free_reduce_stage_1_tid_res_arr_mem_232225,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232227 = start;
    double x_232173;
    double x_232174;
    double local_acc_232228 = 0.0;
    
    for (; iter_232227 < end; iter_232227++) {
        int64_t gtid_232172 = iter_232227;
        bool cond_232176 = sle64(x_213830, gtid_232172);
        int64_t defunc_0_f_res_232177;
        
        if (cond_232176) {
            defunc_0_f_res_232177 = (int64_t) 0;
        } else {
            int64_t i_232178 = add64(x_231983, gtid_232172);
            int64_t defunc_0_add_arg_232179;
            
            defunc_0_add_arg_232179 = ((int64_t *) mem_217340.mem)[gtid_213825 *
                                                                   n_203490 +
                                                                   i_232178];
            
            int64_t defunc_1_add_res_232180 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232179);
            
            defunc_0_f_res_232177 = defunc_1_add_res_232180;
        }
        
        double defunc_0_f_res_232181;
        
        if (cond_232176) {
            defunc_0_f_res_232181 = 0.0;
        } else {
            int64_t i_232182 = add64(x_231983, gtid_232172);
            double defunc_0_add_arg_232183;
            
            defunc_0_add_arg_232183 = ((double *) mem_219818.mem)[i_232182];
            defunc_0_f_res_232181 = defunc_0_add_arg_232183;
        }
        
        int64_t binop_p_232184 = sub64(defunc_0_f_res_232177,
                                       defunc_0_g_res_231987);
        double defunc_0_f_res_232185 = sitofp_i64_f64(binop_p_232184);
        double abs_res_232186 = fabs(defunc_0_f_res_232185);
        double tmp1_232187 = abs_res_232186 / x_231984;
        double x_232188 = tmp1_232187 * tmp1_232187;
        double y_232189 = tmp1_232187 * x_232188;
        double tmp2_232190 = 1.0 - y_232189;
        double x_232191 = tmp2_232190 * tmp2_232190;
        double tmp3_232192 = tmp2_232190 * x_232191;
        double w_j_232193 = defunc_0_f_res_232181 * tmp3_232192;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232173 = local_acc_232228;
        }
        // Load next params
        {
            x_232174 = w_j_232193;
        }
        // Red body
        {
            double defunc_1_op_res_232175 = x_232173 + x_232174;
            
            local_acc_232228 = defunc_1_op_res_232175;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232225.mem)[flat_tid_232171] =
        local_acc_232228;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236315_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236315_end -
                 futhark_mc_segred_stage_1_parloop_236315_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236315_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236315_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236315_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236312(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232171 = tid;
    int num_tasks_232224 = info.nsubtasks;
    struct futhark_mc_task_236311 *futhark_mc_task_236311 =
                                  (struct futhark_mc_task_236311 *) args;
    struct futhark_context *ctx = futhark_mc_task_236311->ctx;
    uint64_t futhark_mc_segred_task_236312_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236312_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236311->free_n_203490;
    int64_t gtid_213825 = futhark_mc_task_236311->free_gtid_213825;
    int64_t x_213830 = futhark_mc_task_236311->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236311->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_task_236311->free_mem_219818,
                                  .size =0, .references =NULL};
    int64_t x_231983 = futhark_mc_task_236311->free_x_231983;
    double x_231984 = futhark_mc_task_236311->free_x_231984;
    int64_t defunc_0_g_res_231987 =
            futhark_mc_task_236311->free_defunc_0_g_res_231987;
    double defunc_2_reduce_res_231988 =
           *futhark_mc_task_236311->retval_defunc_2_reduce_res_231988;
    size_t reduce_stage_1_tid_res_arr_mem_232225_cached_sizze_236313 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232225 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232225_cached_sizze_236313 <
        (size_t) ((int64_t) 8 * num_tasks_232224)) {
        reduce_stage_1_tid_res_arr_mem_232225 =
            realloc(reduce_stage_1_tid_res_arr_mem_232225, (int64_t) 8 *
                    num_tasks_232224);
        reduce_stage_1_tid_res_arr_mem_232225_cached_sizze_236313 =
            (int64_t) 8 * num_tasks_232224;
    }
    
    int64_t iter_232227;
    struct futhark_mc_segred_stage_1_parloop_struct_236314
    futhark_mc_segred_stage_1_parloop_struct_236314;
    
    futhark_mc_segred_stage_1_parloop_struct_236314.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_gtid_213825 =
        gtid_213825;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_x_213830 = x_213830;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_mem_219818 =
        mem_219818.mem;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_x_231983 = x_231983;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_x_231984 = x_231984;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_defunc_0_g_res_231987 =
        defunc_0_g_res_231987;
    futhark_mc_segred_stage_1_parloop_struct_236314.free_reduce_stage_1_tid_res_arr_mem_232225 =
        reduce_stage_1_tid_res_arr_mem_232225;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236315_task;
    
    futhark_mc_segred_stage_1_parloop_236315_task.name =
        "futhark_mc_segred_stage_1_parloop_236315";
    futhark_mc_segred_stage_1_parloop_236315_task.fn =
        futhark_mc_segred_stage_1_parloop_236315;
    futhark_mc_segred_stage_1_parloop_236315_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236314;
    futhark_mc_segred_stage_1_parloop_236315_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236315_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236315_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236315_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236315_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236315_task);
    
    if (futhark_mc_segred_stage_1_parloop_236315_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236315_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236315_total_end -
                 futhark_mc_segred_stage_1_parloop_236315_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236315_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236315_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236315_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_231988 = 0.0;
    }
    
    double x_232229;
    double x_232230;
    
    for (int32_t i_232232 = 0; i_232232 < num_tasks_232224; i_232232++) {
        flat_tid_232171 = i_232232;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232229 = defunc_2_reduce_res_231988;
            }
            // load next params
            {
                x_232230 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232225)[flat_tid_232171];
            }
            // red body
            {
                double defunc_1_op_res_232231 = x_232229 + x_232230;
                
                defunc_2_reduce_res_231988 = defunc_1_op_res_232231;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232225);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236312_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236312_end -
                 futhark_mc_segred_task_236312_start;
        
        ctx->futhark_mc_segred_task_236312_runs[tid]++;
        ctx->futhark_mc_segred_task_236312_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236312_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236311->retval_defunc_2_reduce_res_231988 =
            defunc_2_reduce_res_231988;
    }
    return err;
}
struct futhark_mc_task_236316 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    int64_t free_x_213830;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219818;
    unsigned char *free_mem_219821;
    int64_t free_x_231983;
    double free_x_231984;
    int64_t free_defunc_0_g_res_231987;
    double free_a0_232012;
    double *retval_defunc_2_reduce_res_232013;
};
struct futhark_mc_segred_stage_1_parloop_struct_236319 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_213825;
    int64_t free_x_213830;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219818;
    unsigned char *free_mem_219821;
    int64_t free_x_231983;
    double free_x_231984;
    int64_t free_defunc_0_g_res_231987;
    double free_a0_232012;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232234;
};
static int futhark_mc_segred_stage_1_parloop_236320(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232194,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236319
    *futhark_mc_segred_stage_1_parloop_struct_236319 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236319 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236319->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236320_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236320_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_n_203490;
    int64_t gtid_213825 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_gtid_213825;
    int64_t x_213830 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236319->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236319->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236319->free_mem_219821,
                                  .size =0, .references =NULL};
    int64_t x_231983 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_x_231983;
    double x_231984 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_x_231984;
    int64_t defunc_0_g_res_231987 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_defunc_0_g_res_231987;
    double a0_232012 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_a0_232012;
    struct memblock reduce_stage_1_tid_res_arr_mem_232234 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232234",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236319->free_reduce_stage_1_tid_res_arr_mem_232234,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232236 = start;
    double x_232196;
    double x_232197;
    double local_acc_232237 = 0.0;
    
    for (; iter_232236 < end; iter_232236++) {
        int64_t gtid_232195 = iter_232236;
        bool cond_232199 = sle64(x_213830, gtid_232195);
        int64_t defunc_0_f_res_232200;
        
        if (cond_232199) {
            defunc_0_f_res_232200 = (int64_t) 0;
        } else {
            int64_t i_232201 = add64(x_231983, gtid_232195);
            int64_t defunc_0_add_arg_232202;
            
            defunc_0_add_arg_232202 = ((int64_t *) mem_217340.mem)[gtid_213825 *
                                                                   n_203490 +
                                                                   i_232201];
            
            int64_t defunc_1_add_res_232203 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232202);
            
            defunc_0_f_res_232200 = defunc_1_add_res_232203;
        }
        
        double defunc_0_f_res_232204;
        
        if (cond_232199) {
            defunc_0_f_res_232204 = 0.0;
        } else {
            int64_t i_232205 = add64(x_231983, gtid_232195);
            double defunc_0_add_arg_232206;
            
            defunc_0_add_arg_232206 = ((double *) mem_219818.mem)[i_232205];
            defunc_0_f_res_232204 = defunc_0_add_arg_232206;
        }
        
        int64_t binop_p_232207 = sub64(defunc_0_f_res_232200,
                                       defunc_0_g_res_231987);
        double defunc_0_f_res_232208 = sitofp_i64_f64(binop_p_232207);
        double abs_res_232209 = fabs(defunc_0_f_res_232208);
        double tmp1_232210 = abs_res_232209 / x_231984;
        double x_232211 = tmp1_232210 * tmp1_232210;
        double y_232212 = tmp1_232210 * x_232211;
        double tmp2_232213 = 1.0 - y_232212;
        double x_232214 = tmp2_232213 * tmp2_232213;
        double tmp3_232215 = tmp2_232213 * x_232214;
        double tmp4_232216 = defunc_0_f_res_232204 * tmp3_232215;
        double defunc_0_f_res_232217;
        
        if (cond_232199) {
            defunc_0_f_res_232217 = 0.0;
        } else {
            int64_t i_232218 = add64(x_231983, gtid_232195);
            double defunc_0_add_arg_232219;
            
            defunc_0_add_arg_232219 = ((double *) mem_219821.mem)[i_232218];
            defunc_0_f_res_232217 = defunc_0_add_arg_232219;
        }
        
        double x_232220 = a0_232012 * tmp4_232216;
        double defunc_9_fit_fun_res_232221 = defunc_0_f_res_232217 * x_232220;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232196 = local_acc_232237;
        }
        // Load next params
        {
            x_232197 = defunc_9_fit_fun_res_232221;
        }
        // Red body
        {
            double defunc_1_op_res_232198 = x_232196 + x_232197;
            
            local_acc_232237 = defunc_1_op_res_232198;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232234.mem)[flat_tid_232194] =
        local_acc_232237;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236320_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236320_end -
                 futhark_mc_segred_stage_1_parloop_236320_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236320_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236320_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236320_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236317(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232194 = tid;
    int num_tasks_232233 = info.nsubtasks;
    struct futhark_mc_task_236316 *futhark_mc_task_236316 =
                                  (struct futhark_mc_task_236316 *) args;
    struct futhark_context *ctx = futhark_mc_task_236316->ctx;
    uint64_t futhark_mc_segred_task_236317_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236317_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236316->free_n_203490;
    int64_t gtid_213825 = futhark_mc_task_236316->free_gtid_213825;
    int64_t x_213830 = futhark_mc_task_236316->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236316->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_task_236316->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_task_236316->free_mem_219821,
                                  .size =0, .references =NULL};
    int64_t x_231983 = futhark_mc_task_236316->free_x_231983;
    double x_231984 = futhark_mc_task_236316->free_x_231984;
    int64_t defunc_0_g_res_231987 =
            futhark_mc_task_236316->free_defunc_0_g_res_231987;
    double a0_232012 = futhark_mc_task_236316->free_a0_232012;
    double defunc_2_reduce_res_232013 =
           *futhark_mc_task_236316->retval_defunc_2_reduce_res_232013;
    size_t reduce_stage_1_tid_res_arr_mem_232234_cached_sizze_236318 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232234 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232234_cached_sizze_236318 <
        (size_t) ((int64_t) 8 * num_tasks_232233)) {
        reduce_stage_1_tid_res_arr_mem_232234 =
            realloc(reduce_stage_1_tid_res_arr_mem_232234, (int64_t) 8 *
                    num_tasks_232233);
        reduce_stage_1_tid_res_arr_mem_232234_cached_sizze_236318 =
            (int64_t) 8 * num_tasks_232233;
    }
    
    int64_t iter_232236;
    struct futhark_mc_segred_stage_1_parloop_struct_236319
    futhark_mc_segred_stage_1_parloop_struct_236319;
    
    futhark_mc_segred_stage_1_parloop_struct_236319.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_gtid_213825 =
        gtid_213825;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_x_213830 = x_213830;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_mem_219818 =
        mem_219818.mem;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_mem_219821 =
        mem_219821.mem;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_x_231983 = x_231983;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_x_231984 = x_231984;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_defunc_0_g_res_231987 =
        defunc_0_g_res_231987;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_a0_232012 = a0_232012;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_reduce_stage_1_tid_res_arr_mem_232234 =
        reduce_stage_1_tid_res_arr_mem_232234;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236320_task;
    
    futhark_mc_segred_stage_1_parloop_236320_task.name =
        "futhark_mc_segred_stage_1_parloop_236320";
    futhark_mc_segred_stage_1_parloop_236320_task.fn =
        futhark_mc_segred_stage_1_parloop_236320;
    futhark_mc_segred_stage_1_parloop_236320_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236319;
    futhark_mc_segred_stage_1_parloop_236320_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236320_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236320_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236320_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236320_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236320_task);
    
    if (futhark_mc_segred_stage_1_parloop_236320_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236320_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236320_total_end -
                 futhark_mc_segred_stage_1_parloop_236320_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236320_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236320_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236320_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232013 = 0.0;
    }
    
    double x_232238;
    double x_232239;
    
    for (int32_t i_232241 = 0; i_232241 < num_tasks_232233; i_232241++) {
        flat_tid_232194 = i_232241;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232238 = defunc_2_reduce_res_232013;
            }
            // load next params
            {
                x_232239 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232234)[flat_tid_232194];
            }
            // red body
            {
                double defunc_1_op_res_232240 = x_232238 + x_232239;
                
                defunc_2_reduce_res_232013 = defunc_1_op_res_232240;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232234);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236317_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236317_end -
                 futhark_mc_segred_task_236317_start;
        
        ctx->futhark_mc_segred_task_236317_runs[tid]++;
        ctx->futhark_mc_segred_task_236317_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236317_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236316->retval_defunc_2_reduce_res_232013 =
            defunc_2_reduce_res_232013;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236310(void *args, int64_t start,
                                            int64_t end, int flat_tid_231981,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236309
    *futhark_mc_segmap_parloop_struct_236309 =
    (struct futhark_mc_segmap_parloop_struct_236309 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236309->ctx;
    uint64_t futhark_mc_segmap_parloop_236310_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236310_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236309->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236309->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236309->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236309->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236309->free_i_203670;
    int64_t gtid_213825 =
            futhark_mc_segmap_parloop_struct_236309->free_gtid_213825;
    int64_t x_213830 = futhark_mc_segmap_parloop_struct_236309->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236309->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236309->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236309->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_segmap_parloop_struct_236309->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_segmap_parloop_struct_236309->free_mem_219821,
                                  .size =0, .references =NULL};
    struct memblock mem_219824 = {.desc ="mem_219824", .mem =
                                  futhark_mc_segmap_parloop_struct_236309->free_mem_219824,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232170 = start;
    
    for (; iter_232170 < end; iter_232170++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232222 = t_n_m_203650;
        int64_t gtid_231982 = iter_232170;
        int64_t remnant_232223 = iter_232170 - gtid_231982;
        int64_t x_231983;
        
        x_231983 = ((int64_t *) mem_217835.mem)[gtid_213825 * t_n_m_203650 +
                                                gtid_231982];
        
        double x_231984;
        
        x_231984 = ((double *) mem_217839.mem)[gtid_213825 * t_n_m_203650 +
                                               gtid_231982];
        
        int64_t min_arg_231985 = mul64(jump_t_203500, gtid_231982);
        int64_t min_res_231986 = smin64(i_203670, min_arg_231985);
        int64_t defunc_0_g_res_231987 = add64((int64_t) 1, min_res_231986);
        double defunc_2_reduce_res_231988;
        int64_t flat_tid_232171 = (int64_t) 0;
        int32_t num_tasks_232224;
        
        defunc_2_reduce_res_231988 = 0.0;
        
        struct futhark_mc_task_236311 futhark_mc_task_236311;
        
        futhark_mc_task_236311.ctx = ctx;
        futhark_mc_task_236311.free_n_203490 = n_203490;
        futhark_mc_task_236311.free_gtid_213825 = gtid_213825;
        futhark_mc_task_236311.free_x_213830 = x_213830;
        futhark_mc_task_236311.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236311.free_mem_219818 = mem_219818.mem;
        futhark_mc_task_236311.free_x_231983 = x_231983;
        futhark_mc_task_236311.free_x_231984 = x_231984;
        futhark_mc_task_236311.free_defunc_0_g_res_231987 =
            defunc_0_g_res_231987;
        futhark_mc_task_236311.retval_defunc_2_reduce_res_231988 =
            &defunc_2_reduce_res_231988;
        
        struct scheduler_segop futhark_mc_task_236311_task;
        
        futhark_mc_task_236311_task.args = &futhark_mc_task_236311;
        futhark_mc_task_236311_task.top_level_fn =
            futhark_mc_segred_task_236312;
        futhark_mc_task_236311_task.name = "futhark_mc_segred_task_236312";
        futhark_mc_task_236311_task.iterations = q_t_203494;
        futhark_mc_task_236311_task.task_time =
            &ctx->futhark_mc_segred_task_236312_total_time;
        futhark_mc_task_236311_task.task_iter =
            &ctx->futhark_mc_segred_task_236312_total_iter;
        futhark_mc_task_236311_task.sched = STATIC;
        futhark_mc_task_236311_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236312_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236311_task);
        
        if (futhark_mc_segred_task_236312_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_232012 = 1.0 / defunc_2_reduce_res_231988;
        double defunc_2_reduce_res_232013;
        int64_t flat_tid_232194 = (int64_t) 0;
        int32_t num_tasks_232233;
        
        defunc_2_reduce_res_232013 = 0.0;
        
        struct futhark_mc_task_236316 futhark_mc_task_236316;
        
        futhark_mc_task_236316.ctx = ctx;
        futhark_mc_task_236316.free_n_203490 = n_203490;
        futhark_mc_task_236316.free_gtid_213825 = gtid_213825;
        futhark_mc_task_236316.free_x_213830 = x_213830;
        futhark_mc_task_236316.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236316.free_mem_219818 = mem_219818.mem;
        futhark_mc_task_236316.free_mem_219821 = mem_219821.mem;
        futhark_mc_task_236316.free_x_231983 = x_231983;
        futhark_mc_task_236316.free_x_231984 = x_231984;
        futhark_mc_task_236316.free_defunc_0_g_res_231987 =
            defunc_0_g_res_231987;
        futhark_mc_task_236316.free_a0_232012 = a0_232012;
        futhark_mc_task_236316.retval_defunc_2_reduce_res_232013 =
            &defunc_2_reduce_res_232013;
        
        struct scheduler_segop futhark_mc_task_236316_task;
        
        futhark_mc_task_236316_task.args = &futhark_mc_task_236316;
        futhark_mc_task_236316_task.top_level_fn =
            futhark_mc_segred_task_236317;
        futhark_mc_task_236316_task.name = "futhark_mc_segred_task_236317";
        futhark_mc_task_236316_task.iterations = q_t_203494;
        futhark_mc_task_236316_task.task_time =
            &ctx->futhark_mc_segred_task_236317_total_time;
        futhark_mc_task_236316_task.task_iter =
            &ctx->futhark_mc_segred_task_236317_total_iter;
        futhark_mc_task_236316_task.sched = STATIC;
        futhark_mc_task_236316_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236317_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236316_task);
        
        if (futhark_mc_segred_task_236317_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219824.mem)[gtid_231982] = defunc_2_reduce_res_232013;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236310_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236310_end -
                 futhark_mc_segmap_parloop_236310_start;
        
        ctx->futhark_mc_segmap_parloop_236310_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236310_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236310_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236308(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231981 = tid;
    int num_tasks_232117 = info.nsubtasks;
    struct futhark_mc_task_236304 *futhark_mc_task_236304 =
                                  (struct futhark_mc_task_236304 *) args;
    struct futhark_context *ctx = futhark_mc_task_236304->ctx;
    uint64_t futhark_mc_segmap_nested_task_236308_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236308_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236304->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236304->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236304->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236304->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236304->free_i_203670;
    int64_t gtid_213825 = futhark_mc_task_236304->free_gtid_213825;
    int64_t x_213830 = futhark_mc_task_236304->free_x_213830;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236304->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236304->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236304->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219818 = {.desc ="mem_219818", .mem =
                                  futhark_mc_task_236304->free_mem_219818,
                                  .size =0, .references =NULL};
    struct memblock mem_219821 = {.desc ="mem_219821", .mem =
                                  futhark_mc_task_236304->free_mem_219821,
                                  .size =0, .references =NULL};
    struct memblock mem_219824 = {.desc ="mem_219824", .mem =
                                  futhark_mc_task_236304->free_mem_219824,
                                  .size =0, .references =NULL};
    int64_t iter_232170;
    struct futhark_mc_segmap_parloop_struct_236309
    futhark_mc_segmap_parloop_struct_236309;
    
    futhark_mc_segmap_parloop_struct_236309.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236309.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236309.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236309.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236309.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236309.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236309.free_gtid_213825 = gtid_213825;
    futhark_mc_segmap_parloop_struct_236309.free_x_213830 = x_213830;
    futhark_mc_segmap_parloop_struct_236309.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236309.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236309.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236309.free_mem_219818 = mem_219818.mem;
    futhark_mc_segmap_parloop_struct_236309.free_mem_219821 = mem_219821.mem;
    futhark_mc_segmap_parloop_struct_236309.free_mem_219824 = mem_219824.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236310_task;
    
    futhark_mc_segmap_parloop_236310_task.name =
        "futhark_mc_segmap_parloop_236310";
    futhark_mc_segmap_parloop_236310_task.fn = futhark_mc_segmap_parloop_236310;
    futhark_mc_segmap_parloop_236310_task.args =
        &futhark_mc_segmap_parloop_struct_236309;
    futhark_mc_segmap_parloop_236310_task.iterations = iterations;
    futhark_mc_segmap_parloop_236310_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236310_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236310_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236310_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236310_task);
    
    if (futhark_mc_segmap_parloop_236310_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236310_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236310_total_end -
                 futhark_mc_segmap_parloop_236310_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236310_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236310_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236310_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236308_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236308_end -
                 futhark_mc_segmap_nested_task_236308_start;
        
        ctx->futhark_mc_segmap_nested_task_236308_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236308_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236308_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236291(void *args, int64_t start,
                                            int64_t end, int flat_tid_213824,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236290
    *futhark_mc_segmap_parloop_struct_236290 =
    (struct futhark_mc_segmap_parloop_struct_236290 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236290->ctx;
    uint64_t futhark_mc_segmap_parloop_236291_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236291_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236290->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236290->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236290->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236290->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236290->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236290->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236290->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236290->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236290->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236290->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236290->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236290->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219888 = {.desc ="mem_219888", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_219888,
                                  .size =0, .references =NULL};
    size_t mem_219815_cached_sizze_236292 = 0;
    unsigned char *mem_219815 = NULL;
    size_t mem_219818_cached_sizze_236293 = 0;
    unsigned char *mem_219818 = NULL;
    size_t mem_219821_cached_sizze_236294 = 0;
    unsigned char *mem_219821 = NULL;
    size_t mem_219824_cached_sizze_236295 = 0;
    unsigned char *mem_219824 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231961 = start;
    
    if (mem_219815_cached_sizze_236292 < (size_t) bytes_217302) {
        mem_219815 = realloc(mem_219815, bytes_217302);
        mem_219815_cached_sizze_236292 = bytes_217302;
    }
    if (mem_219818_cached_sizze_236293 < (size_t) bytes_217302) {
        mem_219818 = realloc(mem_219818, bytes_217302);
        mem_219818_cached_sizze_236293 = bytes_217302;
    }
    if (mem_219821_cached_sizze_236294 < (size_t) bytes_217302) {
        mem_219821 = realloc(mem_219821, bytes_217302);
        mem_219821_cached_sizze_236294 = bytes_217302;
    }
    if (mem_219824_cached_sizze_236295 < (size_t) bytes_217782) {
        mem_219824 = realloc(mem_219824, bytes_217782);
        mem_219824_cached_sizze_236295 = bytes_217782;
    }
    for (; iter_231961 < end; iter_231961++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232099 = partition_sizze_203577;
        int64_t gtid_213825 = iter_231961;
        int64_t remnant_232100 = iter_231961 - gtid_213825;
        int64_t x_213830;
        
        x_213830 = ((int64_t *) mem_217343.mem)[gtid_213825];
        
        int64_t flat_tid_231962 = (int64_t) 0;
        int32_t num_tasks_232101;
        struct futhark_mc_task_236296 futhark_mc_task_236296;
        
        futhark_mc_task_236296.ctx = ctx;
        futhark_mc_task_236296.free_n_203490 = n_203490;
        futhark_mc_task_236296.free_gtid_213825 = gtid_213825;
        futhark_mc_task_236296.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236296.free_mem_219808 = mem_219808.mem;
        futhark_mc_task_236296.free_mem_219815 = mem_219815;
        
        struct scheduler_segop futhark_mc_task_236296_task;
        
        futhark_mc_task_236296_task.args = &futhark_mc_task_236296;
        futhark_mc_task_236296_task.top_level_fn =
            futhark_mc_segmap_task_236297;
        futhark_mc_task_236296_task.name = "futhark_mc_segmap_task_236297";
        futhark_mc_task_236296_task.iterations = n_203490;
        futhark_mc_task_236296_task.task_time =
            &ctx->futhark_mc_segmap_task_236297_total_time;
        futhark_mc_task_236296_task.task_iter =
            &ctx->futhark_mc_segmap_task_236297_total_iter;
        futhark_mc_task_236296_task.sched = STATIC;
        futhark_mc_task_236296_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236297_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236296_task);
        
        if (futhark_mc_segmap_task_236297_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_231967 = (int64_t) 0;
        int32_t num_tasks_232105;
        struct futhark_mc_task_236300 futhark_mc_task_236300;
        
        futhark_mc_task_236300.ctx = ctx;
        futhark_mc_task_236300.free_n_203490 = n_203490;
        futhark_mc_task_236300.free_gtid_213825 = gtid_213825;
        futhark_mc_task_236300.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236300.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236300.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236300.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236300.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236300.free_mem_219815 = mem_219815;
        futhark_mc_task_236300.free_mem_219818 = mem_219818;
        futhark_mc_task_236300.free_mem_219821 = mem_219821;
        
        struct scheduler_segop futhark_mc_task_236300_task;
        
        futhark_mc_task_236300_task.args = &futhark_mc_task_236300;
        futhark_mc_task_236300_task.top_level_fn =
            futhark_mc_segmap_task_236301;
        futhark_mc_task_236300_task.name = "futhark_mc_segmap_task_236301";
        futhark_mc_task_236300_task.iterations = n_203490;
        futhark_mc_task_236300_task.task_time =
            &ctx->futhark_mc_segmap_task_236301_total_time;
        futhark_mc_task_236300_task.task_iter =
            &ctx->futhark_mc_segmap_task_236301_total_iter;
        futhark_mc_task_236300_task.sched = STATIC;
        futhark_mc_task_236300_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236301_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236300_task);
        
        if (futhark_mc_segmap_task_236301_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232042 = (int64_t) 0;
        int32_t num_tasks_232117;
        int64_t flat_tid_231981 = (int64_t) 0;
        struct futhark_mc_task_236304 futhark_mc_task_236304;
        
        futhark_mc_task_236304.ctx = ctx;
        futhark_mc_task_236304.free_n_203490 = n_203490;
        futhark_mc_task_236304.free_q_t_203494 = q_t_203494;
        futhark_mc_task_236304.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236304.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_236304.free_i_203670 = i_203670;
        futhark_mc_task_236304.free_gtid_213825 = gtid_213825;
        futhark_mc_task_236304.free_x_213830 = x_213830;
        futhark_mc_task_236304.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236304.free_mem_217835 = mem_217835.mem;
        futhark_mc_task_236304.free_mem_217839 = mem_217839.mem;
        futhark_mc_task_236304.free_mem_219818 = mem_219818;
        futhark_mc_task_236304.free_mem_219821 = mem_219821;
        futhark_mc_task_236304.free_mem_219824 = mem_219824;
        
        struct scheduler_segop futhark_mc_task_236304_task;
        
        futhark_mc_task_236304_task.args = &futhark_mc_task_236304;
        futhark_mc_task_236304_task.top_level_fn =
            futhark_mc_segmap_task_236305;
        futhark_mc_task_236304_task.name = "futhark_mc_segmap_task_236305";
        futhark_mc_task_236304_task.iterations = t_n_m_203650;
        futhark_mc_task_236304_task.task_time =
            &ctx->futhark_mc_segmap_task_236305_total_time;
        futhark_mc_task_236304_task.task_iter =
            &ctx->futhark_mc_segmap_task_236305_total_iter;
        futhark_mc_task_236304_task.sched = STATIC;
        futhark_mc_task_236304_task.nested_fn =
            futhark_mc_segmap_nested_task_236308;
        
        int futhark_mc_segmap_task_236305_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236304_task);
        
        if (futhark_mc_segmap_task_236305_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_219888.mem + gtid_213825 * t_n_m_203650 * (int64_t) 8,
                    mem_219824 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219815);
    free(mem_219818);
    free(mem_219821);
    free(mem_219824);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236291_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236291_end -
                 futhark_mc_segmap_parloop_236291_start;
        
        ctx->futhark_mc_segmap_parloop_236291_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236291_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236291_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236289(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213824 = tid;
    int num_tasks_231870 = info.nsubtasks;
    struct futhark_mc_task_236281 *futhark_mc_task_236281 =
                                  (struct futhark_mc_task_236281 *) args;
    struct futhark_context *ctx = futhark_mc_task_236281->ctx;
    uint64_t futhark_mc_segmap_nested_task_236289_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236289_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236281->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236281->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236281->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236281->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236281->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236281->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236281->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236281->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236281->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236281->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236281->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236281->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236281->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236281->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236281->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236281->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236281->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236281->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219888 = {.desc ="mem_219888", .mem =
                                  futhark_mc_task_236281->free_mem_219888,
                                  .size =0, .references =NULL};
    int64_t iter_231961;
    struct futhark_mc_segmap_parloop_struct_236290
    futhark_mc_segmap_parloop_struct_236290;
    
    futhark_mc_segmap_parloop_struct_236290.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236290.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236290.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236290.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236290.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236290.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236290.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236290.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236290.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236290.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236290.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236290.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236290.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236290.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236290.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236290.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_219888 = mem_219888.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236291_task;
    
    futhark_mc_segmap_parloop_236291_task.name =
        "futhark_mc_segmap_parloop_236291";
    futhark_mc_segmap_parloop_236291_task.fn = futhark_mc_segmap_parloop_236291;
    futhark_mc_segmap_parloop_236291_task.args =
        &futhark_mc_segmap_parloop_struct_236290;
    futhark_mc_segmap_parloop_236291_task.iterations = iterations;
    futhark_mc_segmap_parloop_236291_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236291_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236291_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236291_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236291_task);
    
    if (futhark_mc_segmap_parloop_236291_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236291_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236291_total_end -
                 futhark_mc_segmap_parloop_236291_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236291_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236291_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236291_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236289_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236289_end -
                 futhark_mc_segmap_nested_task_236289_start;
        
        ctx->futhark_mc_segmap_nested_task_236289_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236289_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236289_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236321 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219982;
    unsigned char *free_mem_219986;
};
struct futhark_mc_segmap_parloop_struct_236323 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219982;
    unsigned char *free_mem_219986;
};
static int futhark_mc_segmap_parloop_236324(void *args, int64_t start,
                                            int64_t end, int flat_tid_213980,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236323
    *futhark_mc_segmap_parloop_struct_236323 =
    (struct futhark_mc_segmap_parloop_struct_236323 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236323->ctx;
    uint64_t futhark_mc_segmap_parloop_236324_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236324_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236323->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236323->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236323->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236323->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236323->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236323->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236323->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236323->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236323->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236323->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236323->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236323->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219982 = {.desc ="mem_219982", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_219982,
                                  .size =0, .references =NULL};
    struct memblock mem_219986 = {.desc ="mem_219986", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_219986,
                                  .size =0, .references =NULL};
    size_t mem_219906_cached_sizze_236325 = 0;
    unsigned char *mem_219906 = NULL;
    size_t mem_219921_cached_sizze_236326 = 0;
    unsigned char *mem_219921 = NULL;
    size_t mem_219924_cached_sizze_236327 = 0;
    unsigned char *mem_219924 = NULL;
    size_t mem_219951_cached_sizze_236328 = 0;
    unsigned char *mem_219951 = NULL;
    size_t mem_219954_cached_sizze_236329 = 0;
    unsigned char *mem_219954 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232243 = start;
    
    if (mem_219906_cached_sizze_236325 < (size_t) bytes_217302) {
        mem_219906 = realloc(mem_219906, bytes_217302);
        mem_219906_cached_sizze_236325 = bytes_217302;
    }
    if (mem_219921_cached_sizze_236326 < (size_t) bytes_217302) {
        mem_219921 = realloc(mem_219921, bytes_217302);
        mem_219921_cached_sizze_236326 = bytes_217302;
    }
    if (mem_219924_cached_sizze_236327 < (size_t) bytes_217302) {
        mem_219924 = realloc(mem_219924, bytes_217302);
        mem_219924_cached_sizze_236327 = bytes_217302;
    }
    if (mem_219951_cached_sizze_236328 < (size_t) bytes_217782) {
        mem_219951 = realloc(mem_219951, bytes_217782);
        mem_219951_cached_sizze_236328 = bytes_217782;
    }
    if (mem_219954_cached_sizze_236329 < (size_t) bytes_217782) {
        mem_219954 = realloc(mem_219954, bytes_217782);
        mem_219954_cached_sizze_236329 = bytes_217782;
    }
    for (; iter_232243 < end; iter_232243++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232352 = partition_sizze_203577;
        int64_t gtid_213981 = iter_232243;
        int64_t remnant_232353 = iter_232243 - gtid_213981;
        int64_t x_205953;
        
        x_205953 = ((int64_t *) mem_217343.mem)[gtid_213981];
        for (int64_t i_232244 = 0; i_232244 < n_203490; i_232244++) {
            double x_232246;
            
            x_232246 = ((double *) mem_217297.mem)[gtid_213981 * n_203490 +
                                                   i_232244];
            
            double x_232247;
            
            x_232247 = ((double *) mem_219808.mem)[gtid_213981 * n_203490 +
                                                   i_232244];
            
            double defunc_1_f_res_232248 = x_232246 - x_232247;
            
            ((double *) mem_219906)[i_232244] = defunc_1_f_res_232248;
        }
        for (int64_t i_232250 = 0; i_232250 < n_203490; i_232250++) {
            int64_t x_232253;
            
            x_232253 = ((int64_t *) mem_217340.mem)[gtid_213981 * n_203490 +
                                                    i_232250];
            
            bool cond_232254 = sle64((int64_t) 0, x_232253);
            double defunc_0_f_res_232255;
            
            if (cond_232254) {
                bool y_232256 = slt64(x_232253, n_203490);
                bool bounds_check_232257 = cond_232254 && y_232256;
                bool index_certs_232258;
                
                if (!bounds_check_232257) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232253,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_232259;
                
                defunc_0_f_res_t_res_232259 = ((double *) mem_219906)[x_232253];
                defunc_0_f_res_232255 = defunc_0_f_res_t_res_232259;
            } else {
                defunc_0_f_res_232255 = 0.0;
            }
            
            double defunc_0_f_res_232260;
            
            if (cond_232254) {
                bool y_232261 = slt64(x_232253, n_203490);
                bool bounds_check_232262 = cond_232254 && y_232261;
                bool index_certs_232263;
                
                if (!bounds_check_232262) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232253,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_232264;
                
                defunc_0_f_res_t_res_232264 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_213981 *
                                                       ctx_param_ext_217867 +
                                                       x_232253 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_232260 = defunc_0_f_res_t_res_232264;
            } else {
                defunc_0_f_res_232260 = 0.0;
            }
            ((double *) mem_219921)[i_232250] = defunc_0_f_res_232260;
            ((double *) mem_219924)[i_232250] = defunc_0_f_res_232255;
        }
        for (int64_t i_232267 = 0; i_232267 < t_n_m_203650; i_232267++) {
            int64_t x_232270;
            
            x_232270 = ((int64_t *) mem_217835.mem)[gtid_213981 * t_n_m_203650 +
                                                    i_232267];
            
            double x_232271;
            
            x_232271 = ((double *) mem_217839.mem)[gtid_213981 * t_n_m_203650 +
                                                   i_232267];
            
            int64_t min_arg_232272 = mul64(jump_t_203500, i_232267);
            int64_t min_res_232273 = smin64(i_203670, min_arg_232272);
            int64_t defunc_0_g_res_232274 = add64((int64_t) 1, min_res_232273);
            double defunc_2_reduce_res_232275;
            double defunc_2_reduce_res_232276;
            double defunc_2_reduce_res_232277;
            double redout_232279;
            double redout_232280;
            double redout_232281;
            
            redout_232279 = 0.0;
            redout_232280 = 0.0;
            redout_232281 = 0.0;
            for (int64_t i_232278 = 0; i_232278 < q_t_203494; i_232278++) {
                bool cond_232282 = sle64(x_205953, i_232278);
                int64_t defunc_0_f_res_232283;
                
                if (cond_232282) {
                    defunc_0_f_res_232283 = (int64_t) 0;
                } else {
                    int64_t i_232284 = add64(x_232270, i_232278);
                    int64_t defunc_0_add_arg_232285;
                    
                    defunc_0_add_arg_232285 =
                        ((int64_t *) mem_217340.mem)[gtid_213981 * n_203490 +
                                                     i_232284];
                    
                    int64_t defunc_1_add_res_232286 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232285);
                    
                    defunc_0_f_res_232283 = defunc_1_add_res_232286;
                }
                
                double defunc_0_f_res_232287;
                
                if (cond_232282) {
                    defunc_0_f_res_232287 = 0.0;
                } else {
                    int64_t i_232288 = add64(x_232270, i_232278);
                    double defunc_0_add_arg_232289;
                    
                    defunc_0_add_arg_232289 = ((double *) mem_219921)[i_232288];
                    defunc_0_f_res_232287 = defunc_0_add_arg_232289;
                }
                
                int64_t binop_p_232290 = sub64(defunc_0_f_res_232283,
                                               defunc_0_g_res_232274);
                double defunc_0_f_res_232291 = sitofp_i64_f64(binop_p_232290);
                double abs_res_232292 = fabs(defunc_0_f_res_232291);
                double tmp1_232293 = abs_res_232292 / x_232271;
                double x_232294 = tmp1_232293 * tmp1_232293;
                double y_232295 = tmp1_232293 * x_232294;
                double tmp2_232296 = 1.0 - y_232295;
                double x_232297 = tmp2_232296 * tmp2_232296;
                double tmp3_232298 = tmp2_232296 * x_232297;
                double w_j_232299 = defunc_0_f_res_232287 * tmp3_232298;
                double xw_j_232300 = defunc_0_f_res_232291 * w_j_232299;
                double x2w_j_232301 = defunc_0_f_res_232291 * xw_j_232300;
                double defunc_1_op_res_232302 = w_j_232299 + redout_232279;
                double defunc_1_op_res_232303 = xw_j_232300 + redout_232280;
                double defunc_1_op_res_232304 = x2w_j_232301 + redout_232281;
                double redout_tmp_232359 = defunc_1_op_res_232302;
                double redout_tmp_232360 = defunc_1_op_res_232303;
                double redout_tmp_232361 = defunc_1_op_res_232304;
                
                redout_232279 = redout_tmp_232359;
                redout_232280 = redout_tmp_232360;
                redout_232281 = redout_tmp_232361;
            }
            defunc_2_reduce_res_232275 = redout_232279;
            defunc_2_reduce_res_232276 = redout_232280;
            defunc_2_reduce_res_232277 = redout_232281;
            
            double x_232305 = defunc_2_reduce_res_232275 *
                   defunc_2_reduce_res_232277;
            double y_232306 = defunc_2_reduce_res_232276 *
                   defunc_2_reduce_res_232276;
            double y_232307 = x_232305 - y_232306;
            double det1_232308 = 1.0 / y_232307;
            double a11_232309 = defunc_2_reduce_res_232277 * det1_232308;
            double x_232310 = 0.0 - defunc_2_reduce_res_232276;
            double b11_232311 = det1_232308 * x_232310;
            double c11_232312 = defunc_2_reduce_res_232275 * det1_232308;
            double defunc_2_reduce_res_232313;
            double defunc_2_reduce_res_232314;
            double redout_232316;
            double redout_232317;
            
            redout_232316 = 0.0;
            redout_232317 = 0.0;
            for (int64_t i_232315 = 0; i_232315 < q_t_203494; i_232315++) {
                bool cond_232318 = sle64(x_205953, i_232315);
                int64_t defunc_0_f_res_232319;
                
                if (cond_232318) {
                    defunc_0_f_res_232319 = (int64_t) 0;
                } else {
                    int64_t i_232320 = add64(x_232270, i_232315);
                    int64_t defunc_0_add_arg_232321;
                    
                    defunc_0_add_arg_232321 =
                        ((int64_t *) mem_217340.mem)[gtid_213981 * n_203490 +
                                                     i_232320];
                    
                    int64_t defunc_1_add_res_232322 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232321);
                    
                    defunc_0_f_res_232319 = defunc_1_add_res_232322;
                }
                
                double defunc_0_f_res_232323;
                
                if (cond_232318) {
                    defunc_0_f_res_232323 = 0.0;
                } else {
                    int64_t i_232324 = add64(x_232270, i_232315);
                    double defunc_0_add_arg_232325;
                    
                    defunc_0_add_arg_232325 = ((double *) mem_219921)[i_232324];
                    defunc_0_f_res_232323 = defunc_0_add_arg_232325;
                }
                
                int64_t binop_p_232326 = sub64(defunc_0_f_res_232319,
                                               defunc_0_g_res_232274);
                double defunc_0_f_res_232327 = sitofp_i64_f64(binop_p_232326);
                double abs_res_232328 = fabs(defunc_0_f_res_232327);
                double tmp1_232329 = abs_res_232328 / x_232271;
                double x_232330 = tmp1_232329 * tmp1_232329;
                double y_232331 = tmp1_232329 * x_232330;
                double tmp2_232332 = 1.0 - y_232331;
                double x_232333 = tmp2_232332 * tmp2_232332;
                double tmp3_232334 = tmp2_232332 * x_232333;
                double tmp4_232335 = defunc_0_f_res_232323 * tmp3_232334;
                double defunc_1_f_res_232336 = defunc_0_f_res_232327 *
                       tmp4_232335;
                double defunc_0_f_res_232337;
                
                if (cond_232318) {
                    defunc_0_f_res_232337 = 0.0;
                } else {
                    int64_t i_232338 = add64(x_232270, i_232315);
                    double defunc_0_add_arg_232339;
                    
                    defunc_0_add_arg_232339 = ((double *) mem_219924)[i_232338];
                    defunc_0_f_res_232337 = defunc_0_add_arg_232339;
                }
                
                double x_232340 = a11_232309 * tmp4_232335;
                double y_232341 = b11_232311 * defunc_1_f_res_232336;
                double x_232342 = x_232340 + y_232341;
                double defunc_9_fit_fun_res_232343 = defunc_0_f_res_232337 *
                       x_232342;
                double x_232344 = b11_232311 * tmp4_232335;
                double y_232345 = c11_232312 * defunc_1_f_res_232336;
                double x_232346 = x_232344 + y_232345;
                double defunc_9_slope_fun_res_232347 = defunc_0_f_res_232337 *
                       x_232346;
                double defunc_1_op_res_232348 = defunc_9_fit_fun_res_232343 +
                       redout_232316;
                double defunc_1_op_res_232349 = defunc_9_slope_fun_res_232347 +
                       redout_232317;
                double redout_tmp_232362 = defunc_1_op_res_232348;
                double redout_tmp_232363 = defunc_1_op_res_232349;
                
                redout_232316 = redout_tmp_232362;
                redout_232317 = redout_tmp_232363;
            }
            defunc_2_reduce_res_232313 = redout_232316;
            defunc_2_reduce_res_232314 = redout_232317;
            ((double *) mem_219951)[i_232267] = defunc_2_reduce_res_232313;
            ((double *) mem_219954)[i_232267] = defunc_2_reduce_res_232314;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_219982.mem + gtid_213981 * t_n_m_203650 * (int64_t) 8,
                    mem_219951 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_219986.mem + gtid_213981 * t_n_m_203650 * (int64_t) 8,
                    mem_219954 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219906);
    free(mem_219921);
    free(mem_219924);
    free(mem_219951);
    free(mem_219954);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236324_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236324_end -
                 futhark_mc_segmap_parloop_236324_start;
        
        ctx->futhark_mc_segmap_parloop_236324_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236324_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236324_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236322(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213980 = tid;
    int num_tasks_232242 = info.nsubtasks;
    struct futhark_mc_task_236321 *futhark_mc_task_236321 =
                                  (struct futhark_mc_task_236321 *) args;
    struct futhark_context *ctx = futhark_mc_task_236321->ctx;
    uint64_t futhark_mc_segmap_task_236322_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236322_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236321->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236321->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236321->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236321->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236321->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236321->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236321->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236321->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236321->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236321->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236321->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236321->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236321->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236321->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236321->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236321->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236321->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236321->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219982 = {.desc ="mem_219982", .mem =
                                  futhark_mc_task_236321->free_mem_219982,
                                  .size =0, .references =NULL};
    struct memblock mem_219986 = {.desc ="mem_219986", .mem =
                                  futhark_mc_task_236321->free_mem_219986,
                                  .size =0, .references =NULL};
    int64_t iter_232243;
    struct futhark_mc_segmap_parloop_struct_236323
    futhark_mc_segmap_parloop_struct_236323;
    
    futhark_mc_segmap_parloop_struct_236323.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236323.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236323.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236323.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236323.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236323.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236323.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236323.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236323.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236323.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236323.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236323.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236323.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236323.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236323.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236323.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236323.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236323.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236323.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236323.free_mem_219982 = mem_219982.mem;
    futhark_mc_segmap_parloop_struct_236323.free_mem_219986 = mem_219986.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236324_task;
    
    futhark_mc_segmap_parloop_236324_task.name =
        "futhark_mc_segmap_parloop_236324";
    futhark_mc_segmap_parloop_236324_task.fn = futhark_mc_segmap_parloop_236324;
    futhark_mc_segmap_parloop_236324_task.args =
        &futhark_mc_segmap_parloop_struct_236323;
    futhark_mc_segmap_parloop_236324_task.iterations = iterations;
    futhark_mc_segmap_parloop_236324_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236324_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236324_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236324_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236324_task);
    
    if (futhark_mc_segmap_parloop_236324_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236324_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236324_total_end -
                 futhark_mc_segmap_parloop_236324_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236324_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236324_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236324_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236322_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236322_end -
                 futhark_mc_segmap_task_236322_start;
        
        ctx->futhark_mc_segmap_task_236322_runs[tid]++;
        ctx->futhark_mc_segmap_task_236322_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236322_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236331 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219982;
    unsigned char *free_mem_219986;
};
struct futhark_mc_task_236338 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219891;
};
struct futhark_mc_segmap_parloop_struct_236340 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219891;
};
static int futhark_mc_segmap_parloop_236341(void *args, int64_t start,
                                            int64_t end, int flat_tid_232365,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236340
    *futhark_mc_segmap_parloop_struct_236340 =
    (struct futhark_mc_segmap_parloop_struct_236340 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236340->ctx;
    uint64_t futhark_mc_segmap_parloop_236341_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236341_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236340->free_n_203490;
    int64_t gtid_214089 =
            futhark_mc_segmap_parloop_struct_236340->free_gtid_214089;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236340->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236340->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219891 = {.desc ="mem_219891", .mem =
                                  futhark_mc_segmap_parloop_struct_236340->free_mem_219891,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232558 = start;
    
    for (; iter_232558 < end; iter_232558++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232559 = n_203490;
        int64_t gtid_232366 = iter_232558;
        int64_t remnant_232560 = iter_232558 - gtid_232366;
        double x_232367;
        
        x_232367 = ((double *) mem_217297.mem)[gtid_214089 * n_203490 +
                                               gtid_232366];
        
        double x_232368;
        
        x_232368 = ((double *) mem_219808.mem)[gtid_214089 * n_203490 +
                                               gtid_232366];
        
        double defunc_1_f_res_232369 = x_232367 - x_232368;
        
        ((double *) mem_219891.mem)[gtid_232366] = defunc_1_f_res_232369;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236341_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236341_end -
                 futhark_mc_segmap_parloop_236341_start;
        
        ctx->futhark_mc_segmap_parloop_236341_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236341_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236341_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236339(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232365 = tid;
    int num_tasks_232557 = info.nsubtasks;
    struct futhark_mc_task_236338 *futhark_mc_task_236338 =
                                  (struct futhark_mc_task_236338 *) args;
    struct futhark_context *ctx = futhark_mc_task_236338->ctx;
    uint64_t futhark_mc_segmap_task_236339_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236339_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236338->free_n_203490;
    int64_t gtid_214089 = futhark_mc_task_236338->free_gtid_214089;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236338->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236338->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219891 = {.desc ="mem_219891", .mem =
                                  futhark_mc_task_236338->free_mem_219891,
                                  .size =0, .references =NULL};
    int64_t iter_232558;
    struct futhark_mc_segmap_parloop_struct_236340
    futhark_mc_segmap_parloop_struct_236340;
    
    futhark_mc_segmap_parloop_struct_236340.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236340.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236340.free_gtid_214089 = gtid_214089;
    futhark_mc_segmap_parloop_struct_236340.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236340.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236340.free_mem_219891 = mem_219891.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236341_task;
    
    futhark_mc_segmap_parloop_236341_task.name =
        "futhark_mc_segmap_parloop_236341";
    futhark_mc_segmap_parloop_236341_task.fn = futhark_mc_segmap_parloop_236341;
    futhark_mc_segmap_parloop_236341_task.args =
        &futhark_mc_segmap_parloop_struct_236340;
    futhark_mc_segmap_parloop_236341_task.iterations = iterations;
    futhark_mc_segmap_parloop_236341_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236341_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236341_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236341_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236341_task);
    
    if (futhark_mc_segmap_parloop_236341_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236341_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236341_total_end -
                 futhark_mc_segmap_parloop_236341_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236341_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236341_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236341_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236339_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236339_end -
                 futhark_mc_segmap_task_236339_start;
        
        ctx->futhark_mc_segmap_task_236339_runs[tid]++;
        ctx->futhark_mc_segmap_task_236339_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236339_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236342 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219891;
    unsigned char *free_mem_219894;
    unsigned char *free_mem_219897;
};
struct futhark_mc_segmap_parloop_struct_236344 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219891;
    unsigned char *free_mem_219894;
    unsigned char *free_mem_219897;
};
static int futhark_mc_segmap_parloop_236345(void *args, int64_t start,
                                            int64_t end, int flat_tid_232370,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236344
    *futhark_mc_segmap_parloop_struct_236344 =
    (struct futhark_mc_segmap_parloop_struct_236344 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236344->ctx;
    uint64_t futhark_mc_segmap_parloop_236345_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236345_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236344->free_n_203490;
    int64_t gtid_214089 =
            futhark_mc_segmap_parloop_struct_236344->free_gtid_214089;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236344->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236344->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236344->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236344->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236344->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219891 = {.desc ="mem_219891", .mem =
                                  futhark_mc_segmap_parloop_struct_236344->free_mem_219891,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_segmap_parloop_struct_236344->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_segmap_parloop_struct_236344->free_mem_219897,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232562 = start;
    
    for (; iter_232562 < end; iter_232562++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232571 = n_203490;
        int64_t gtid_232371 = iter_232562;
        int64_t remnant_232572 = iter_232562 - gtid_232371;
        int64_t x_232372;
        
        x_232372 = ((int64_t *) mem_217340.mem)[gtid_214089 * n_203490 +
                                                gtid_232371];
        
        bool cond_232373 = sle64((int64_t) 0, x_232372);
        double defunc_0_f_res_232374;
        
        if (cond_232373) {
            bool y_232563 = slt64(x_232372, n_203490);
            bool bounds_check_232564 = cond_232373 && y_232563;
            bool index_certs_232565;
            
            if (!bounds_check_232564) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232372,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_232566;
            
            defunc_0_f_res_t_res_232566 = ((double *) mem_219891.mem)[x_232372];
            defunc_0_f_res_232374 = defunc_0_f_res_t_res_232566;
        } else {
            defunc_0_f_res_232374 = 0.0;
        }
        
        double defunc_0_f_res_232379;
        
        if (cond_232373) {
            bool y_232567 = slt64(x_232372, n_203490);
            bool bounds_check_232568 = cond_232373 && y_232567;
            bool index_certs_232569;
            
            if (!bounds_check_232568) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232372,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_232570;
            
            defunc_0_f_res_t_res_232570 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_214089 *
                                                   ctx_param_ext_217867 +
                                                   x_232372 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_232379 = defunc_0_f_res_t_res_232570;
        } else {
            defunc_0_f_res_232379 = 0.0;
        }
        ((double *) mem_219894.mem)[gtid_232371] = defunc_0_f_res_232379;
        ((double *) mem_219897.mem)[gtid_232371] = defunc_0_f_res_232374;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236345_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236345_end -
                 futhark_mc_segmap_parloop_236345_start;
        
        ctx->futhark_mc_segmap_parloop_236345_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236345_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236345_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236343(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232370 = tid;
    int num_tasks_232561 = info.nsubtasks;
    struct futhark_mc_task_236342 *futhark_mc_task_236342 =
                                  (struct futhark_mc_task_236342 *) args;
    struct futhark_context *ctx = futhark_mc_task_236342->ctx;
    uint64_t futhark_mc_segmap_task_236343_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236343_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236342->free_n_203490;
    int64_t gtid_214089 = futhark_mc_task_236342->free_gtid_214089;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236342->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236342->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236342->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236342->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236342->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219891 = {.desc ="mem_219891", .mem =
                                  futhark_mc_task_236342->free_mem_219891,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_task_236342->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_task_236342->free_mem_219897,
                                  .size =0, .references =NULL};
    int64_t iter_232562;
    struct futhark_mc_segmap_parloop_struct_236344
    futhark_mc_segmap_parloop_struct_236344;
    
    futhark_mc_segmap_parloop_struct_236344.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236344.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236344.free_gtid_214089 = gtid_214089;
    futhark_mc_segmap_parloop_struct_236344.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236344.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236344.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236344.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236344.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236344.free_mem_219891 = mem_219891.mem;
    futhark_mc_segmap_parloop_struct_236344.free_mem_219894 = mem_219894.mem;
    futhark_mc_segmap_parloop_struct_236344.free_mem_219897 = mem_219897.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236345_task;
    
    futhark_mc_segmap_parloop_236345_task.name =
        "futhark_mc_segmap_parloop_236345";
    futhark_mc_segmap_parloop_236345_task.fn = futhark_mc_segmap_parloop_236345;
    futhark_mc_segmap_parloop_236345_task.args =
        &futhark_mc_segmap_parloop_struct_236344;
    futhark_mc_segmap_parloop_236345_task.iterations = iterations;
    futhark_mc_segmap_parloop_236345_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236345_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236345_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236345_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236345_task);
    
    if (futhark_mc_segmap_parloop_236345_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236345_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236345_total_end -
                 futhark_mc_segmap_parloop_236345_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236345_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236345_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236345_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236343_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236343_end -
                 futhark_mc_segmap_task_236343_start;
        
        ctx->futhark_mc_segmap_task_236343_runs[tid]++;
        ctx->futhark_mc_segmap_task_236343_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236343_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236346 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214089;
    int64_t free_x_214094;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219894;
    unsigned char *free_mem_219897;
    unsigned char *free_mem_219900;
    unsigned char *free_mem_219903;
};
struct futhark_mc_segmap_parloop_struct_236348 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214089;
    int64_t free_x_214094;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219894;
    unsigned char *free_mem_219897;
    unsigned char *free_mem_219900;
    unsigned char *free_mem_219903;
};
static int futhark_mc_segmap_parloop_236349(void *args, int64_t start,
                                            int64_t end, int flat_tid_232473,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236348
    *futhark_mc_segmap_parloop_struct_236348 =
    (struct futhark_mc_segmap_parloop_struct_236348 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236348->ctx;
    uint64_t futhark_mc_segmap_parloop_236349_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236349_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236348->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236348->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236348->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236348->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236348->free_i_203670;
    int64_t gtid_214089 =
            futhark_mc_segmap_parloop_struct_236348->free_gtid_214089;
    int64_t x_214094 = futhark_mc_segmap_parloop_struct_236348->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236348->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236348->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236348->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_segmap_parloop_struct_236348->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_segmap_parloop_struct_236348->free_mem_219897,
                                  .size =0, .references =NULL};
    struct memblock mem_219900 = {.desc ="mem_219900", .mem =
                                  futhark_mc_segmap_parloop_struct_236348->free_mem_219900,
                                  .size =0, .references =NULL};
    struct memblock mem_219903 = {.desc ="mem_219903", .mem =
                                  futhark_mc_segmap_parloop_struct_236348->free_mem_219903,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232574 = start;
    
    for (; iter_232574 < end; iter_232574++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232637 = t_n_m_203650;
        int64_t gtid_232474 = iter_232574;
        int64_t remnant_232638 = iter_232574 - gtid_232474;
        int64_t x_232475;
        
        x_232475 = ((int64_t *) mem_217835.mem)[gtid_214089 * t_n_m_203650 +
                                                gtid_232474];
        
        double x_232476;
        
        x_232476 = ((double *) mem_217839.mem)[gtid_214089 * t_n_m_203650 +
                                               gtid_232474];
        
        int64_t min_arg_232477 = mul64(jump_t_203500, gtid_232474);
        int64_t min_res_232478 = smin64(i_203670, min_arg_232477);
        int64_t defunc_0_g_res_232479 = add64((int64_t) 1, min_res_232478);
        double defunc_2_reduce_res_232480;
        double defunc_2_reduce_res_232481;
        double defunc_2_reduce_res_232482;
        double redout_232576;
        double redout_232577;
        double redout_232578;
        
        redout_232576 = 0.0;
        redout_232577 = 0.0;
        redout_232578 = 0.0;
        for (int64_t i_232575 = 0; i_232575 < q_t_203494; i_232575++) {
            bool cond_232579 = sle64(x_214094, i_232575);
            int64_t defunc_0_f_res_232580;
            
            if (cond_232579) {
                defunc_0_f_res_232580 = (int64_t) 0;
            } else {
                int64_t i_232581 = add64(x_232475, i_232575);
                int64_t defunc_0_add_arg_232582;
                
                defunc_0_add_arg_232582 =
                    ((int64_t *) mem_217340.mem)[gtid_214089 * n_203490 +
                                                 i_232581];
                
                int64_t defunc_1_add_res_232583 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232582);
                
                defunc_0_f_res_232580 = defunc_1_add_res_232583;
            }
            
            double defunc_0_f_res_232584;
            
            if (cond_232579) {
                defunc_0_f_res_232584 = 0.0;
            } else {
                int64_t i_232585 = add64(x_232475, i_232575);
                double defunc_0_add_arg_232586;
                
                defunc_0_add_arg_232586 = ((double *) mem_219894.mem)[i_232585];
                defunc_0_f_res_232584 = defunc_0_add_arg_232586;
            }
            
            int64_t binop_p_232587 = sub64(defunc_0_f_res_232580,
                                           defunc_0_g_res_232479);
            double defunc_0_f_res_232588 = sitofp_i64_f64(binop_p_232587);
            double abs_res_232589 = fabs(defunc_0_f_res_232588);
            double tmp1_232590 = abs_res_232589 / x_232476;
            double x_232591 = tmp1_232590 * tmp1_232590;
            double y_232592 = tmp1_232590 * x_232591;
            double tmp2_232593 = 1.0 - y_232592;
            double x_232594 = tmp2_232593 * tmp2_232593;
            double tmp3_232595 = tmp2_232593 * x_232594;
            double w_j_232596 = defunc_0_f_res_232584 * tmp3_232595;
            double xw_j_232597 = defunc_0_f_res_232588 * w_j_232596;
            double x2w_j_232598 = defunc_0_f_res_232588 * xw_j_232597;
            double defunc_1_op_res_232599 = w_j_232596 + redout_232576;
            double defunc_1_op_res_232600 = xw_j_232597 + redout_232577;
            double defunc_1_op_res_232601 = x2w_j_232598 + redout_232578;
            double redout_tmp_232639 = defunc_1_op_res_232599;
            double redout_tmp_232640 = defunc_1_op_res_232600;
            double redout_tmp_232641 = defunc_1_op_res_232601;
            
            redout_232576 = redout_tmp_232639;
            redout_232577 = redout_tmp_232640;
            redout_232578 = redout_tmp_232641;
        }
        defunc_2_reduce_res_232480 = redout_232576;
        defunc_2_reduce_res_232481 = redout_232577;
        defunc_2_reduce_res_232482 = redout_232578;
        
        double x_232510 = defunc_2_reduce_res_232480 *
               defunc_2_reduce_res_232482;
        double y_232511 = defunc_2_reduce_res_232481 *
               defunc_2_reduce_res_232481;
        double y_232512 = x_232510 - y_232511;
        double det1_232513 = 1.0 / y_232512;
        double a11_232514 = defunc_2_reduce_res_232482 * det1_232513;
        double x_232515 = 0.0 - defunc_2_reduce_res_232481;
        double b11_232516 = det1_232513 * x_232515;
        double c11_232517 = defunc_2_reduce_res_232480 * det1_232513;
        double defunc_2_reduce_res_232518;
        double defunc_2_reduce_res_232519;
        double redout_232603;
        double redout_232604;
        
        redout_232603 = 0.0;
        redout_232604 = 0.0;
        for (int64_t i_232602 = 0; i_232602 < q_t_203494; i_232602++) {
            bool cond_232605 = sle64(x_214094, i_232602);
            int64_t defunc_0_f_res_232606;
            
            if (cond_232605) {
                defunc_0_f_res_232606 = (int64_t) 0;
            } else {
                int64_t i_232607 = add64(x_232475, i_232602);
                int64_t defunc_0_add_arg_232608;
                
                defunc_0_add_arg_232608 =
                    ((int64_t *) mem_217340.mem)[gtid_214089 * n_203490 +
                                                 i_232607];
                
                int64_t defunc_1_add_res_232609 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232608);
                
                defunc_0_f_res_232606 = defunc_1_add_res_232609;
            }
            
            double defunc_0_f_res_232610;
            
            if (cond_232605) {
                defunc_0_f_res_232610 = 0.0;
            } else {
                int64_t i_232611 = add64(x_232475, i_232602);
                double defunc_0_add_arg_232612;
                
                defunc_0_add_arg_232612 = ((double *) mem_219894.mem)[i_232611];
                defunc_0_f_res_232610 = defunc_0_add_arg_232612;
            }
            
            int64_t binop_p_232613 = sub64(defunc_0_f_res_232606,
                                           defunc_0_g_res_232479);
            double defunc_0_f_res_232614 = sitofp_i64_f64(binop_p_232613);
            double abs_res_232615 = fabs(defunc_0_f_res_232614);
            double tmp1_232616 = abs_res_232615 / x_232476;
            double x_232617 = tmp1_232616 * tmp1_232616;
            double y_232618 = tmp1_232616 * x_232617;
            double tmp2_232619 = 1.0 - y_232618;
            double x_232620 = tmp2_232619 * tmp2_232619;
            double tmp3_232621 = tmp2_232619 * x_232620;
            double tmp4_232622 = defunc_0_f_res_232610 * tmp3_232621;
            double defunc_1_f_res_232623 = defunc_0_f_res_232614 * tmp4_232622;
            double defunc_0_f_res_232624;
            
            if (cond_232605) {
                defunc_0_f_res_232624 = 0.0;
            } else {
                int64_t i_232625 = add64(x_232475, i_232602);
                double defunc_0_add_arg_232626;
                
                defunc_0_add_arg_232626 = ((double *) mem_219897.mem)[i_232625];
                defunc_0_f_res_232624 = defunc_0_add_arg_232626;
            }
            
            double x_232627 = a11_232514 * tmp4_232622;
            double y_232628 = b11_232516 * defunc_1_f_res_232623;
            double x_232629 = x_232627 + y_232628;
            double defunc_9_fit_fun_res_232630 = defunc_0_f_res_232624 *
                   x_232629;
            double x_232631 = b11_232516 * tmp4_232622;
            double y_232632 = c11_232517 * defunc_1_f_res_232623;
            double x_232633 = x_232631 + y_232632;
            double defunc_9_slope_fun_res_232634 = defunc_0_f_res_232624 *
                   x_232633;
            double defunc_1_op_res_232635 = defunc_9_fit_fun_res_232630 +
                   redout_232603;
            double defunc_1_op_res_232636 = defunc_9_slope_fun_res_232634 +
                   redout_232604;
            double redout_tmp_232642 = defunc_1_op_res_232635;
            double redout_tmp_232643 = defunc_1_op_res_232636;
            
            redout_232603 = redout_tmp_232642;
            redout_232604 = redout_tmp_232643;
        }
        defunc_2_reduce_res_232518 = redout_232603;
        defunc_2_reduce_res_232519 = redout_232604;
        ((double *) mem_219900.mem)[gtid_232474] = defunc_2_reduce_res_232518;
        ((double *) mem_219903.mem)[gtid_232474] = defunc_2_reduce_res_232519;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236349_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236349_end -
                 futhark_mc_segmap_parloop_236349_start;
        
        ctx->futhark_mc_segmap_parloop_236349_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236349_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236349_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236347(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232473 = tid;
    int num_tasks_232573 = info.nsubtasks;
    struct futhark_mc_task_236346 *futhark_mc_task_236346 =
                                  (struct futhark_mc_task_236346 *) args;
    struct futhark_context *ctx = futhark_mc_task_236346->ctx;
    uint64_t futhark_mc_segmap_task_236347_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236347_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236346->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236346->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236346->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236346->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236346->free_i_203670;
    int64_t gtid_214089 = futhark_mc_task_236346->free_gtid_214089;
    int64_t x_214094 = futhark_mc_task_236346->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236346->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236346->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236346->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_task_236346->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_task_236346->free_mem_219897,
                                  .size =0, .references =NULL};
    struct memblock mem_219900 = {.desc ="mem_219900", .mem =
                                  futhark_mc_task_236346->free_mem_219900,
                                  .size =0, .references =NULL};
    struct memblock mem_219903 = {.desc ="mem_219903", .mem =
                                  futhark_mc_task_236346->free_mem_219903,
                                  .size =0, .references =NULL};
    int64_t iter_232574;
    struct futhark_mc_segmap_parloop_struct_236348
    futhark_mc_segmap_parloop_struct_236348;
    
    futhark_mc_segmap_parloop_struct_236348.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236348.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236348.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236348.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236348.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236348.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236348.free_gtid_214089 = gtid_214089;
    futhark_mc_segmap_parloop_struct_236348.free_x_214094 = x_214094;
    futhark_mc_segmap_parloop_struct_236348.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236348.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236348.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236348.free_mem_219894 = mem_219894.mem;
    futhark_mc_segmap_parloop_struct_236348.free_mem_219897 = mem_219897.mem;
    futhark_mc_segmap_parloop_struct_236348.free_mem_219900 = mem_219900.mem;
    futhark_mc_segmap_parloop_struct_236348.free_mem_219903 = mem_219903.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236349_task;
    
    futhark_mc_segmap_parloop_236349_task.name =
        "futhark_mc_segmap_parloop_236349";
    futhark_mc_segmap_parloop_236349_task.fn = futhark_mc_segmap_parloop_236349;
    futhark_mc_segmap_parloop_236349_task.args =
        &futhark_mc_segmap_parloop_struct_236348;
    futhark_mc_segmap_parloop_236349_task.iterations = iterations;
    futhark_mc_segmap_parloop_236349_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236349_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236349_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236349_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236349_task);
    
    if (futhark_mc_segmap_parloop_236349_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236349_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236349_total_end -
                 futhark_mc_segmap_parloop_236349_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236349_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236349_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236349_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236347_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236347_end -
                 futhark_mc_segmap_task_236347_start;
        
        ctx->futhark_mc_segmap_task_236347_runs[tid]++;
        ctx->futhark_mc_segmap_task_236347_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236347_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236351 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214089;
    int64_t free_x_214094;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219894;
    unsigned char *free_mem_219897;
    unsigned char *free_mem_219900;
    unsigned char *free_mem_219903;
};
struct futhark_mc_task_236353 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    int64_t free_x_214094;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219894;
    int64_t free_x_232386;
    double free_x_232387;
    int64_t free_defunc_0_g_res_232390;
    double *retval_defunc_2_reduce_res_232391;
    double *retval_defunc_2_reduce_res_232392;
    double *retval_defunc_2_reduce_res_232393;
};
struct futhark_mc_segred_stage_1_parloop_struct_236358 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    int64_t free_x_214094;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219894;
    int64_t free_x_232386;
    double free_x_232387;
    int64_t free_defunc_0_g_res_232390;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232717;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232719;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232721;
};
static int futhark_mc_segred_stage_1_parloop_236359(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232645,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236358
    *futhark_mc_segred_stage_1_parloop_struct_236358 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236358 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236358->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236359_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236359_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236358->free_n_203490;
    int64_t gtid_214089 =
            futhark_mc_segred_stage_1_parloop_struct_236358->free_gtid_214089;
    int64_t x_214094 =
            futhark_mc_segred_stage_1_parloop_struct_236358->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236358->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236358->free_mem_219894,
                                  .size =0, .references =NULL};
    int64_t x_232386 =
            futhark_mc_segred_stage_1_parloop_struct_236358->free_x_232386;
    double x_232387 =
           futhark_mc_segred_stage_1_parloop_struct_236358->free_x_232387;
    int64_t defunc_0_g_res_232390 =
            futhark_mc_segred_stage_1_parloop_struct_236358->free_defunc_0_g_res_232390;
    struct memblock reduce_stage_1_tid_res_arr_mem_232717 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232717",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236358->free_reduce_stage_1_tid_res_arr_mem_232717,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_232719 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232719",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236358->free_reduce_stage_1_tid_res_arr_mem_232719,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_232721 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232721",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236358->free_reduce_stage_1_tid_res_arr_mem_232721,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232723 = start;
    double x_232647;
    double x_232648;
    double x_232650;
    double x_232651;
    double x_232653;
    double x_232654;
    double local_acc_232724 = 0.0;
    double local_acc_232725 = 0.0;
    double local_acc_232726 = 0.0;
    
    for (; iter_232723 < end; iter_232723++) {
        int64_t gtid_232646 = iter_232723;
        bool cond_232656 = sle64(x_214094, gtid_232646);
        int64_t defunc_0_f_res_232657;
        
        if (cond_232656) {
            defunc_0_f_res_232657 = (int64_t) 0;
        } else {
            int64_t i_232658 = add64(x_232386, gtid_232646);
            int64_t defunc_0_add_arg_232659;
            
            defunc_0_add_arg_232659 = ((int64_t *) mem_217340.mem)[gtid_214089 *
                                                                   n_203490 +
                                                                   i_232658];
            
            int64_t defunc_1_add_res_232660 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232659);
            
            defunc_0_f_res_232657 = defunc_1_add_res_232660;
        }
        
        double defunc_0_f_res_232661;
        
        if (cond_232656) {
            defunc_0_f_res_232661 = 0.0;
        } else {
            int64_t i_232662 = add64(x_232386, gtid_232646);
            double defunc_0_add_arg_232663;
            
            defunc_0_add_arg_232663 = ((double *) mem_219894.mem)[i_232662];
            defunc_0_f_res_232661 = defunc_0_add_arg_232663;
        }
        
        int64_t binop_p_232664 = sub64(defunc_0_f_res_232657,
                                       defunc_0_g_res_232390);
        double defunc_0_f_res_232665 = sitofp_i64_f64(binop_p_232664);
        double abs_res_232666 = fabs(defunc_0_f_res_232665);
        double tmp1_232667 = abs_res_232666 / x_232387;
        double x_232668 = tmp1_232667 * tmp1_232667;
        double y_232669 = tmp1_232667 * x_232668;
        double tmp2_232670 = 1.0 - y_232669;
        double x_232671 = tmp2_232670 * tmp2_232670;
        double tmp3_232672 = tmp2_232670 * x_232671;
        double w_j_232673 = defunc_0_f_res_232661 * tmp3_232672;
        double xw_j_232674 = defunc_0_f_res_232665 * w_j_232673;
        double x2w_j_232675 = defunc_0_f_res_232665 * xw_j_232674;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232647 = local_acc_232724;
        }
        // Load next params
        {
            x_232648 = w_j_232673;
        }
        // Red body
        {
            double defunc_1_op_res_232649 = x_232647 + x_232648;
            
            local_acc_232724 = defunc_1_op_res_232649;
        }
        // Load accum params
        {
            x_232650 = local_acc_232725;
        }
        // Load next params
        {
            x_232651 = xw_j_232674;
        }
        // Red body
        {
            double defunc_1_op_res_232652 = x_232650 + x_232651;
            
            local_acc_232725 = defunc_1_op_res_232652;
        }
        // Load accum params
        {
            x_232653 = local_acc_232726;
        }
        // Load next params
        {
            x_232654 = x2w_j_232675;
        }
        // Red body
        {
            double defunc_1_op_res_232655 = x_232653 + x_232654;
            
            local_acc_232726 = defunc_1_op_res_232655;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232717.mem)[flat_tid_232645] =
        local_acc_232724;
    ((double *) reduce_stage_1_tid_res_arr_mem_232719.mem)[flat_tid_232645] =
        local_acc_232725;
    ((double *) reduce_stage_1_tid_res_arr_mem_232721.mem)[flat_tid_232645] =
        local_acc_232726;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236359_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236359_end -
                 futhark_mc_segred_stage_1_parloop_236359_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236359_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236359_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236359_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236354(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232645 = tid;
    int num_tasks_232716 = info.nsubtasks;
    struct futhark_mc_task_236353 *futhark_mc_task_236353 =
                                  (struct futhark_mc_task_236353 *) args;
    struct futhark_context *ctx = futhark_mc_task_236353->ctx;
    uint64_t futhark_mc_segred_task_236354_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236354_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236353->free_n_203490;
    int64_t gtid_214089 = futhark_mc_task_236353->free_gtid_214089;
    int64_t x_214094 = futhark_mc_task_236353->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236353->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_task_236353->free_mem_219894,
                                  .size =0, .references =NULL};
    int64_t x_232386 = futhark_mc_task_236353->free_x_232386;
    double x_232387 = futhark_mc_task_236353->free_x_232387;
    int64_t defunc_0_g_res_232390 =
            futhark_mc_task_236353->free_defunc_0_g_res_232390;
    double defunc_2_reduce_res_232391 =
           *futhark_mc_task_236353->retval_defunc_2_reduce_res_232391;
    double defunc_2_reduce_res_232392 =
           *futhark_mc_task_236353->retval_defunc_2_reduce_res_232392;
    double defunc_2_reduce_res_232393 =
           *futhark_mc_task_236353->retval_defunc_2_reduce_res_232393;
    size_t reduce_stage_1_tid_res_arr_mem_232717_cached_sizze_236355 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232717 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_232719_cached_sizze_236356 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232719 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_232721_cached_sizze_236357 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232721 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232717_cached_sizze_236355 <
        (size_t) ((int64_t) 8 * num_tasks_232716)) {
        reduce_stage_1_tid_res_arr_mem_232717 =
            realloc(reduce_stage_1_tid_res_arr_mem_232717, (int64_t) 8 *
                    num_tasks_232716);
        reduce_stage_1_tid_res_arr_mem_232717_cached_sizze_236355 =
            (int64_t) 8 * num_tasks_232716;
    }
    if (reduce_stage_1_tid_res_arr_mem_232719_cached_sizze_236356 <
        (size_t) ((int64_t) 8 * num_tasks_232716)) {
        reduce_stage_1_tid_res_arr_mem_232719 =
            realloc(reduce_stage_1_tid_res_arr_mem_232719, (int64_t) 8 *
                    num_tasks_232716);
        reduce_stage_1_tid_res_arr_mem_232719_cached_sizze_236356 =
            (int64_t) 8 * num_tasks_232716;
    }
    if (reduce_stage_1_tid_res_arr_mem_232721_cached_sizze_236357 <
        (size_t) ((int64_t) 8 * num_tasks_232716)) {
        reduce_stage_1_tid_res_arr_mem_232721 =
            realloc(reduce_stage_1_tid_res_arr_mem_232721, (int64_t) 8 *
                    num_tasks_232716);
        reduce_stage_1_tid_res_arr_mem_232721_cached_sizze_236357 =
            (int64_t) 8 * num_tasks_232716;
    }
    
    int64_t iter_232723;
    struct futhark_mc_segred_stage_1_parloop_struct_236358
    futhark_mc_segred_stage_1_parloop_struct_236358;
    
    futhark_mc_segred_stage_1_parloop_struct_236358.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_gtid_214089 =
        gtid_214089;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_x_214094 = x_214094;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_mem_219894 =
        mem_219894.mem;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_x_232386 = x_232386;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_x_232387 = x_232387;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_defunc_0_g_res_232390 =
        defunc_0_g_res_232390;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_reduce_stage_1_tid_res_arr_mem_232717 =
        reduce_stage_1_tid_res_arr_mem_232717;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_reduce_stage_1_tid_res_arr_mem_232719 =
        reduce_stage_1_tid_res_arr_mem_232719;
    futhark_mc_segred_stage_1_parloop_struct_236358.free_reduce_stage_1_tid_res_arr_mem_232721 =
        reduce_stage_1_tid_res_arr_mem_232721;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236359_task;
    
    futhark_mc_segred_stage_1_parloop_236359_task.name =
        "futhark_mc_segred_stage_1_parloop_236359";
    futhark_mc_segred_stage_1_parloop_236359_task.fn =
        futhark_mc_segred_stage_1_parloop_236359;
    futhark_mc_segred_stage_1_parloop_236359_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236358;
    futhark_mc_segred_stage_1_parloop_236359_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236359_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236359_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236359_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236359_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236359_task);
    
    if (futhark_mc_segred_stage_1_parloop_236359_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236359_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236359_total_end -
                 futhark_mc_segred_stage_1_parloop_236359_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236359_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236359_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236359_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232391 = 0.0;
        defunc_2_reduce_res_232392 = 0.0;
        defunc_2_reduce_res_232393 = 0.0;
    }
    
    double x_232727;
    double x_232728;
    double x_232730;
    double x_232731;
    double x_232733;
    double x_232734;
    
    for (int32_t i_232736 = 0; i_232736 < num_tasks_232716; i_232736++) {
        flat_tid_232645 = i_232736;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232727 = defunc_2_reduce_res_232391;
            }
            // load next params
            {
                x_232728 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232717)[flat_tid_232645];
            }
            // red body
            {
                double defunc_1_op_res_232729 = x_232727 + x_232728;
                
                defunc_2_reduce_res_232391 = defunc_1_op_res_232729;
            }
            // load acc params
            {
                x_232730 = defunc_2_reduce_res_232392;
            }
            // load next params
            {
                x_232731 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232719)[flat_tid_232645];
            }
            // red body
            {
                double defunc_1_op_res_232732 = x_232730 + x_232731;
                
                defunc_2_reduce_res_232392 = defunc_1_op_res_232732;
            }
            // load acc params
            {
                x_232733 = defunc_2_reduce_res_232393;
            }
            // load next params
            {
                x_232734 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232721)[flat_tid_232645];
            }
            // red body
            {
                double defunc_1_op_res_232735 = x_232733 + x_232734;
                
                defunc_2_reduce_res_232393 = defunc_1_op_res_232735;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232717);
        free(reduce_stage_1_tid_res_arr_mem_232719);
        free(reduce_stage_1_tid_res_arr_mem_232721);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236354_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236354_end -
                 futhark_mc_segred_task_236354_start;
        
        ctx->futhark_mc_segred_task_236354_runs[tid]++;
        ctx->futhark_mc_segred_task_236354_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236354_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236353->retval_defunc_2_reduce_res_232391 =
            defunc_2_reduce_res_232391;
        *futhark_mc_task_236353->retval_defunc_2_reduce_res_232392 =
            defunc_2_reduce_res_232392;
        *futhark_mc_task_236353->retval_defunc_2_reduce_res_232393 =
            defunc_2_reduce_res_232393;
    }
    return err;
}
struct futhark_mc_task_236360 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    int64_t free_x_214094;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219894;
    unsigned char *free_mem_219897;
    int64_t free_x_232386;
    double free_x_232387;
    int64_t free_defunc_0_g_res_232390;
    double free_a11_232429;
    double free_b11_232431;
    double free_c11_232432;
    double *retval_defunc_2_reduce_res_232433;
    double *retval_defunc_2_reduce_res_232434;
};
struct futhark_mc_segred_stage_1_parloop_struct_236364 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214089;
    int64_t free_x_214094;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219894;
    unsigned char *free_mem_219897;
    int64_t free_x_232386;
    double free_x_232387;
    int64_t free_defunc_0_g_res_232390;
    double free_a11_232429;
    double free_b11_232431;
    double free_c11_232432;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232738;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232740;
};
static int futhark_mc_segred_stage_1_parloop_236365(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232676,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236364
    *futhark_mc_segred_stage_1_parloop_struct_236364 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236364 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236364->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236365_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236365_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236364->free_n_203490;
    int64_t gtid_214089 =
            futhark_mc_segred_stage_1_parloop_struct_236364->free_gtid_214089;
    int64_t x_214094 =
            futhark_mc_segred_stage_1_parloop_struct_236364->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236364->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236364->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236364->free_mem_219897,
                                  .size =0, .references =NULL};
    int64_t x_232386 =
            futhark_mc_segred_stage_1_parloop_struct_236364->free_x_232386;
    double x_232387 =
           futhark_mc_segred_stage_1_parloop_struct_236364->free_x_232387;
    int64_t defunc_0_g_res_232390 =
            futhark_mc_segred_stage_1_parloop_struct_236364->free_defunc_0_g_res_232390;
    double a11_232429 =
           futhark_mc_segred_stage_1_parloop_struct_236364->free_a11_232429;
    double b11_232431 =
           futhark_mc_segred_stage_1_parloop_struct_236364->free_b11_232431;
    double c11_232432 =
           futhark_mc_segred_stage_1_parloop_struct_236364->free_c11_232432;
    struct memblock reduce_stage_1_tid_res_arr_mem_232738 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232738",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236364->free_reduce_stage_1_tid_res_arr_mem_232738,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_232740 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232740",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236364->free_reduce_stage_1_tid_res_arr_mem_232740,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232742 = start;
    double x_232678;
    double x_232679;
    double x_232681;
    double x_232682;
    double local_acc_232743 = 0.0;
    double local_acc_232744 = 0.0;
    
    for (; iter_232742 < end; iter_232742++) {
        int64_t gtid_232677 = iter_232742;
        bool cond_232684 = sle64(x_214094, gtid_232677);
        int64_t defunc_0_f_res_232685;
        
        if (cond_232684) {
            defunc_0_f_res_232685 = (int64_t) 0;
        } else {
            int64_t i_232686 = add64(x_232386, gtid_232677);
            int64_t defunc_0_add_arg_232687;
            
            defunc_0_add_arg_232687 = ((int64_t *) mem_217340.mem)[gtid_214089 *
                                                                   n_203490 +
                                                                   i_232686];
            
            int64_t defunc_1_add_res_232688 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232687);
            
            defunc_0_f_res_232685 = defunc_1_add_res_232688;
        }
        
        double defunc_0_f_res_232689;
        
        if (cond_232684) {
            defunc_0_f_res_232689 = 0.0;
        } else {
            int64_t i_232690 = add64(x_232386, gtid_232677);
            double defunc_0_add_arg_232691;
            
            defunc_0_add_arg_232691 = ((double *) mem_219894.mem)[i_232690];
            defunc_0_f_res_232689 = defunc_0_add_arg_232691;
        }
        
        int64_t binop_p_232692 = sub64(defunc_0_f_res_232685,
                                       defunc_0_g_res_232390);
        double defunc_0_f_res_232693 = sitofp_i64_f64(binop_p_232692);
        double abs_res_232694 = fabs(defunc_0_f_res_232693);
        double tmp1_232695 = abs_res_232694 / x_232387;
        double x_232696 = tmp1_232695 * tmp1_232695;
        double y_232697 = tmp1_232695 * x_232696;
        double tmp2_232698 = 1.0 - y_232697;
        double x_232699 = tmp2_232698 * tmp2_232698;
        double tmp3_232700 = tmp2_232698 * x_232699;
        double tmp4_232701 = defunc_0_f_res_232689 * tmp3_232700;
        double defunc_1_f_res_232702 = defunc_0_f_res_232693 * tmp4_232701;
        double defunc_0_f_res_232703;
        
        if (cond_232684) {
            defunc_0_f_res_232703 = 0.0;
        } else {
            int64_t i_232704 = add64(x_232386, gtid_232677);
            double defunc_0_add_arg_232705;
            
            defunc_0_add_arg_232705 = ((double *) mem_219897.mem)[i_232704];
            defunc_0_f_res_232703 = defunc_0_add_arg_232705;
        }
        
        double x_232706 = a11_232429 * tmp4_232701;
        double y_232707 = b11_232431 * defunc_1_f_res_232702;
        double x_232708 = x_232706 + y_232707;
        double defunc_9_fit_fun_res_232709 = defunc_0_f_res_232703 * x_232708;
        double x_232710 = b11_232431 * tmp4_232701;
        double y_232711 = c11_232432 * defunc_1_f_res_232702;
        double x_232712 = x_232710 + y_232711;
        double defunc_9_slope_fun_res_232713 = defunc_0_f_res_232703 * x_232712;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232678 = local_acc_232743;
        }
        // Load next params
        {
            x_232679 = defunc_9_fit_fun_res_232709;
        }
        // Red body
        {
            double defunc_1_op_res_232680 = x_232678 + x_232679;
            
            local_acc_232743 = defunc_1_op_res_232680;
        }
        // Load accum params
        {
            x_232681 = local_acc_232744;
        }
        // Load next params
        {
            x_232682 = defunc_9_slope_fun_res_232713;
        }
        // Red body
        {
            double defunc_1_op_res_232683 = x_232681 + x_232682;
            
            local_acc_232744 = defunc_1_op_res_232683;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232738.mem)[flat_tid_232676] =
        local_acc_232743;
    ((double *) reduce_stage_1_tid_res_arr_mem_232740.mem)[flat_tid_232676] =
        local_acc_232744;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236365_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236365_end -
                 futhark_mc_segred_stage_1_parloop_236365_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236365_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236365_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236365_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236361(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232676 = tid;
    int num_tasks_232737 = info.nsubtasks;
    struct futhark_mc_task_236360 *futhark_mc_task_236360 =
                                  (struct futhark_mc_task_236360 *) args;
    struct futhark_context *ctx = futhark_mc_task_236360->ctx;
    uint64_t futhark_mc_segred_task_236361_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236361_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236360->free_n_203490;
    int64_t gtid_214089 = futhark_mc_task_236360->free_gtid_214089;
    int64_t x_214094 = futhark_mc_task_236360->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236360->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_task_236360->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_task_236360->free_mem_219897,
                                  .size =0, .references =NULL};
    int64_t x_232386 = futhark_mc_task_236360->free_x_232386;
    double x_232387 = futhark_mc_task_236360->free_x_232387;
    int64_t defunc_0_g_res_232390 =
            futhark_mc_task_236360->free_defunc_0_g_res_232390;
    double a11_232429 = futhark_mc_task_236360->free_a11_232429;
    double b11_232431 = futhark_mc_task_236360->free_b11_232431;
    double c11_232432 = futhark_mc_task_236360->free_c11_232432;
    double defunc_2_reduce_res_232433 =
           *futhark_mc_task_236360->retval_defunc_2_reduce_res_232433;
    double defunc_2_reduce_res_232434 =
           *futhark_mc_task_236360->retval_defunc_2_reduce_res_232434;
    size_t reduce_stage_1_tid_res_arr_mem_232738_cached_sizze_236362 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232738 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_232740_cached_sizze_236363 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232740 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232738_cached_sizze_236362 <
        (size_t) ((int64_t) 8 * num_tasks_232737)) {
        reduce_stage_1_tid_res_arr_mem_232738 =
            realloc(reduce_stage_1_tid_res_arr_mem_232738, (int64_t) 8 *
                    num_tasks_232737);
        reduce_stage_1_tid_res_arr_mem_232738_cached_sizze_236362 =
            (int64_t) 8 * num_tasks_232737;
    }
    if (reduce_stage_1_tid_res_arr_mem_232740_cached_sizze_236363 <
        (size_t) ((int64_t) 8 * num_tasks_232737)) {
        reduce_stage_1_tid_res_arr_mem_232740 =
            realloc(reduce_stage_1_tid_res_arr_mem_232740, (int64_t) 8 *
                    num_tasks_232737);
        reduce_stage_1_tid_res_arr_mem_232740_cached_sizze_236363 =
            (int64_t) 8 * num_tasks_232737;
    }
    
    int64_t iter_232742;
    struct futhark_mc_segred_stage_1_parloop_struct_236364
    futhark_mc_segred_stage_1_parloop_struct_236364;
    
    futhark_mc_segred_stage_1_parloop_struct_236364.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_gtid_214089 =
        gtid_214089;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_x_214094 = x_214094;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_mem_219894 =
        mem_219894.mem;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_mem_219897 =
        mem_219897.mem;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_x_232386 = x_232386;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_x_232387 = x_232387;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_defunc_0_g_res_232390 =
        defunc_0_g_res_232390;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_a11_232429 =
        a11_232429;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_b11_232431 =
        b11_232431;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_c11_232432 =
        c11_232432;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_reduce_stage_1_tid_res_arr_mem_232738 =
        reduce_stage_1_tid_res_arr_mem_232738;
    futhark_mc_segred_stage_1_parloop_struct_236364.free_reduce_stage_1_tid_res_arr_mem_232740 =
        reduce_stage_1_tid_res_arr_mem_232740;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236365_task;
    
    futhark_mc_segred_stage_1_parloop_236365_task.name =
        "futhark_mc_segred_stage_1_parloop_236365";
    futhark_mc_segred_stage_1_parloop_236365_task.fn =
        futhark_mc_segred_stage_1_parloop_236365;
    futhark_mc_segred_stage_1_parloop_236365_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236364;
    futhark_mc_segred_stage_1_parloop_236365_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236365_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236365_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236365_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236365_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236365_task);
    
    if (futhark_mc_segred_stage_1_parloop_236365_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236365_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236365_total_end -
                 futhark_mc_segred_stage_1_parloop_236365_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236365_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236365_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236365_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232433 = 0.0;
        defunc_2_reduce_res_232434 = 0.0;
    }
    
    double x_232745;
    double x_232746;
    double x_232748;
    double x_232749;
    
    for (int32_t i_232751 = 0; i_232751 < num_tasks_232737; i_232751++) {
        flat_tid_232676 = i_232751;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232745 = defunc_2_reduce_res_232433;
            }
            // load next params
            {
                x_232746 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232738)[flat_tid_232676];
            }
            // red body
            {
                double defunc_1_op_res_232747 = x_232745 + x_232746;
                
                defunc_2_reduce_res_232433 = defunc_1_op_res_232747;
            }
            // load acc params
            {
                x_232748 = defunc_2_reduce_res_232434;
            }
            // load next params
            {
                x_232749 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232740)[flat_tid_232676];
            }
            // red body
            {
                double defunc_1_op_res_232750 = x_232748 + x_232749;
                
                defunc_2_reduce_res_232434 = defunc_1_op_res_232750;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232738);
        free(reduce_stage_1_tid_res_arr_mem_232740);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236361_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236361_end -
                 futhark_mc_segred_task_236361_start;
        
        ctx->futhark_mc_segred_task_236361_runs[tid]++;
        ctx->futhark_mc_segred_task_236361_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236361_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236360->retval_defunc_2_reduce_res_232433 =
            defunc_2_reduce_res_232433;
        *futhark_mc_task_236360->retval_defunc_2_reduce_res_232434 =
            defunc_2_reduce_res_232434;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236352(void *args, int64_t start,
                                            int64_t end, int flat_tid_232384,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236351
    *futhark_mc_segmap_parloop_struct_236351 =
    (struct futhark_mc_segmap_parloop_struct_236351 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236351->ctx;
    uint64_t futhark_mc_segmap_parloop_236352_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236352_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236351->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236351->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236351->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236351->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236351->free_i_203670;
    int64_t gtid_214089 =
            futhark_mc_segmap_parloop_struct_236351->free_gtid_214089;
    int64_t x_214094 = futhark_mc_segmap_parloop_struct_236351->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236351->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236351->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236351->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_segmap_parloop_struct_236351->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_segmap_parloop_struct_236351->free_mem_219897,
                                  .size =0, .references =NULL};
    struct memblock mem_219900 = {.desc ="mem_219900", .mem =
                                  futhark_mc_segmap_parloop_struct_236351->free_mem_219900,
                                  .size =0, .references =NULL};
    struct memblock mem_219903 = {.desc ="mem_219903", .mem =
                                  futhark_mc_segmap_parloop_struct_236351->free_mem_219903,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232644 = start;
    
    for (; iter_232644 < end; iter_232644++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232714 = t_n_m_203650;
        int64_t gtid_232385 = iter_232644;
        int64_t remnant_232715 = iter_232644 - gtid_232385;
        int64_t x_232386;
        
        x_232386 = ((int64_t *) mem_217835.mem)[gtid_214089 * t_n_m_203650 +
                                                gtid_232385];
        
        double x_232387;
        
        x_232387 = ((double *) mem_217839.mem)[gtid_214089 * t_n_m_203650 +
                                               gtid_232385];
        
        int64_t min_arg_232388 = mul64(jump_t_203500, gtid_232385);
        int64_t min_res_232389 = smin64(i_203670, min_arg_232388);
        int64_t defunc_0_g_res_232390 = add64((int64_t) 1, min_res_232389);
        double defunc_2_reduce_res_232391;
        double defunc_2_reduce_res_232392;
        double defunc_2_reduce_res_232393;
        int64_t flat_tid_232645 = (int64_t) 0;
        int32_t num_tasks_232716;
        
        defunc_2_reduce_res_232391 = 0.0;
        defunc_2_reduce_res_232392 = 0.0;
        defunc_2_reduce_res_232393 = 0.0;
        
        struct futhark_mc_task_236353 futhark_mc_task_236353;
        
        futhark_mc_task_236353.ctx = ctx;
        futhark_mc_task_236353.free_n_203490 = n_203490;
        futhark_mc_task_236353.free_gtid_214089 = gtid_214089;
        futhark_mc_task_236353.free_x_214094 = x_214094;
        futhark_mc_task_236353.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236353.free_mem_219894 = mem_219894.mem;
        futhark_mc_task_236353.free_x_232386 = x_232386;
        futhark_mc_task_236353.free_x_232387 = x_232387;
        futhark_mc_task_236353.free_defunc_0_g_res_232390 =
            defunc_0_g_res_232390;
        futhark_mc_task_236353.retval_defunc_2_reduce_res_232391 =
            &defunc_2_reduce_res_232391;
        futhark_mc_task_236353.retval_defunc_2_reduce_res_232392 =
            &defunc_2_reduce_res_232392;
        futhark_mc_task_236353.retval_defunc_2_reduce_res_232393 =
            &defunc_2_reduce_res_232393;
        
        struct scheduler_segop futhark_mc_task_236353_task;
        
        futhark_mc_task_236353_task.args = &futhark_mc_task_236353;
        futhark_mc_task_236353_task.top_level_fn =
            futhark_mc_segred_task_236354;
        futhark_mc_task_236353_task.name = "futhark_mc_segred_task_236354";
        futhark_mc_task_236353_task.iterations = q_t_203494;
        futhark_mc_task_236353_task.task_time =
            &ctx->futhark_mc_segred_task_236354_total_time;
        futhark_mc_task_236353_task.task_iter =
            &ctx->futhark_mc_segred_task_236354_total_iter;
        futhark_mc_task_236353_task.sched = STATIC;
        futhark_mc_task_236353_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236354_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236353_task);
        
        if (futhark_mc_segred_task_236354_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_232425 = defunc_2_reduce_res_232391 *
               defunc_2_reduce_res_232393;
        double y_232426 = defunc_2_reduce_res_232392 *
               defunc_2_reduce_res_232392;
        double y_232427 = x_232425 - y_232426;
        double det1_232428 = 1.0 / y_232427;
        double a11_232429 = defunc_2_reduce_res_232393 * det1_232428;
        double x_232430 = 0.0 - defunc_2_reduce_res_232392;
        double b11_232431 = det1_232428 * x_232430;
        double c11_232432 = defunc_2_reduce_res_232391 * det1_232428;
        double defunc_2_reduce_res_232433;
        double defunc_2_reduce_res_232434;
        int64_t flat_tid_232676 = (int64_t) 0;
        int32_t num_tasks_232737;
        
        defunc_2_reduce_res_232433 = 0.0;
        defunc_2_reduce_res_232434 = 0.0;
        
        struct futhark_mc_task_236360 futhark_mc_task_236360;
        
        futhark_mc_task_236360.ctx = ctx;
        futhark_mc_task_236360.free_n_203490 = n_203490;
        futhark_mc_task_236360.free_gtid_214089 = gtid_214089;
        futhark_mc_task_236360.free_x_214094 = x_214094;
        futhark_mc_task_236360.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236360.free_mem_219894 = mem_219894.mem;
        futhark_mc_task_236360.free_mem_219897 = mem_219897.mem;
        futhark_mc_task_236360.free_x_232386 = x_232386;
        futhark_mc_task_236360.free_x_232387 = x_232387;
        futhark_mc_task_236360.free_defunc_0_g_res_232390 =
            defunc_0_g_res_232390;
        futhark_mc_task_236360.free_a11_232429 = a11_232429;
        futhark_mc_task_236360.free_b11_232431 = b11_232431;
        futhark_mc_task_236360.free_c11_232432 = c11_232432;
        futhark_mc_task_236360.retval_defunc_2_reduce_res_232433 =
            &defunc_2_reduce_res_232433;
        futhark_mc_task_236360.retval_defunc_2_reduce_res_232434 =
            &defunc_2_reduce_res_232434;
        
        struct scheduler_segop futhark_mc_task_236360_task;
        
        futhark_mc_task_236360_task.args = &futhark_mc_task_236360;
        futhark_mc_task_236360_task.top_level_fn =
            futhark_mc_segred_task_236361;
        futhark_mc_task_236360_task.name = "futhark_mc_segred_task_236361";
        futhark_mc_task_236360_task.iterations = q_t_203494;
        futhark_mc_task_236360_task.task_time =
            &ctx->futhark_mc_segred_task_236361_total_time;
        futhark_mc_task_236360_task.task_iter =
            &ctx->futhark_mc_segred_task_236361_total_iter;
        futhark_mc_task_236360_task.sched = STATIC;
        futhark_mc_task_236360_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236361_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236360_task);
        
        if (futhark_mc_segred_task_236361_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219900.mem)[gtid_232385] = defunc_2_reduce_res_232433;
        ((double *) mem_219903.mem)[gtid_232385] = defunc_2_reduce_res_232434;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236352_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236352_end -
                 futhark_mc_segmap_parloop_236352_start;
        
        ctx->futhark_mc_segmap_parloop_236352_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236352_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236352_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236350(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232384 = tid;
    int num_tasks_232573 = info.nsubtasks;
    struct futhark_mc_task_236346 *futhark_mc_task_236346 =
                                  (struct futhark_mc_task_236346 *) args;
    struct futhark_context *ctx = futhark_mc_task_236346->ctx;
    uint64_t futhark_mc_segmap_nested_task_236350_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236350_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236346->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236346->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236346->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236346->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236346->free_i_203670;
    int64_t gtid_214089 = futhark_mc_task_236346->free_gtid_214089;
    int64_t x_214094 = futhark_mc_task_236346->free_x_214094;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236346->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236346->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236346->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219894 = {.desc ="mem_219894", .mem =
                                  futhark_mc_task_236346->free_mem_219894,
                                  .size =0, .references =NULL};
    struct memblock mem_219897 = {.desc ="mem_219897", .mem =
                                  futhark_mc_task_236346->free_mem_219897,
                                  .size =0, .references =NULL};
    struct memblock mem_219900 = {.desc ="mem_219900", .mem =
                                  futhark_mc_task_236346->free_mem_219900,
                                  .size =0, .references =NULL};
    struct memblock mem_219903 = {.desc ="mem_219903", .mem =
                                  futhark_mc_task_236346->free_mem_219903,
                                  .size =0, .references =NULL};
    int64_t iter_232644;
    struct futhark_mc_segmap_parloop_struct_236351
    futhark_mc_segmap_parloop_struct_236351;
    
    futhark_mc_segmap_parloop_struct_236351.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236351.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236351.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236351.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236351.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236351.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236351.free_gtid_214089 = gtid_214089;
    futhark_mc_segmap_parloop_struct_236351.free_x_214094 = x_214094;
    futhark_mc_segmap_parloop_struct_236351.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236351.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236351.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236351.free_mem_219894 = mem_219894.mem;
    futhark_mc_segmap_parloop_struct_236351.free_mem_219897 = mem_219897.mem;
    futhark_mc_segmap_parloop_struct_236351.free_mem_219900 = mem_219900.mem;
    futhark_mc_segmap_parloop_struct_236351.free_mem_219903 = mem_219903.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236352_task;
    
    futhark_mc_segmap_parloop_236352_task.name =
        "futhark_mc_segmap_parloop_236352";
    futhark_mc_segmap_parloop_236352_task.fn = futhark_mc_segmap_parloop_236352;
    futhark_mc_segmap_parloop_236352_task.args =
        &futhark_mc_segmap_parloop_struct_236351;
    futhark_mc_segmap_parloop_236352_task.iterations = iterations;
    futhark_mc_segmap_parloop_236352_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236352_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236352_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236352_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236352_task);
    
    if (futhark_mc_segmap_parloop_236352_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236352_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236352_total_end -
                 futhark_mc_segmap_parloop_236352_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236352_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236352_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236352_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236350_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236350_end -
                 futhark_mc_segmap_nested_task_236350_start;
        
        ctx->futhark_mc_segmap_nested_task_236350_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236350_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236350_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236332(void *args, int64_t start,
                                            int64_t end, int flat_tid_214088,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236331
    *futhark_mc_segmap_parloop_struct_236331 =
    (struct futhark_mc_segmap_parloop_struct_236331 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236331->ctx;
    uint64_t futhark_mc_segmap_parloop_236332_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236332_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236331->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236331->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236331->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236331->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236331->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236331->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236331->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236331->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236331->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236331->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236331->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236331->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219982 = {.desc ="mem_219982", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_219982,
                                  .size =0, .references =NULL};
    struct memblock mem_219986 = {.desc ="mem_219986", .mem =
                                  futhark_mc_segmap_parloop_struct_236331->free_mem_219986,
                                  .size =0, .references =NULL};
    size_t mem_219891_cached_sizze_236333 = 0;
    unsigned char *mem_219891 = NULL;
    size_t mem_219894_cached_sizze_236334 = 0;
    unsigned char *mem_219894 = NULL;
    size_t mem_219897_cached_sizze_236335 = 0;
    unsigned char *mem_219897 = NULL;
    size_t mem_219900_cached_sizze_236336 = 0;
    unsigned char *mem_219900 = NULL;
    size_t mem_219903_cached_sizze_236337 = 0;
    unsigned char *mem_219903 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232364 = start;
    
    if (mem_219891_cached_sizze_236333 < (size_t) bytes_217302) {
        mem_219891 = realloc(mem_219891, bytes_217302);
        mem_219891_cached_sizze_236333 = bytes_217302;
    }
    if (mem_219894_cached_sizze_236334 < (size_t) bytes_217302) {
        mem_219894 = realloc(mem_219894, bytes_217302);
        mem_219894_cached_sizze_236334 = bytes_217302;
    }
    if (mem_219897_cached_sizze_236335 < (size_t) bytes_217302) {
        mem_219897 = realloc(mem_219897, bytes_217302);
        mem_219897_cached_sizze_236335 = bytes_217302;
    }
    if (mem_219900_cached_sizze_236336 < (size_t) bytes_217782) {
        mem_219900 = realloc(mem_219900, bytes_217782);
        mem_219900_cached_sizze_236336 = bytes_217782;
    }
    if (mem_219903_cached_sizze_236337 < (size_t) bytes_217782) {
        mem_219903 = realloc(mem_219903, bytes_217782);
        mem_219903_cached_sizze_236337 = bytes_217782;
    }
    for (; iter_232364 < end; iter_232364++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232555 = partition_sizze_203577;
        int64_t gtid_214089 = iter_232364;
        int64_t remnant_232556 = iter_232364 - gtid_214089;
        int64_t x_214094;
        
        x_214094 = ((int64_t *) mem_217343.mem)[gtid_214089];
        
        int64_t flat_tid_232365 = (int64_t) 0;
        int32_t num_tasks_232557;
        struct futhark_mc_task_236338 futhark_mc_task_236338;
        
        futhark_mc_task_236338.ctx = ctx;
        futhark_mc_task_236338.free_n_203490 = n_203490;
        futhark_mc_task_236338.free_gtid_214089 = gtid_214089;
        futhark_mc_task_236338.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236338.free_mem_219808 = mem_219808.mem;
        futhark_mc_task_236338.free_mem_219891 = mem_219891;
        
        struct scheduler_segop futhark_mc_task_236338_task;
        
        futhark_mc_task_236338_task.args = &futhark_mc_task_236338;
        futhark_mc_task_236338_task.top_level_fn =
            futhark_mc_segmap_task_236339;
        futhark_mc_task_236338_task.name = "futhark_mc_segmap_task_236339";
        futhark_mc_task_236338_task.iterations = n_203490;
        futhark_mc_task_236338_task.task_time =
            &ctx->futhark_mc_segmap_task_236339_total_time;
        futhark_mc_task_236338_task.task_iter =
            &ctx->futhark_mc_segmap_task_236339_total_iter;
        futhark_mc_task_236338_task.sched = STATIC;
        futhark_mc_task_236338_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236339_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236338_task);
        
        if (futhark_mc_segmap_task_236339_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232370 = (int64_t) 0;
        int32_t num_tasks_232561;
        struct futhark_mc_task_236342 futhark_mc_task_236342;
        
        futhark_mc_task_236342.ctx = ctx;
        futhark_mc_task_236342.free_n_203490 = n_203490;
        futhark_mc_task_236342.free_gtid_214089 = gtid_214089;
        futhark_mc_task_236342.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236342.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236342.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236342.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236342.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236342.free_mem_219891 = mem_219891;
        futhark_mc_task_236342.free_mem_219894 = mem_219894;
        futhark_mc_task_236342.free_mem_219897 = mem_219897;
        
        struct scheduler_segop futhark_mc_task_236342_task;
        
        futhark_mc_task_236342_task.args = &futhark_mc_task_236342;
        futhark_mc_task_236342_task.top_level_fn =
            futhark_mc_segmap_task_236343;
        futhark_mc_task_236342_task.name = "futhark_mc_segmap_task_236343";
        futhark_mc_task_236342_task.iterations = n_203490;
        futhark_mc_task_236342_task.task_time =
            &ctx->futhark_mc_segmap_task_236343_total_time;
        futhark_mc_task_236342_task.task_iter =
            &ctx->futhark_mc_segmap_task_236343_total_iter;
        futhark_mc_task_236342_task.sched = STATIC;
        futhark_mc_task_236342_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236343_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236342_task);
        
        if (futhark_mc_segmap_task_236343_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232473 = (int64_t) 0;
        int32_t num_tasks_232573;
        int64_t flat_tid_232384 = (int64_t) 0;
        struct futhark_mc_task_236346 futhark_mc_task_236346;
        
        futhark_mc_task_236346.ctx = ctx;
        futhark_mc_task_236346.free_n_203490 = n_203490;
        futhark_mc_task_236346.free_q_t_203494 = q_t_203494;
        futhark_mc_task_236346.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236346.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_236346.free_i_203670 = i_203670;
        futhark_mc_task_236346.free_gtid_214089 = gtid_214089;
        futhark_mc_task_236346.free_x_214094 = x_214094;
        futhark_mc_task_236346.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236346.free_mem_217835 = mem_217835.mem;
        futhark_mc_task_236346.free_mem_217839 = mem_217839.mem;
        futhark_mc_task_236346.free_mem_219894 = mem_219894;
        futhark_mc_task_236346.free_mem_219897 = mem_219897;
        futhark_mc_task_236346.free_mem_219900 = mem_219900;
        futhark_mc_task_236346.free_mem_219903 = mem_219903;
        
        struct scheduler_segop futhark_mc_task_236346_task;
        
        futhark_mc_task_236346_task.args = &futhark_mc_task_236346;
        futhark_mc_task_236346_task.top_level_fn =
            futhark_mc_segmap_task_236347;
        futhark_mc_task_236346_task.name = "futhark_mc_segmap_task_236347";
        futhark_mc_task_236346_task.iterations = t_n_m_203650;
        futhark_mc_task_236346_task.task_time =
            &ctx->futhark_mc_segmap_task_236347_total_time;
        futhark_mc_task_236346_task.task_iter =
            &ctx->futhark_mc_segmap_task_236347_total_iter;
        futhark_mc_task_236346_task.sched = STATIC;
        futhark_mc_task_236346_task.nested_fn =
            futhark_mc_segmap_nested_task_236350;
        
        int futhark_mc_segmap_task_236347_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236346_task);
        
        if (futhark_mc_segmap_task_236347_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_219982.mem + gtid_214089 * t_n_m_203650 * (int64_t) 8,
                    mem_219900 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_219986.mem + gtid_214089 * t_n_m_203650 * (int64_t) 8,
                    mem_219903 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219891);
    free(mem_219894);
    free(mem_219897);
    free(mem_219900);
    free(mem_219903);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236332_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236332_end -
                 futhark_mc_segmap_parloop_236332_start;
        
        ctx->futhark_mc_segmap_parloop_236332_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236332_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236332_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236330(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214088 = tid;
    int num_tasks_232242 = info.nsubtasks;
    struct futhark_mc_task_236321 *futhark_mc_task_236321 =
                                  (struct futhark_mc_task_236321 *) args;
    struct futhark_context *ctx = futhark_mc_task_236321->ctx;
    uint64_t futhark_mc_segmap_nested_task_236330_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236330_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236321->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236321->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236321->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236321->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236321->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236321->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236321->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236321->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236321->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236321->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236321->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236321->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236321->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236321->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236321->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236321->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236321->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236321->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219982 = {.desc ="mem_219982", .mem =
                                  futhark_mc_task_236321->free_mem_219982,
                                  .size =0, .references =NULL};
    struct memblock mem_219986 = {.desc ="mem_219986", .mem =
                                  futhark_mc_task_236321->free_mem_219986,
                                  .size =0, .references =NULL};
    int64_t iter_232364;
    struct futhark_mc_segmap_parloop_struct_236331
    futhark_mc_segmap_parloop_struct_236331;
    
    futhark_mc_segmap_parloop_struct_236331.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236331.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236331.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236331.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236331.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236331.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236331.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236331.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236331.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236331.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236331.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236331.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236331.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236331.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236331.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236331.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236331.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236331.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236331.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236331.free_mem_219982 = mem_219982.mem;
    futhark_mc_segmap_parloop_struct_236331.free_mem_219986 = mem_219986.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236332_task;
    
    futhark_mc_segmap_parloop_236332_task.name =
        "futhark_mc_segmap_parloop_236332";
    futhark_mc_segmap_parloop_236332_task.fn = futhark_mc_segmap_parloop_236332;
    futhark_mc_segmap_parloop_236332_task.args =
        &futhark_mc_segmap_parloop_struct_236331;
    futhark_mc_segmap_parloop_236332_task.iterations = iterations;
    futhark_mc_segmap_parloop_236332_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236332_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236332_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236332_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236332_task);
    
    if (futhark_mc_segmap_parloop_236332_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236332_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236332_total_end -
                 futhark_mc_segmap_parloop_236332_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236332_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236332_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236332_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236330_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236330_end -
                 futhark_mc_segmap_nested_task_236330_start;
        
        ctx->futhark_mc_segmap_nested_task_236330_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236330_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236330_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236366 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220080;
    unsigned char *free_mem_220084;
};
struct futhark_mc_segmap_parloop_struct_236368 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220080;
    unsigned char *free_mem_220084;
};
static int futhark_mc_segmap_parloop_236369(void *args, int64_t start,
                                            int64_t end, int flat_tid_214301,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236368
    *futhark_mc_segmap_parloop_struct_236368 =
    (struct futhark_mc_segmap_parloop_struct_236368 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236368->ctx;
    uint64_t futhark_mc_segmap_parloop_236369_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236369_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236368->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236368->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236368->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236368->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236368->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236368->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236368->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236368->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236368->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236368->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236368->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236368->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220080 = {.desc ="mem_220080", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_220080,
                                  .size =0, .references =NULL};
    struct memblock mem_220084 = {.desc ="mem_220084", .mem =
                                  futhark_mc_segmap_parloop_struct_236368->free_mem_220084,
                                  .size =0, .references =NULL};
    size_t mem_220004_cached_sizze_236370 = 0;
    unsigned char *mem_220004 = NULL;
    size_t mem_220019_cached_sizze_236371 = 0;
    unsigned char *mem_220019 = NULL;
    size_t mem_220022_cached_sizze_236372 = 0;
    unsigned char *mem_220022 = NULL;
    size_t mem_220049_cached_sizze_236373 = 0;
    unsigned char *mem_220049 = NULL;
    size_t mem_220052_cached_sizze_236374 = 0;
    unsigned char *mem_220052 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232753 = start;
    
    if (mem_220004_cached_sizze_236370 < (size_t) bytes_217302) {
        mem_220004 = realloc(mem_220004, bytes_217302);
        mem_220004_cached_sizze_236370 = bytes_217302;
    }
    if (mem_220019_cached_sizze_236371 < (size_t) bytes_217302) {
        mem_220019 = realloc(mem_220019, bytes_217302);
        mem_220019_cached_sizze_236371 = bytes_217302;
    }
    if (mem_220022_cached_sizze_236372 < (size_t) bytes_217302) {
        mem_220022 = realloc(mem_220022, bytes_217302);
        mem_220022_cached_sizze_236372 = bytes_217302;
    }
    if (mem_220049_cached_sizze_236373 < (size_t) bytes_217782) {
        mem_220049 = realloc(mem_220049, bytes_217782);
        mem_220049_cached_sizze_236373 = bytes_217782;
    }
    if (mem_220052_cached_sizze_236374 < (size_t) bytes_217782) {
        mem_220052 = realloc(mem_220052, bytes_217782);
        mem_220052_cached_sizze_236374 = bytes_217782;
    }
    for (; iter_232753 < end; iter_232753++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232892 = partition_sizze_203577;
        int64_t gtid_214302 = iter_232753;
        int64_t remnant_232893 = iter_232753 - gtid_214302;
        int64_t x_206071;
        
        x_206071 = ((int64_t *) mem_217343.mem)[gtid_214302];
        for (int64_t i_232754 = 0; i_232754 < n_203490; i_232754++) {
            double x_232756;
            
            x_232756 = ((double *) mem_217297.mem)[gtid_214302 * n_203490 +
                                                   i_232754];
            
            double x_232757;
            
            x_232757 = ((double *) mem_219808.mem)[gtid_214302 * n_203490 +
                                                   i_232754];
            
            double defunc_1_f_res_232758 = x_232756 - x_232757;
            
            ((double *) mem_220004)[i_232754] = defunc_1_f_res_232758;
        }
        for (int64_t i_232760 = 0; i_232760 < n_203490; i_232760++) {
            int64_t x_232763;
            
            x_232763 = ((int64_t *) mem_217340.mem)[gtid_214302 * n_203490 +
                                                    i_232760];
            
            bool cond_232764 = sle64((int64_t) 0, x_232763);
            double defunc_0_f_res_232765;
            
            if (cond_232764) {
                bool y_232766 = slt64(x_232763, n_203490);
                bool bounds_check_232767 = cond_232764 && y_232766;
                bool index_certs_232768;
                
                if (!bounds_check_232767) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232763,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_232769;
                
                defunc_0_f_res_t_res_232769 = ((double *) mem_220004)[x_232763];
                defunc_0_f_res_232765 = defunc_0_f_res_t_res_232769;
            } else {
                defunc_0_f_res_232765 = 0.0;
            }
            
            double defunc_0_f_res_232770;
            
            if (cond_232764) {
                bool y_232771 = slt64(x_232763, n_203490);
                bool bounds_check_232772 = cond_232764 && y_232771;
                bool index_certs_232773;
                
                if (!bounds_check_232772) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232763,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_232774;
                
                defunc_0_f_res_t_res_232774 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_214302 *
                                                       ctx_param_ext_217867 +
                                                       x_232763 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_232770 = defunc_0_f_res_t_res_232774;
            } else {
                defunc_0_f_res_232770 = 0.0;
            }
            ((double *) mem_220019)[i_232760] = defunc_0_f_res_232770;
            ((double *) mem_220022)[i_232760] = defunc_0_f_res_232765;
        }
        for (int64_t i_232777 = 0; i_232777 < t_n_m_203650; i_232777++) {
            int64_t x_232780;
            
            x_232780 = ((int64_t *) mem_217835.mem)[gtid_214302 * t_n_m_203650 +
                                                    i_232777];
            
            double x_232781;
            
            x_232781 = ((double *) mem_217839.mem)[gtid_214302 * t_n_m_203650 +
                                                   i_232777];
            
            int64_t min_arg_232782 = mul64(jump_t_203500, i_232777);
            int64_t min_res_232783 = smin64(i_203670, min_arg_232782);
            int64_t defunc_0_g_res_232784 = add64((int64_t) 1, min_res_232783);
            double defunc_2_reduce_res_232785;
            double defunc_2_reduce_res_232786;
            double defunc_2_reduce_res_232787;
            double defunc_2_reduce_res_232788;
            double defunc_2_reduce_res_232789;
            double redout_232791;
            double redout_232792;
            double redout_232793;
            double redout_232794;
            double redout_232795;
            
            redout_232791 = 0.0;
            redout_232792 = 0.0;
            redout_232793 = 0.0;
            redout_232794 = 0.0;
            redout_232795 = 0.0;
            for (int64_t i_232790 = 0; i_232790 < q_t_203494; i_232790++) {
                bool cond_232796 = sle64(x_206071, i_232790);
                int64_t defunc_0_f_res_232797;
                
                if (cond_232796) {
                    defunc_0_f_res_232797 = (int64_t) 0;
                } else {
                    int64_t i_232798 = add64(x_232780, i_232790);
                    int64_t defunc_0_add_arg_232799;
                    
                    defunc_0_add_arg_232799 =
                        ((int64_t *) mem_217340.mem)[gtid_214302 * n_203490 +
                                                     i_232798];
                    
                    int64_t defunc_1_add_res_232800 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232799);
                    
                    defunc_0_f_res_232797 = defunc_1_add_res_232800;
                }
                
                double defunc_0_f_res_232801;
                
                if (cond_232796) {
                    defunc_0_f_res_232801 = 0.0;
                } else {
                    int64_t i_232802 = add64(x_232780, i_232790);
                    double defunc_0_add_arg_232803;
                    
                    defunc_0_add_arg_232803 = ((double *) mem_220019)[i_232802];
                    defunc_0_f_res_232801 = defunc_0_add_arg_232803;
                }
                
                int64_t binop_p_232804 = sub64(defunc_0_f_res_232797,
                                               defunc_0_g_res_232784);
                double defunc_0_f_res_232805 = sitofp_i64_f64(binop_p_232804);
                double abs_res_232806 = fabs(defunc_0_f_res_232805);
                double tmp1_232807 = abs_res_232806 / x_232781;
                double x_232808 = tmp1_232807 * tmp1_232807;
                double y_232809 = tmp1_232807 * x_232808;
                double tmp2_232810 = 1.0 - y_232809;
                double x_232811 = tmp2_232810 * tmp2_232810;
                double tmp3_232812 = tmp2_232810 * x_232811;
                double w_j_232813 = defunc_0_f_res_232801 * tmp3_232812;
                double xw_j_232814 = defunc_0_f_res_232805 * w_j_232813;
                double x2w_j_232815 = defunc_0_f_res_232805 * xw_j_232814;
                double x3w_j_232816 = defunc_0_f_res_232805 * x2w_j_232815;
                double x4w_j_232817 = defunc_0_f_res_232805 * x3w_j_232816;
                double defunc_1_op_res_232818 = w_j_232813 + redout_232791;
                double defunc_1_op_res_232819 = xw_j_232814 + redout_232792;
                double defunc_1_op_res_232820 = x2w_j_232815 + redout_232793;
                double defunc_1_op_res_232821 = x3w_j_232816 + redout_232794;
                double defunc_1_op_res_232822 = x4w_j_232817 + redout_232795;
                double redout_tmp_232899 = defunc_1_op_res_232818;
                double redout_tmp_232900 = defunc_1_op_res_232819;
                double redout_tmp_232901 = defunc_1_op_res_232820;
                double redout_tmp_232902 = defunc_1_op_res_232821;
                double redout_tmp_232903 = defunc_1_op_res_232822;
                
                redout_232791 = redout_tmp_232899;
                redout_232792 = redout_tmp_232900;
                redout_232793 = redout_tmp_232901;
                redout_232794 = redout_tmp_232902;
                redout_232795 = redout_tmp_232903;
            }
            defunc_2_reduce_res_232785 = redout_232791;
            defunc_2_reduce_res_232786 = redout_232792;
            defunc_2_reduce_res_232787 = redout_232793;
            defunc_2_reduce_res_232788 = redout_232794;
            defunc_2_reduce_res_232789 = redout_232795;
            
            double x_232823 = defunc_2_reduce_res_232787 *
                   defunc_2_reduce_res_232789;
            double y_232824 = defunc_2_reduce_res_232788 *
                   defunc_2_reduce_res_232788;
            double a12_232825 = x_232823 - y_232824;
            double x_232826 = defunc_2_reduce_res_232787 *
                   defunc_2_reduce_res_232788;
            double y_232827 = defunc_2_reduce_res_232786 *
                   defunc_2_reduce_res_232789;
            double b12_232828 = x_232826 - y_232827;
            double x_232829 = defunc_2_reduce_res_232786 *
                   defunc_2_reduce_res_232788;
            double y_232830 = defunc_2_reduce_res_232787 *
                   defunc_2_reduce_res_232787;
            double c12_232831 = x_232829 - y_232830;
            double x_232832 = defunc_2_reduce_res_232785 *
                   defunc_2_reduce_res_232789;
            double b2_232833 = x_232832 - y_232830;
            double x_232834 = defunc_2_reduce_res_232786 *
                   defunc_2_reduce_res_232787;
            double y_232835 = defunc_2_reduce_res_232785 *
                   defunc_2_reduce_res_232788;
            double c2_232836 = x_232834 - y_232835;
            double x_232837 = defunc_2_reduce_res_232785 * a12_232825;
            double y_232838 = defunc_2_reduce_res_232786 * b12_232828;
            double x_232839 = x_232837 + y_232838;
            double y_232840 = defunc_2_reduce_res_232787 * c12_232831;
            double y_232841 = x_232839 + y_232840;
            double det_232842 = 1.0 / y_232841;
            double a12_232843 = a12_232825 * det_232842;
            double b12_232844 = b12_232828 * det_232842;
            double c12_232845 = c12_232831 * det_232842;
            double b2_232846 = b2_232833 * det_232842;
            double c2_232847 = c2_232836 * det_232842;
            double defunc_2_reduce_res_232848;
            double defunc_2_reduce_res_232849;
            double redout_232851;
            double redout_232852;
            
            redout_232851 = 0.0;
            redout_232852 = 0.0;
            for (int64_t i_232850 = 0; i_232850 < q_t_203494; i_232850++) {
                bool cond_232853 = sle64(x_206071, i_232850);
                int64_t defunc_0_f_res_232854;
                
                if (cond_232853) {
                    defunc_0_f_res_232854 = (int64_t) 0;
                } else {
                    int64_t i_232855 = add64(x_232780, i_232850);
                    int64_t defunc_0_add_arg_232856;
                    
                    defunc_0_add_arg_232856 =
                        ((int64_t *) mem_217340.mem)[gtid_214302 * n_203490 +
                                                     i_232855];
                    
                    int64_t defunc_1_add_res_232857 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232856);
                    
                    defunc_0_f_res_232854 = defunc_1_add_res_232857;
                }
                
                double defunc_0_f_res_232858;
                
                if (cond_232853) {
                    defunc_0_f_res_232858 = 0.0;
                } else {
                    int64_t i_232859 = add64(x_232780, i_232850);
                    double defunc_0_add_arg_232860;
                    
                    defunc_0_add_arg_232860 = ((double *) mem_220019)[i_232859];
                    defunc_0_f_res_232858 = defunc_0_add_arg_232860;
                }
                
                int64_t binop_p_232861 = sub64(defunc_0_f_res_232854,
                                               defunc_0_g_res_232784);
                double defunc_0_f_res_232862 = sitofp_i64_f64(binop_p_232861);
                double abs_res_232863 = fabs(defunc_0_f_res_232862);
                double tmp1_232864 = abs_res_232863 / x_232781;
                double x_232865 = tmp1_232864 * tmp1_232864;
                double y_232866 = tmp1_232864 * x_232865;
                double tmp2_232867 = 1.0 - y_232866;
                double x_232868 = tmp2_232867 * tmp2_232867;
                double tmp3_232869 = tmp2_232867 * x_232868;
                double tmp4_232870 = defunc_0_f_res_232858 * tmp3_232869;
                double defunc_1_f_res_232871 = defunc_0_f_res_232862 *
                       tmp4_232870;
                double defunc_1_f_res_232872 = defunc_0_f_res_232862 *
                       defunc_1_f_res_232871;
                double defunc_0_f_res_232873;
                
                if (cond_232853) {
                    defunc_0_f_res_232873 = 0.0;
                } else {
                    int64_t i_232874 = add64(x_232780, i_232850);
                    double defunc_0_add_arg_232875;
                    
                    defunc_0_add_arg_232875 = ((double *) mem_220022)[i_232874];
                    defunc_0_f_res_232873 = defunc_0_add_arg_232875;
                }
                
                double x_232876 = a12_232843 * tmp4_232870;
                double y_232877 = b12_232844 * defunc_1_f_res_232871;
                double x_232878 = x_232876 + y_232877;
                double y_232879 = c12_232845 * defunc_1_f_res_232872;
                double x_232880 = x_232878 + y_232879;
                double defunc_9_fit_fun_res_232881 = defunc_0_f_res_232873 *
                       x_232880;
                double x_232882 = b12_232844 * tmp4_232870;
                double y_232883 = b2_232846 * defunc_1_f_res_232871;
                double x_232884 = x_232882 + y_232883;
                double y_232885 = c2_232847 * defunc_1_f_res_232872;
                double x_232886 = x_232884 + y_232885;
                double defunc_9_slope_fun_res_232887 = defunc_0_f_res_232873 *
                       x_232886;
                double defunc_1_op_res_232888 = defunc_9_fit_fun_res_232881 +
                       redout_232851;
                double defunc_1_op_res_232889 = defunc_9_slope_fun_res_232887 +
                       redout_232852;
                double redout_tmp_232904 = defunc_1_op_res_232888;
                double redout_tmp_232905 = defunc_1_op_res_232889;
                
                redout_232851 = redout_tmp_232904;
                redout_232852 = redout_tmp_232905;
            }
            defunc_2_reduce_res_232848 = redout_232851;
            defunc_2_reduce_res_232849 = redout_232852;
            ((double *) mem_220049)[i_232777] = defunc_2_reduce_res_232848;
            ((double *) mem_220052)[i_232777] = defunc_2_reduce_res_232849;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220080.mem + gtid_214302 * t_n_m_203650 * (int64_t) 8,
                    mem_220049 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220084.mem + gtid_214302 * t_n_m_203650 * (int64_t) 8,
                    mem_220052 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220004);
    free(mem_220019);
    free(mem_220022);
    free(mem_220049);
    free(mem_220052);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236369_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236369_end -
                 futhark_mc_segmap_parloop_236369_start;
        
        ctx->futhark_mc_segmap_parloop_236369_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236369_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236369_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236367(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214301 = tid;
    int num_tasks_232752 = info.nsubtasks;
    struct futhark_mc_task_236366 *futhark_mc_task_236366 =
                                  (struct futhark_mc_task_236366 *) args;
    struct futhark_context *ctx = futhark_mc_task_236366->ctx;
    uint64_t futhark_mc_segmap_task_236367_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236367_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236366->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236366->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236366->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236366->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236366->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236366->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236366->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236366->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236366->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236366->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236366->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236366->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236366->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236366->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236366->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236366->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236366->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236366->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220080 = {.desc ="mem_220080", .mem =
                                  futhark_mc_task_236366->free_mem_220080,
                                  .size =0, .references =NULL};
    struct memblock mem_220084 = {.desc ="mem_220084", .mem =
                                  futhark_mc_task_236366->free_mem_220084,
                                  .size =0, .references =NULL};
    int64_t iter_232753;
    struct futhark_mc_segmap_parloop_struct_236368
    futhark_mc_segmap_parloop_struct_236368;
    
    futhark_mc_segmap_parloop_struct_236368.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236368.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236368.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236368.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236368.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236368.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236368.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236368.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236368.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236368.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236368.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236368.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236368.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236368.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236368.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236368.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236368.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236368.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236368.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236368.free_mem_220080 = mem_220080.mem;
    futhark_mc_segmap_parloop_struct_236368.free_mem_220084 = mem_220084.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236369_task;
    
    futhark_mc_segmap_parloop_236369_task.name =
        "futhark_mc_segmap_parloop_236369";
    futhark_mc_segmap_parloop_236369_task.fn = futhark_mc_segmap_parloop_236369;
    futhark_mc_segmap_parloop_236369_task.args =
        &futhark_mc_segmap_parloop_struct_236368;
    futhark_mc_segmap_parloop_236369_task.iterations = iterations;
    futhark_mc_segmap_parloop_236369_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236369_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236369_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236369_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236369_task);
    
    if (futhark_mc_segmap_parloop_236369_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236369_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236369_total_end -
                 futhark_mc_segmap_parloop_236369_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236369_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236369_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236369_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236367_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236367_end -
                 futhark_mc_segmap_task_236367_start;
        
        ctx->futhark_mc_segmap_task_236367_runs[tid]++;
        ctx->futhark_mc_segmap_task_236367_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236367_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236376 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220080;
    unsigned char *free_mem_220084;
};
struct futhark_mc_task_236383 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219989;
};
struct futhark_mc_segmap_parloop_struct_236385 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_219989;
};
static int futhark_mc_segmap_parloop_236386(void *args, int64_t start,
                                            int64_t end, int flat_tid_232907,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236385
    *futhark_mc_segmap_parloop_struct_236385 =
    (struct futhark_mc_segmap_parloop_struct_236385 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236385->ctx;
    uint64_t futhark_mc_segmap_parloop_236386_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236386_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236385->free_n_203490;
    int64_t gtid_214442 =
            futhark_mc_segmap_parloop_struct_236385->free_gtid_214442;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236385->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236385->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219989 = {.desc ="mem_219989", .mem =
                                  futhark_mc_segmap_parloop_struct_236385->free_mem_219989,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233162 = start;
    
    for (; iter_233162 < end; iter_233162++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233163 = n_203490;
        int64_t gtid_232908 = iter_233162;
        int64_t remnant_233164 = iter_233162 - gtid_232908;
        double x_232909;
        
        x_232909 = ((double *) mem_217297.mem)[gtid_214442 * n_203490 +
                                               gtid_232908];
        
        double x_232910;
        
        x_232910 = ((double *) mem_219808.mem)[gtid_214442 * n_203490 +
                                               gtid_232908];
        
        double defunc_1_f_res_232911 = x_232909 - x_232910;
        
        ((double *) mem_219989.mem)[gtid_232908] = defunc_1_f_res_232911;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236386_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236386_end -
                 futhark_mc_segmap_parloop_236386_start;
        
        ctx->futhark_mc_segmap_parloop_236386_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236386_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236386_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236384(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232907 = tid;
    int num_tasks_233161 = info.nsubtasks;
    struct futhark_mc_task_236383 *futhark_mc_task_236383 =
                                  (struct futhark_mc_task_236383 *) args;
    struct futhark_context *ctx = futhark_mc_task_236383->ctx;
    uint64_t futhark_mc_segmap_task_236384_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236384_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236383->free_n_203490;
    int64_t gtid_214442 = futhark_mc_task_236383->free_gtid_214442;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236383->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236383->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_219989 = {.desc ="mem_219989", .mem =
                                  futhark_mc_task_236383->free_mem_219989,
                                  .size =0, .references =NULL};
    int64_t iter_233162;
    struct futhark_mc_segmap_parloop_struct_236385
    futhark_mc_segmap_parloop_struct_236385;
    
    futhark_mc_segmap_parloop_struct_236385.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236385.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236385.free_gtid_214442 = gtid_214442;
    futhark_mc_segmap_parloop_struct_236385.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236385.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236385.free_mem_219989 = mem_219989.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236386_task;
    
    futhark_mc_segmap_parloop_236386_task.name =
        "futhark_mc_segmap_parloop_236386";
    futhark_mc_segmap_parloop_236386_task.fn = futhark_mc_segmap_parloop_236386;
    futhark_mc_segmap_parloop_236386_task.args =
        &futhark_mc_segmap_parloop_struct_236385;
    futhark_mc_segmap_parloop_236386_task.iterations = iterations;
    futhark_mc_segmap_parloop_236386_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236386_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236386_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236386_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236386_task);
    
    if (futhark_mc_segmap_parloop_236386_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236386_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236386_total_end -
                 futhark_mc_segmap_parloop_236386_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236386_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236386_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236386_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236384_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236384_end -
                 futhark_mc_segmap_task_236384_start;
        
        ctx->futhark_mc_segmap_task_236384_runs[tid]++;
        ctx->futhark_mc_segmap_task_236384_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236384_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236387 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219989;
    unsigned char *free_mem_219992;
    unsigned char *free_mem_219995;
};
struct futhark_mc_segmap_parloop_struct_236389 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219989;
    unsigned char *free_mem_219992;
    unsigned char *free_mem_219995;
};
static int futhark_mc_segmap_parloop_236390(void *args, int64_t start,
                                            int64_t end, int flat_tid_232912,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236389
    *futhark_mc_segmap_parloop_struct_236389 =
    (struct futhark_mc_segmap_parloop_struct_236389 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236389->ctx;
    uint64_t futhark_mc_segmap_parloop_236390_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236390_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236389->free_n_203490;
    int64_t gtid_214442 =
            futhark_mc_segmap_parloop_struct_236389->free_gtid_214442;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236389->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236389->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236389->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236389->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219989 = {.desc ="mem_219989", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_219989,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_219995,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233166 = start;
    
    for (; iter_233166 < end; iter_233166++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233175 = n_203490;
        int64_t gtid_232913 = iter_233166;
        int64_t remnant_233176 = iter_233166 - gtid_232913;
        int64_t x_232914;
        
        x_232914 = ((int64_t *) mem_217340.mem)[gtid_214442 * n_203490 +
                                                gtid_232913];
        
        bool cond_232915 = sle64((int64_t) 0, x_232914);
        double defunc_0_f_res_232916;
        
        if (cond_232915) {
            bool y_233167 = slt64(x_232914, n_203490);
            bool bounds_check_233168 = cond_232915 && y_233167;
            bool index_certs_233169;
            
            if (!bounds_check_233168) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232914,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_233170;
            
            defunc_0_f_res_t_res_233170 = ((double *) mem_219989.mem)[x_232914];
            defunc_0_f_res_232916 = defunc_0_f_res_t_res_233170;
        } else {
            defunc_0_f_res_232916 = 0.0;
        }
        
        double defunc_0_f_res_232921;
        
        if (cond_232915) {
            bool y_233171 = slt64(x_232914, n_203490);
            bool bounds_check_233172 = cond_232915 && y_233171;
            bool index_certs_233173;
            
            if (!bounds_check_233172) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232914,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_233174;
            
            defunc_0_f_res_t_res_233174 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_214442 *
                                                   ctx_param_ext_217867 +
                                                   x_232914 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_232921 = defunc_0_f_res_t_res_233174;
        } else {
            defunc_0_f_res_232921 = 0.0;
        }
        ((double *) mem_219992.mem)[gtid_232913] = defunc_0_f_res_232921;
        ((double *) mem_219995.mem)[gtid_232913] = defunc_0_f_res_232916;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236390_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236390_end -
                 futhark_mc_segmap_parloop_236390_start;
        
        ctx->futhark_mc_segmap_parloop_236390_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236390_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236390_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236388(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232912 = tid;
    int num_tasks_233165 = info.nsubtasks;
    struct futhark_mc_task_236387 *futhark_mc_task_236387 =
                                  (struct futhark_mc_task_236387 *) args;
    struct futhark_context *ctx = futhark_mc_task_236387->ctx;
    uint64_t futhark_mc_segmap_task_236388_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236388_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236387->free_n_203490;
    int64_t gtid_214442 = futhark_mc_task_236387->free_gtid_214442;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236387->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236387->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236387->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236387->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236387->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219989 = {.desc ="mem_219989", .mem =
                                  futhark_mc_task_236387->free_mem_219989,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_task_236387->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_task_236387->free_mem_219995,
                                  .size =0, .references =NULL};
    int64_t iter_233166;
    struct futhark_mc_segmap_parloop_struct_236389
    futhark_mc_segmap_parloop_struct_236389;
    
    futhark_mc_segmap_parloop_struct_236389.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236389.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236389.free_gtid_214442 = gtid_214442;
    futhark_mc_segmap_parloop_struct_236389.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236389.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236389.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236389.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236389.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236389.free_mem_219989 = mem_219989.mem;
    futhark_mc_segmap_parloop_struct_236389.free_mem_219992 = mem_219992.mem;
    futhark_mc_segmap_parloop_struct_236389.free_mem_219995 = mem_219995.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236390_task;
    
    futhark_mc_segmap_parloop_236390_task.name =
        "futhark_mc_segmap_parloop_236390";
    futhark_mc_segmap_parloop_236390_task.fn = futhark_mc_segmap_parloop_236390;
    futhark_mc_segmap_parloop_236390_task.args =
        &futhark_mc_segmap_parloop_struct_236389;
    futhark_mc_segmap_parloop_236390_task.iterations = iterations;
    futhark_mc_segmap_parloop_236390_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236390_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236390_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236390_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236390_task);
    
    if (futhark_mc_segmap_parloop_236390_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236390_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236390_total_end -
                 futhark_mc_segmap_parloop_236390_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236390_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236390_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236390_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236388_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236388_end -
                 futhark_mc_segmap_task_236388_start;
        
        ctx->futhark_mc_segmap_task_236388_runs[tid]++;
        ctx->futhark_mc_segmap_task_236388_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236388_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236391 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214442;
    int64_t free_x_214447;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219992;
    unsigned char *free_mem_219995;
    unsigned char *free_mem_219998;
    unsigned char *free_mem_220001;
};
struct futhark_mc_segmap_parloop_struct_236393 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214442;
    int64_t free_x_214447;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219992;
    unsigned char *free_mem_219995;
    unsigned char *free_mem_219998;
    unsigned char *free_mem_220001;
};
static int futhark_mc_segmap_parloop_236394(void *args, int64_t start,
                                            int64_t end, int flat_tid_233047,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236393
    *futhark_mc_segmap_parloop_struct_236393 =
    (struct futhark_mc_segmap_parloop_struct_236393 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236393->ctx;
    uint64_t futhark_mc_segmap_parloop_236394_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236394_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236393->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236393->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236393->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236393->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236393->free_i_203670;
    int64_t gtid_214442 =
            futhark_mc_segmap_parloop_struct_236393->free_gtid_214442;
    int64_t x_214447 = futhark_mc_segmap_parloop_struct_236393->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236393->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236393->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236393->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_segmap_parloop_struct_236393->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_segmap_parloop_struct_236393->free_mem_219995,
                                  .size =0, .references =NULL};
    struct memblock mem_219998 = {.desc ="mem_219998", .mem =
                                  futhark_mc_segmap_parloop_struct_236393->free_mem_219998,
                                  .size =0, .references =NULL};
    struct memblock mem_220001 = {.desc ="mem_220001", .mem =
                                  futhark_mc_segmap_parloop_struct_236393->free_mem_220001,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233178 = start;
    
    for (; iter_233178 < end; iter_233178++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233252 = t_n_m_203650;
        int64_t gtid_233048 = iter_233178;
        int64_t remnant_233253 = iter_233178 - gtid_233048;
        int64_t x_233049;
        
        x_233049 = ((int64_t *) mem_217835.mem)[gtid_214442 * t_n_m_203650 +
                                                gtid_233048];
        
        double x_233050;
        
        x_233050 = ((double *) mem_217839.mem)[gtid_214442 * t_n_m_203650 +
                                               gtid_233048];
        
        int64_t min_arg_233051 = mul64(jump_t_203500, gtid_233048);
        int64_t min_res_233052 = smin64(i_203670, min_arg_233051);
        int64_t defunc_0_g_res_233053 = add64((int64_t) 1, min_res_233052);
        double defunc_2_reduce_res_233054;
        double defunc_2_reduce_res_233055;
        double defunc_2_reduce_res_233056;
        double defunc_2_reduce_res_233057;
        double defunc_2_reduce_res_233058;
        double redout_233180;
        double redout_233181;
        double redout_233182;
        double redout_233183;
        double redout_233184;
        
        redout_233180 = 0.0;
        redout_233181 = 0.0;
        redout_233182 = 0.0;
        redout_233183 = 0.0;
        redout_233184 = 0.0;
        for (int64_t i_233179 = 0; i_233179 < q_t_203494; i_233179++) {
            bool cond_233185 = sle64(x_214447, i_233179);
            int64_t defunc_0_f_res_233186;
            
            if (cond_233185) {
                defunc_0_f_res_233186 = (int64_t) 0;
            } else {
                int64_t i_233187 = add64(x_233049, i_233179);
                int64_t defunc_0_add_arg_233188;
                
                defunc_0_add_arg_233188 =
                    ((int64_t *) mem_217340.mem)[gtid_214442 * n_203490 +
                                                 i_233187];
                
                int64_t defunc_1_add_res_233189 = add64((int64_t) 1,
                                                        defunc_0_add_arg_233188);
                
                defunc_0_f_res_233186 = defunc_1_add_res_233189;
            }
            
            double defunc_0_f_res_233190;
            
            if (cond_233185) {
                defunc_0_f_res_233190 = 0.0;
            } else {
                int64_t i_233191 = add64(x_233049, i_233179);
                double defunc_0_add_arg_233192;
                
                defunc_0_add_arg_233192 = ((double *) mem_219992.mem)[i_233191];
                defunc_0_f_res_233190 = defunc_0_add_arg_233192;
            }
            
            int64_t binop_p_233193 = sub64(defunc_0_f_res_233186,
                                           defunc_0_g_res_233053);
            double defunc_0_f_res_233194 = sitofp_i64_f64(binop_p_233193);
            double abs_res_233195 = fabs(defunc_0_f_res_233194);
            double tmp1_233196 = abs_res_233195 / x_233050;
            double x_233197 = tmp1_233196 * tmp1_233196;
            double y_233198 = tmp1_233196 * x_233197;
            double tmp2_233199 = 1.0 - y_233198;
            double x_233200 = tmp2_233199 * tmp2_233199;
            double tmp3_233201 = tmp2_233199 * x_233200;
            double w_j_233202 = defunc_0_f_res_233190 * tmp3_233201;
            double xw_j_233203 = defunc_0_f_res_233194 * w_j_233202;
            double x2w_j_233204 = defunc_0_f_res_233194 * xw_j_233203;
            double x3w_j_233205 = defunc_0_f_res_233194 * x2w_j_233204;
            double x4w_j_233206 = defunc_0_f_res_233194 * x3w_j_233205;
            double defunc_1_op_res_233207 = w_j_233202 + redout_233180;
            double defunc_1_op_res_233208 = xw_j_233203 + redout_233181;
            double defunc_1_op_res_233209 = x2w_j_233204 + redout_233182;
            double defunc_1_op_res_233210 = x3w_j_233205 + redout_233183;
            double defunc_1_op_res_233211 = x4w_j_233206 + redout_233184;
            double redout_tmp_233254 = defunc_1_op_res_233207;
            double redout_tmp_233255 = defunc_1_op_res_233208;
            double redout_tmp_233256 = defunc_1_op_res_233209;
            double redout_tmp_233257 = defunc_1_op_res_233210;
            double redout_tmp_233258 = defunc_1_op_res_233211;
            
            redout_233180 = redout_tmp_233254;
            redout_233181 = redout_tmp_233255;
            redout_233182 = redout_tmp_233256;
            redout_233183 = redout_tmp_233257;
            redout_233184 = redout_tmp_233258;
        }
        defunc_2_reduce_res_233054 = redout_233180;
        defunc_2_reduce_res_233055 = redout_233181;
        defunc_2_reduce_res_233056 = redout_233182;
        defunc_2_reduce_res_233057 = redout_233183;
        defunc_2_reduce_res_233058 = redout_233184;
        
        double x_233092 = defunc_2_reduce_res_233056 *
               defunc_2_reduce_res_233058;
        double y_233093 = defunc_2_reduce_res_233057 *
               defunc_2_reduce_res_233057;
        double a12_233094 = x_233092 - y_233093;
        double x_233095 = defunc_2_reduce_res_233056 *
               defunc_2_reduce_res_233057;
        double y_233096 = defunc_2_reduce_res_233055 *
               defunc_2_reduce_res_233058;
        double b12_233097 = x_233095 - y_233096;
        double x_233098 = defunc_2_reduce_res_233055 *
               defunc_2_reduce_res_233057;
        double y_233099 = defunc_2_reduce_res_233056 *
               defunc_2_reduce_res_233056;
        double c12_233100 = x_233098 - y_233099;
        double x_233101 = defunc_2_reduce_res_233054 *
               defunc_2_reduce_res_233058;
        double b2_233102 = x_233101 - y_233099;
        double x_233103 = defunc_2_reduce_res_233055 *
               defunc_2_reduce_res_233056;
        double y_233104 = defunc_2_reduce_res_233054 *
               defunc_2_reduce_res_233057;
        double c2_233105 = x_233103 - y_233104;
        double x_233106 = defunc_2_reduce_res_233054 * a12_233094;
        double y_233107 = defunc_2_reduce_res_233055 * b12_233097;
        double x_233108 = x_233106 + y_233107;
        double y_233109 = defunc_2_reduce_res_233056 * c12_233100;
        double y_233110 = x_233108 + y_233109;
        double det_233111 = 1.0 / y_233110;
        double a12_233112 = a12_233094 * det_233111;
        double b12_233113 = b12_233097 * det_233111;
        double c12_233114 = c12_233100 * det_233111;
        double b2_233115 = b2_233102 * det_233111;
        double c2_233116 = c2_233105 * det_233111;
        double defunc_2_reduce_res_233117;
        double defunc_2_reduce_res_233118;
        double redout_233213;
        double redout_233214;
        
        redout_233213 = 0.0;
        redout_233214 = 0.0;
        for (int64_t i_233212 = 0; i_233212 < q_t_203494; i_233212++) {
            bool cond_233215 = sle64(x_214447, i_233212);
            int64_t defunc_0_f_res_233216;
            
            if (cond_233215) {
                defunc_0_f_res_233216 = (int64_t) 0;
            } else {
                int64_t i_233217 = add64(x_233049, i_233212);
                int64_t defunc_0_add_arg_233218;
                
                defunc_0_add_arg_233218 =
                    ((int64_t *) mem_217340.mem)[gtid_214442 * n_203490 +
                                                 i_233217];
                
                int64_t defunc_1_add_res_233219 = add64((int64_t) 1,
                                                        defunc_0_add_arg_233218);
                
                defunc_0_f_res_233216 = defunc_1_add_res_233219;
            }
            
            double defunc_0_f_res_233220;
            
            if (cond_233215) {
                defunc_0_f_res_233220 = 0.0;
            } else {
                int64_t i_233221 = add64(x_233049, i_233212);
                double defunc_0_add_arg_233222;
                
                defunc_0_add_arg_233222 = ((double *) mem_219992.mem)[i_233221];
                defunc_0_f_res_233220 = defunc_0_add_arg_233222;
            }
            
            int64_t binop_p_233223 = sub64(defunc_0_f_res_233216,
                                           defunc_0_g_res_233053);
            double defunc_0_f_res_233224 = sitofp_i64_f64(binop_p_233223);
            double abs_res_233225 = fabs(defunc_0_f_res_233224);
            double tmp1_233226 = abs_res_233225 / x_233050;
            double x_233227 = tmp1_233226 * tmp1_233226;
            double y_233228 = tmp1_233226 * x_233227;
            double tmp2_233229 = 1.0 - y_233228;
            double x_233230 = tmp2_233229 * tmp2_233229;
            double tmp3_233231 = tmp2_233229 * x_233230;
            double tmp4_233232 = defunc_0_f_res_233220 * tmp3_233231;
            double defunc_1_f_res_233233 = defunc_0_f_res_233224 * tmp4_233232;
            double defunc_1_f_res_233234 = defunc_0_f_res_233224 *
                   defunc_1_f_res_233233;
            double defunc_0_f_res_233235;
            
            if (cond_233215) {
                defunc_0_f_res_233235 = 0.0;
            } else {
                int64_t i_233236 = add64(x_233049, i_233212);
                double defunc_0_add_arg_233237;
                
                defunc_0_add_arg_233237 = ((double *) mem_219995.mem)[i_233236];
                defunc_0_f_res_233235 = defunc_0_add_arg_233237;
            }
            
            double x_233238 = a12_233112 * tmp4_233232;
            double y_233239 = b12_233113 * defunc_1_f_res_233233;
            double x_233240 = x_233238 + y_233239;
            double y_233241 = c12_233114 * defunc_1_f_res_233234;
            double x_233242 = x_233240 + y_233241;
            double defunc_9_fit_fun_res_233243 = defunc_0_f_res_233235 *
                   x_233242;
            double x_233244 = b12_233113 * tmp4_233232;
            double y_233245 = b2_233115 * defunc_1_f_res_233233;
            double x_233246 = x_233244 + y_233245;
            double y_233247 = c2_233116 * defunc_1_f_res_233234;
            double x_233248 = x_233246 + y_233247;
            double defunc_9_slope_fun_res_233249 = defunc_0_f_res_233235 *
                   x_233248;
            double defunc_1_op_res_233250 = defunc_9_fit_fun_res_233243 +
                   redout_233213;
            double defunc_1_op_res_233251 = defunc_9_slope_fun_res_233249 +
                   redout_233214;
            double redout_tmp_233259 = defunc_1_op_res_233250;
            double redout_tmp_233260 = defunc_1_op_res_233251;
            
            redout_233213 = redout_tmp_233259;
            redout_233214 = redout_tmp_233260;
        }
        defunc_2_reduce_res_233117 = redout_233213;
        defunc_2_reduce_res_233118 = redout_233214;
        ((double *) mem_219998.mem)[gtid_233048] = defunc_2_reduce_res_233117;
        ((double *) mem_220001.mem)[gtid_233048] = defunc_2_reduce_res_233118;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236394_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236394_end -
                 futhark_mc_segmap_parloop_236394_start;
        
        ctx->futhark_mc_segmap_parloop_236394_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236394_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236394_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236392(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233047 = tid;
    int num_tasks_233177 = info.nsubtasks;
    struct futhark_mc_task_236391 *futhark_mc_task_236391 =
                                  (struct futhark_mc_task_236391 *) args;
    struct futhark_context *ctx = futhark_mc_task_236391->ctx;
    uint64_t futhark_mc_segmap_task_236392_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236392_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236391->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236391->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236391->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236391->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236391->free_i_203670;
    int64_t gtid_214442 = futhark_mc_task_236391->free_gtid_214442;
    int64_t x_214447 = futhark_mc_task_236391->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236391->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236391->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236391->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_task_236391->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_task_236391->free_mem_219995,
                                  .size =0, .references =NULL};
    struct memblock mem_219998 = {.desc ="mem_219998", .mem =
                                  futhark_mc_task_236391->free_mem_219998,
                                  .size =0, .references =NULL};
    struct memblock mem_220001 = {.desc ="mem_220001", .mem =
                                  futhark_mc_task_236391->free_mem_220001,
                                  .size =0, .references =NULL};
    int64_t iter_233178;
    struct futhark_mc_segmap_parloop_struct_236393
    futhark_mc_segmap_parloop_struct_236393;
    
    futhark_mc_segmap_parloop_struct_236393.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236393.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236393.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236393.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236393.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236393.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236393.free_gtid_214442 = gtid_214442;
    futhark_mc_segmap_parloop_struct_236393.free_x_214447 = x_214447;
    futhark_mc_segmap_parloop_struct_236393.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236393.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236393.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236393.free_mem_219992 = mem_219992.mem;
    futhark_mc_segmap_parloop_struct_236393.free_mem_219995 = mem_219995.mem;
    futhark_mc_segmap_parloop_struct_236393.free_mem_219998 = mem_219998.mem;
    futhark_mc_segmap_parloop_struct_236393.free_mem_220001 = mem_220001.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236394_task;
    
    futhark_mc_segmap_parloop_236394_task.name =
        "futhark_mc_segmap_parloop_236394";
    futhark_mc_segmap_parloop_236394_task.fn = futhark_mc_segmap_parloop_236394;
    futhark_mc_segmap_parloop_236394_task.args =
        &futhark_mc_segmap_parloop_struct_236393;
    futhark_mc_segmap_parloop_236394_task.iterations = iterations;
    futhark_mc_segmap_parloop_236394_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236394_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236394_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236394_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236394_task);
    
    if (futhark_mc_segmap_parloop_236394_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236394_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236394_total_end -
                 futhark_mc_segmap_parloop_236394_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236394_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236394_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236394_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236392_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236392_end -
                 futhark_mc_segmap_task_236392_start;
        
        ctx->futhark_mc_segmap_task_236392_runs[tid]++;
        ctx->futhark_mc_segmap_task_236392_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236392_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236396 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214442;
    int64_t free_x_214447;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_219992;
    unsigned char *free_mem_219995;
    unsigned char *free_mem_219998;
    unsigned char *free_mem_220001;
};
struct futhark_mc_task_236398 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    int64_t free_x_214447;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219992;
    int64_t free_x_232928;
    double free_x_232929;
    int64_t free_defunc_0_g_res_232932;
    double *retval_defunc_2_reduce_res_232933;
    double *retval_defunc_2_reduce_res_232934;
    double *retval_defunc_2_reduce_res_232935;
    double *retval_defunc_2_reduce_res_232936;
    double *retval_defunc_2_reduce_res_232937;
};
struct futhark_mc_segred_stage_1_parloop_struct_236405 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    int64_t free_x_214447;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219992;
    int64_t free_x_232928;
    double free_x_232929;
    int64_t free_defunc_0_g_res_232932;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233347;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233349;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233351;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233353;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233355;
};
static int futhark_mc_segred_stage_1_parloop_236406(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233262,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236405
    *futhark_mc_segred_stage_1_parloop_struct_236405 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236405 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236405->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236406_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236406_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236405->free_n_203490;
    int64_t gtid_214442 =
            futhark_mc_segred_stage_1_parloop_struct_236405->free_gtid_214442;
    int64_t x_214447 =
            futhark_mc_segred_stage_1_parloop_struct_236405->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236405->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236405->free_mem_219992,
                                  .size =0, .references =NULL};
    int64_t x_232928 =
            futhark_mc_segred_stage_1_parloop_struct_236405->free_x_232928;
    double x_232929 =
           futhark_mc_segred_stage_1_parloop_struct_236405->free_x_232929;
    int64_t defunc_0_g_res_232932 =
            futhark_mc_segred_stage_1_parloop_struct_236405->free_defunc_0_g_res_232932;
    struct memblock reduce_stage_1_tid_res_arr_mem_233347 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233347",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236405->free_reduce_stage_1_tid_res_arr_mem_233347,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233349 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233349",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236405->free_reduce_stage_1_tid_res_arr_mem_233349,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233351 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233351",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236405->free_reduce_stage_1_tid_res_arr_mem_233351,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233353 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233353",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236405->free_reduce_stage_1_tid_res_arr_mem_233353,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233355 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233355",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236405->free_reduce_stage_1_tid_res_arr_mem_233355,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233357 = start;
    double x_233264;
    double x_233265;
    double x_233267;
    double x_233268;
    double x_233270;
    double x_233271;
    double x_233273;
    double x_233274;
    double x_233276;
    double x_233277;
    double local_acc_233358 = 0.0;
    double local_acc_233359 = 0.0;
    double local_acc_233360 = 0.0;
    double local_acc_233361 = 0.0;
    double local_acc_233362 = 0.0;
    
    for (; iter_233357 < end; iter_233357++) {
        int64_t gtid_233263 = iter_233357;
        bool cond_233279 = sle64(x_214447, gtid_233263);
        int64_t defunc_0_f_res_233280;
        
        if (cond_233279) {
            defunc_0_f_res_233280 = (int64_t) 0;
        } else {
            int64_t i_233281 = add64(x_232928, gtid_233263);
            int64_t defunc_0_add_arg_233282;
            
            defunc_0_add_arg_233282 = ((int64_t *) mem_217340.mem)[gtid_214442 *
                                                                   n_203490 +
                                                                   i_233281];
            
            int64_t defunc_1_add_res_233283 = add64((int64_t) 1,
                                                    defunc_0_add_arg_233282);
            
            defunc_0_f_res_233280 = defunc_1_add_res_233283;
        }
        
        double defunc_0_f_res_233284;
        
        if (cond_233279) {
            defunc_0_f_res_233284 = 0.0;
        } else {
            int64_t i_233285 = add64(x_232928, gtid_233263);
            double defunc_0_add_arg_233286;
            
            defunc_0_add_arg_233286 = ((double *) mem_219992.mem)[i_233285];
            defunc_0_f_res_233284 = defunc_0_add_arg_233286;
        }
        
        int64_t binop_p_233287 = sub64(defunc_0_f_res_233280,
                                       defunc_0_g_res_232932);
        double defunc_0_f_res_233288 = sitofp_i64_f64(binop_p_233287);
        double abs_res_233289 = fabs(defunc_0_f_res_233288);
        double tmp1_233290 = abs_res_233289 / x_232929;
        double x_233291 = tmp1_233290 * tmp1_233290;
        double y_233292 = tmp1_233290 * x_233291;
        double tmp2_233293 = 1.0 - y_233292;
        double x_233294 = tmp2_233293 * tmp2_233293;
        double tmp3_233295 = tmp2_233293 * x_233294;
        double w_j_233296 = defunc_0_f_res_233284 * tmp3_233295;
        double xw_j_233297 = defunc_0_f_res_233288 * w_j_233296;
        double x2w_j_233298 = defunc_0_f_res_233288 * xw_j_233297;
        double x3w_j_233299 = defunc_0_f_res_233288 * x2w_j_233298;
        double x4w_j_233300 = defunc_0_f_res_233288 * x3w_j_233299;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_233264 = local_acc_233358;
        }
        // Load next params
        {
            x_233265 = w_j_233296;
        }
        // Red body
        {
            double defunc_1_op_res_233266 = x_233264 + x_233265;
            
            local_acc_233358 = defunc_1_op_res_233266;
        }
        // Load accum params
        {
            x_233267 = local_acc_233359;
        }
        // Load next params
        {
            x_233268 = xw_j_233297;
        }
        // Red body
        {
            double defunc_1_op_res_233269 = x_233267 + x_233268;
            
            local_acc_233359 = defunc_1_op_res_233269;
        }
        // Load accum params
        {
            x_233270 = local_acc_233360;
        }
        // Load next params
        {
            x_233271 = x2w_j_233298;
        }
        // Red body
        {
            double defunc_1_op_res_233272 = x_233270 + x_233271;
            
            local_acc_233360 = defunc_1_op_res_233272;
        }
        // Load accum params
        {
            x_233273 = local_acc_233361;
        }
        // Load next params
        {
            x_233274 = x3w_j_233299;
        }
        // Red body
        {
            double defunc_1_op_res_233275 = x_233273 + x_233274;
            
            local_acc_233361 = defunc_1_op_res_233275;
        }
        // Load accum params
        {
            x_233276 = local_acc_233362;
        }
        // Load next params
        {
            x_233277 = x4w_j_233300;
        }
        // Red body
        {
            double defunc_1_op_res_233278 = x_233276 + x_233277;
            
            local_acc_233362 = defunc_1_op_res_233278;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233347.mem)[flat_tid_233262] =
        local_acc_233358;
    ((double *) reduce_stage_1_tid_res_arr_mem_233349.mem)[flat_tid_233262] =
        local_acc_233359;
    ((double *) reduce_stage_1_tid_res_arr_mem_233351.mem)[flat_tid_233262] =
        local_acc_233360;
    ((double *) reduce_stage_1_tid_res_arr_mem_233353.mem)[flat_tid_233262] =
        local_acc_233361;
    ((double *) reduce_stage_1_tid_res_arr_mem_233355.mem)[flat_tid_233262] =
        local_acc_233362;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236406_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236406_end -
                 futhark_mc_segred_stage_1_parloop_236406_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236406_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236406_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236406_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236399(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233262 = tid;
    int num_tasks_233346 = info.nsubtasks;
    struct futhark_mc_task_236398 *futhark_mc_task_236398 =
                                  (struct futhark_mc_task_236398 *) args;
    struct futhark_context *ctx = futhark_mc_task_236398->ctx;
    uint64_t futhark_mc_segred_task_236399_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236399_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236398->free_n_203490;
    int64_t gtid_214442 = futhark_mc_task_236398->free_gtid_214442;
    int64_t x_214447 = futhark_mc_task_236398->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236398->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_task_236398->free_mem_219992,
                                  .size =0, .references =NULL};
    int64_t x_232928 = futhark_mc_task_236398->free_x_232928;
    double x_232929 = futhark_mc_task_236398->free_x_232929;
    int64_t defunc_0_g_res_232932 =
            futhark_mc_task_236398->free_defunc_0_g_res_232932;
    double defunc_2_reduce_res_232933 =
           *futhark_mc_task_236398->retval_defunc_2_reduce_res_232933;
    double defunc_2_reduce_res_232934 =
           *futhark_mc_task_236398->retval_defunc_2_reduce_res_232934;
    double defunc_2_reduce_res_232935 =
           *futhark_mc_task_236398->retval_defunc_2_reduce_res_232935;
    double defunc_2_reduce_res_232936 =
           *futhark_mc_task_236398->retval_defunc_2_reduce_res_232936;
    double defunc_2_reduce_res_232937 =
           *futhark_mc_task_236398->retval_defunc_2_reduce_res_232937;
    size_t reduce_stage_1_tid_res_arr_mem_233347_cached_sizze_236400 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233347 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233349_cached_sizze_236401 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233349 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233351_cached_sizze_236402 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233351 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233353_cached_sizze_236403 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233353 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233355_cached_sizze_236404 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233355 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233347_cached_sizze_236400 <
        (size_t) ((int64_t) 8 * num_tasks_233346)) {
        reduce_stage_1_tid_res_arr_mem_233347 =
            realloc(reduce_stage_1_tid_res_arr_mem_233347, (int64_t) 8 *
                    num_tasks_233346);
        reduce_stage_1_tid_res_arr_mem_233347_cached_sizze_236400 =
            (int64_t) 8 * num_tasks_233346;
    }
    if (reduce_stage_1_tid_res_arr_mem_233349_cached_sizze_236401 <
        (size_t) ((int64_t) 8 * num_tasks_233346)) {
        reduce_stage_1_tid_res_arr_mem_233349 =
            realloc(reduce_stage_1_tid_res_arr_mem_233349, (int64_t) 8 *
                    num_tasks_233346);
        reduce_stage_1_tid_res_arr_mem_233349_cached_sizze_236401 =
            (int64_t) 8 * num_tasks_233346;
    }
    if (reduce_stage_1_tid_res_arr_mem_233351_cached_sizze_236402 <
        (size_t) ((int64_t) 8 * num_tasks_233346)) {
        reduce_stage_1_tid_res_arr_mem_233351 =
            realloc(reduce_stage_1_tid_res_arr_mem_233351, (int64_t) 8 *
                    num_tasks_233346);
        reduce_stage_1_tid_res_arr_mem_233351_cached_sizze_236402 =
            (int64_t) 8 * num_tasks_233346;
    }
    if (reduce_stage_1_tid_res_arr_mem_233353_cached_sizze_236403 <
        (size_t) ((int64_t) 8 * num_tasks_233346)) {
        reduce_stage_1_tid_res_arr_mem_233353 =
            realloc(reduce_stage_1_tid_res_arr_mem_233353, (int64_t) 8 *
                    num_tasks_233346);
        reduce_stage_1_tid_res_arr_mem_233353_cached_sizze_236403 =
            (int64_t) 8 * num_tasks_233346;
    }
    if (reduce_stage_1_tid_res_arr_mem_233355_cached_sizze_236404 <
        (size_t) ((int64_t) 8 * num_tasks_233346)) {
        reduce_stage_1_tid_res_arr_mem_233355 =
            realloc(reduce_stage_1_tid_res_arr_mem_233355, (int64_t) 8 *
                    num_tasks_233346);
        reduce_stage_1_tid_res_arr_mem_233355_cached_sizze_236404 =
            (int64_t) 8 * num_tasks_233346;
    }
    
    int64_t iter_233357;
    struct futhark_mc_segred_stage_1_parloop_struct_236405
    futhark_mc_segred_stage_1_parloop_struct_236405;
    
    futhark_mc_segred_stage_1_parloop_struct_236405.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_gtid_214442 =
        gtid_214442;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_x_214447 = x_214447;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_mem_219992 =
        mem_219992.mem;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_x_232928 = x_232928;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_x_232929 = x_232929;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_defunc_0_g_res_232932 =
        defunc_0_g_res_232932;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_reduce_stage_1_tid_res_arr_mem_233347 =
        reduce_stage_1_tid_res_arr_mem_233347;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_reduce_stage_1_tid_res_arr_mem_233349 =
        reduce_stage_1_tid_res_arr_mem_233349;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_reduce_stage_1_tid_res_arr_mem_233351 =
        reduce_stage_1_tid_res_arr_mem_233351;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_reduce_stage_1_tid_res_arr_mem_233353 =
        reduce_stage_1_tid_res_arr_mem_233353;
    futhark_mc_segred_stage_1_parloop_struct_236405.free_reduce_stage_1_tid_res_arr_mem_233355 =
        reduce_stage_1_tid_res_arr_mem_233355;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236406_task;
    
    futhark_mc_segred_stage_1_parloop_236406_task.name =
        "futhark_mc_segred_stage_1_parloop_236406";
    futhark_mc_segred_stage_1_parloop_236406_task.fn =
        futhark_mc_segred_stage_1_parloop_236406;
    futhark_mc_segred_stage_1_parloop_236406_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236405;
    futhark_mc_segred_stage_1_parloop_236406_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236406_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236406_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236406_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236406_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236406_task);
    
    if (futhark_mc_segred_stage_1_parloop_236406_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236406_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236406_total_end -
                 futhark_mc_segred_stage_1_parloop_236406_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236406_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236406_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236406_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232933 = 0.0;
        defunc_2_reduce_res_232934 = 0.0;
        defunc_2_reduce_res_232935 = 0.0;
        defunc_2_reduce_res_232936 = 0.0;
        defunc_2_reduce_res_232937 = 0.0;
    }
    
    double x_233363;
    double x_233364;
    double x_233366;
    double x_233367;
    double x_233369;
    double x_233370;
    double x_233372;
    double x_233373;
    double x_233375;
    double x_233376;
    
    for (int32_t i_233378 = 0; i_233378 < num_tasks_233346; i_233378++) {
        flat_tid_233262 = i_233378;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233363 = defunc_2_reduce_res_232933;
            }
            // load next params
            {
                x_233364 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233347)[flat_tid_233262];
            }
            // red body
            {
                double defunc_1_op_res_233365 = x_233363 + x_233364;
                
                defunc_2_reduce_res_232933 = defunc_1_op_res_233365;
            }
            // load acc params
            {
                x_233366 = defunc_2_reduce_res_232934;
            }
            // load next params
            {
                x_233367 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233349)[flat_tid_233262];
            }
            // red body
            {
                double defunc_1_op_res_233368 = x_233366 + x_233367;
                
                defunc_2_reduce_res_232934 = defunc_1_op_res_233368;
            }
            // load acc params
            {
                x_233369 = defunc_2_reduce_res_232935;
            }
            // load next params
            {
                x_233370 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233351)[flat_tid_233262];
            }
            // red body
            {
                double defunc_1_op_res_233371 = x_233369 + x_233370;
                
                defunc_2_reduce_res_232935 = defunc_1_op_res_233371;
            }
            // load acc params
            {
                x_233372 = defunc_2_reduce_res_232936;
            }
            // load next params
            {
                x_233373 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233353)[flat_tid_233262];
            }
            // red body
            {
                double defunc_1_op_res_233374 = x_233372 + x_233373;
                
                defunc_2_reduce_res_232936 = defunc_1_op_res_233374;
            }
            // load acc params
            {
                x_233375 = defunc_2_reduce_res_232937;
            }
            // load next params
            {
                x_233376 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233355)[flat_tid_233262];
            }
            // red body
            {
                double defunc_1_op_res_233377 = x_233375 + x_233376;
                
                defunc_2_reduce_res_232937 = defunc_1_op_res_233377;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233347);
        free(reduce_stage_1_tid_res_arr_mem_233349);
        free(reduce_stage_1_tid_res_arr_mem_233351);
        free(reduce_stage_1_tid_res_arr_mem_233353);
        free(reduce_stage_1_tid_res_arr_mem_233355);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236399_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236399_end -
                 futhark_mc_segred_task_236399_start;
        
        ctx->futhark_mc_segred_task_236399_runs[tid]++;
        ctx->futhark_mc_segred_task_236399_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236399_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236398->retval_defunc_2_reduce_res_232933 =
            defunc_2_reduce_res_232933;
        *futhark_mc_task_236398->retval_defunc_2_reduce_res_232934 =
            defunc_2_reduce_res_232934;
        *futhark_mc_task_236398->retval_defunc_2_reduce_res_232935 =
            defunc_2_reduce_res_232935;
        *futhark_mc_task_236398->retval_defunc_2_reduce_res_232936 =
            defunc_2_reduce_res_232936;
        *futhark_mc_task_236398->retval_defunc_2_reduce_res_232937 =
            defunc_2_reduce_res_232937;
    }
    return err;
}
struct futhark_mc_task_236407 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    int64_t free_x_214447;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219992;
    unsigned char *free_mem_219995;
    int64_t free_x_232928;
    double free_x_232929;
    int64_t free_defunc_0_g_res_232932;
    double free_a12_232997;
    double free_b12_232998;
    double free_c12_232999;
    double free_b2_233000;
    double free_c2_233001;
    double *retval_defunc_2_reduce_res_233002;
    double *retval_defunc_2_reduce_res_233003;
};
struct futhark_mc_segred_stage_1_parloop_struct_236411 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214442;
    int64_t free_x_214447;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_219992;
    unsigned char *free_mem_219995;
    int64_t free_x_232928;
    double free_x_232929;
    int64_t free_defunc_0_g_res_232932;
    double free_a12_232997;
    double free_b12_232998;
    double free_c12_232999;
    double free_b2_233000;
    double free_c2_233001;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233380;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233382;
};
static int futhark_mc_segred_stage_1_parloop_236412(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233301,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236411
    *futhark_mc_segred_stage_1_parloop_struct_236411 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236411 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236411->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236412_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236412_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236411->free_n_203490;
    int64_t gtid_214442 =
            futhark_mc_segred_stage_1_parloop_struct_236411->free_gtid_214442;
    int64_t x_214447 =
            futhark_mc_segred_stage_1_parloop_struct_236411->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236411->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236411->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236411->free_mem_219995,
                                  .size =0, .references =NULL};
    int64_t x_232928 =
            futhark_mc_segred_stage_1_parloop_struct_236411->free_x_232928;
    double x_232929 =
           futhark_mc_segred_stage_1_parloop_struct_236411->free_x_232929;
    int64_t defunc_0_g_res_232932 =
            futhark_mc_segred_stage_1_parloop_struct_236411->free_defunc_0_g_res_232932;
    double a12_232997 =
           futhark_mc_segred_stage_1_parloop_struct_236411->free_a12_232997;
    double b12_232998 =
           futhark_mc_segred_stage_1_parloop_struct_236411->free_b12_232998;
    double c12_232999 =
           futhark_mc_segred_stage_1_parloop_struct_236411->free_c12_232999;
    double b2_233000 =
           futhark_mc_segred_stage_1_parloop_struct_236411->free_b2_233000;
    double c2_233001 =
           futhark_mc_segred_stage_1_parloop_struct_236411->free_c2_233001;
    struct memblock reduce_stage_1_tid_res_arr_mem_233380 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233380",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236411->free_reduce_stage_1_tid_res_arr_mem_233380,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233382 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233382",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236411->free_reduce_stage_1_tid_res_arr_mem_233382,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233384 = start;
    double x_233303;
    double x_233304;
    double x_233306;
    double x_233307;
    double local_acc_233385 = 0.0;
    double local_acc_233386 = 0.0;
    
    for (; iter_233384 < end; iter_233384++) {
        int64_t gtid_233302 = iter_233384;
        bool cond_233309 = sle64(x_214447, gtid_233302);
        int64_t defunc_0_f_res_233310;
        
        if (cond_233309) {
            defunc_0_f_res_233310 = (int64_t) 0;
        } else {
            int64_t i_233311 = add64(x_232928, gtid_233302);
            int64_t defunc_0_add_arg_233312;
            
            defunc_0_add_arg_233312 = ((int64_t *) mem_217340.mem)[gtid_214442 *
                                                                   n_203490 +
                                                                   i_233311];
            
            int64_t defunc_1_add_res_233313 = add64((int64_t) 1,
                                                    defunc_0_add_arg_233312);
            
            defunc_0_f_res_233310 = defunc_1_add_res_233313;
        }
        
        double defunc_0_f_res_233314;
        
        if (cond_233309) {
            defunc_0_f_res_233314 = 0.0;
        } else {
            int64_t i_233315 = add64(x_232928, gtid_233302);
            double defunc_0_add_arg_233316;
            
            defunc_0_add_arg_233316 = ((double *) mem_219992.mem)[i_233315];
            defunc_0_f_res_233314 = defunc_0_add_arg_233316;
        }
        
        int64_t binop_p_233317 = sub64(defunc_0_f_res_233310,
                                       defunc_0_g_res_232932);
        double defunc_0_f_res_233318 = sitofp_i64_f64(binop_p_233317);
        double abs_res_233319 = fabs(defunc_0_f_res_233318);
        double tmp1_233320 = abs_res_233319 / x_232929;
        double x_233321 = tmp1_233320 * tmp1_233320;
        double y_233322 = tmp1_233320 * x_233321;
        double tmp2_233323 = 1.0 - y_233322;
        double x_233324 = tmp2_233323 * tmp2_233323;
        double tmp3_233325 = tmp2_233323 * x_233324;
        double tmp4_233326 = defunc_0_f_res_233314 * tmp3_233325;
        double defunc_1_f_res_233327 = defunc_0_f_res_233318 * tmp4_233326;
        double defunc_1_f_res_233328 = defunc_0_f_res_233318 *
               defunc_1_f_res_233327;
        double defunc_0_f_res_233329;
        
        if (cond_233309) {
            defunc_0_f_res_233329 = 0.0;
        } else {
            int64_t i_233330 = add64(x_232928, gtid_233302);
            double defunc_0_add_arg_233331;
            
            defunc_0_add_arg_233331 = ((double *) mem_219995.mem)[i_233330];
            defunc_0_f_res_233329 = defunc_0_add_arg_233331;
        }
        
        double x_233332 = a12_232997 * tmp4_233326;
        double y_233333 = b12_232998 * defunc_1_f_res_233327;
        double x_233334 = x_233332 + y_233333;
        double y_233335 = c12_232999 * defunc_1_f_res_233328;
        double x_233336 = x_233334 + y_233335;
        double defunc_9_fit_fun_res_233337 = defunc_0_f_res_233329 * x_233336;
        double x_233338 = b12_232998 * tmp4_233326;
        double y_233339 = b2_233000 * defunc_1_f_res_233327;
        double x_233340 = x_233338 + y_233339;
        double y_233341 = c2_233001 * defunc_1_f_res_233328;
        double x_233342 = x_233340 + y_233341;
        double defunc_9_slope_fun_res_233343 = defunc_0_f_res_233329 * x_233342;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_233303 = local_acc_233385;
        }
        // Load next params
        {
            x_233304 = defunc_9_fit_fun_res_233337;
        }
        // Red body
        {
            double defunc_1_op_res_233305 = x_233303 + x_233304;
            
            local_acc_233385 = defunc_1_op_res_233305;
        }
        // Load accum params
        {
            x_233306 = local_acc_233386;
        }
        // Load next params
        {
            x_233307 = defunc_9_slope_fun_res_233343;
        }
        // Red body
        {
            double defunc_1_op_res_233308 = x_233306 + x_233307;
            
            local_acc_233386 = defunc_1_op_res_233308;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233380.mem)[flat_tid_233301] =
        local_acc_233385;
    ((double *) reduce_stage_1_tid_res_arr_mem_233382.mem)[flat_tid_233301] =
        local_acc_233386;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236412_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236412_end -
                 futhark_mc_segred_stage_1_parloop_236412_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236412_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236412_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236412_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236408(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233301 = tid;
    int num_tasks_233379 = info.nsubtasks;
    struct futhark_mc_task_236407 *futhark_mc_task_236407 =
                                  (struct futhark_mc_task_236407 *) args;
    struct futhark_context *ctx = futhark_mc_task_236407->ctx;
    uint64_t futhark_mc_segred_task_236408_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236408_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236407->free_n_203490;
    int64_t gtid_214442 = futhark_mc_task_236407->free_gtid_214442;
    int64_t x_214447 = futhark_mc_task_236407->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236407->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_task_236407->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_task_236407->free_mem_219995,
                                  .size =0, .references =NULL};
    int64_t x_232928 = futhark_mc_task_236407->free_x_232928;
    double x_232929 = futhark_mc_task_236407->free_x_232929;
    int64_t defunc_0_g_res_232932 =
            futhark_mc_task_236407->free_defunc_0_g_res_232932;
    double a12_232997 = futhark_mc_task_236407->free_a12_232997;
    double b12_232998 = futhark_mc_task_236407->free_b12_232998;
    double c12_232999 = futhark_mc_task_236407->free_c12_232999;
    double b2_233000 = futhark_mc_task_236407->free_b2_233000;
    double c2_233001 = futhark_mc_task_236407->free_c2_233001;
    double defunc_2_reduce_res_233002 =
           *futhark_mc_task_236407->retval_defunc_2_reduce_res_233002;
    double defunc_2_reduce_res_233003 =
           *futhark_mc_task_236407->retval_defunc_2_reduce_res_233003;
    size_t reduce_stage_1_tid_res_arr_mem_233380_cached_sizze_236409 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233380 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233382_cached_sizze_236410 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233382 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233380_cached_sizze_236409 <
        (size_t) ((int64_t) 8 * num_tasks_233379)) {
        reduce_stage_1_tid_res_arr_mem_233380 =
            realloc(reduce_stage_1_tid_res_arr_mem_233380, (int64_t) 8 *
                    num_tasks_233379);
        reduce_stage_1_tid_res_arr_mem_233380_cached_sizze_236409 =
            (int64_t) 8 * num_tasks_233379;
    }
    if (reduce_stage_1_tid_res_arr_mem_233382_cached_sizze_236410 <
        (size_t) ((int64_t) 8 * num_tasks_233379)) {
        reduce_stage_1_tid_res_arr_mem_233382 =
            realloc(reduce_stage_1_tid_res_arr_mem_233382, (int64_t) 8 *
                    num_tasks_233379);
        reduce_stage_1_tid_res_arr_mem_233382_cached_sizze_236410 =
            (int64_t) 8 * num_tasks_233379;
    }
    
    int64_t iter_233384;
    struct futhark_mc_segred_stage_1_parloop_struct_236411
    futhark_mc_segred_stage_1_parloop_struct_236411;
    
    futhark_mc_segred_stage_1_parloop_struct_236411.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_gtid_214442 =
        gtid_214442;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_x_214447 = x_214447;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_mem_219992 =
        mem_219992.mem;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_mem_219995 =
        mem_219995.mem;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_x_232928 = x_232928;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_x_232929 = x_232929;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_defunc_0_g_res_232932 =
        defunc_0_g_res_232932;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_a12_232997 =
        a12_232997;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_b12_232998 =
        b12_232998;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_c12_232999 =
        c12_232999;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_b2_233000 = b2_233000;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_c2_233001 = c2_233001;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_reduce_stage_1_tid_res_arr_mem_233380 =
        reduce_stage_1_tid_res_arr_mem_233380;
    futhark_mc_segred_stage_1_parloop_struct_236411.free_reduce_stage_1_tid_res_arr_mem_233382 =
        reduce_stage_1_tid_res_arr_mem_233382;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236412_task;
    
    futhark_mc_segred_stage_1_parloop_236412_task.name =
        "futhark_mc_segred_stage_1_parloop_236412";
    futhark_mc_segred_stage_1_parloop_236412_task.fn =
        futhark_mc_segred_stage_1_parloop_236412;
    futhark_mc_segred_stage_1_parloop_236412_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236411;
    futhark_mc_segred_stage_1_parloop_236412_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236412_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236412_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236412_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236412_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236412_task);
    
    if (futhark_mc_segred_stage_1_parloop_236412_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236412_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236412_total_end -
                 futhark_mc_segred_stage_1_parloop_236412_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236412_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236412_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236412_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233002 = 0.0;
        defunc_2_reduce_res_233003 = 0.0;
    }
    
    double x_233387;
    double x_233388;
    double x_233390;
    double x_233391;
    
    for (int32_t i_233393 = 0; i_233393 < num_tasks_233379; i_233393++) {
        flat_tid_233301 = i_233393;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233387 = defunc_2_reduce_res_233002;
            }
            // load next params
            {
                x_233388 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233380)[flat_tid_233301];
            }
            // red body
            {
                double defunc_1_op_res_233389 = x_233387 + x_233388;
                
                defunc_2_reduce_res_233002 = defunc_1_op_res_233389;
            }
            // load acc params
            {
                x_233390 = defunc_2_reduce_res_233003;
            }
            // load next params
            {
                x_233391 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233382)[flat_tid_233301];
            }
            // red body
            {
                double defunc_1_op_res_233392 = x_233390 + x_233391;
                
                defunc_2_reduce_res_233003 = defunc_1_op_res_233392;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233380);
        free(reduce_stage_1_tid_res_arr_mem_233382);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236408_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236408_end -
                 futhark_mc_segred_task_236408_start;
        
        ctx->futhark_mc_segred_task_236408_runs[tid]++;
        ctx->futhark_mc_segred_task_236408_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236408_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236407->retval_defunc_2_reduce_res_233002 =
            defunc_2_reduce_res_233002;
        *futhark_mc_task_236407->retval_defunc_2_reduce_res_233003 =
            defunc_2_reduce_res_233003;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236397(void *args, int64_t start,
                                            int64_t end, int flat_tid_232926,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236396
    *futhark_mc_segmap_parloop_struct_236396 =
    (struct futhark_mc_segmap_parloop_struct_236396 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236396->ctx;
    uint64_t futhark_mc_segmap_parloop_236397_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236397_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236396->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236396->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236396->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236396->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236396->free_i_203670;
    int64_t gtid_214442 =
            futhark_mc_segmap_parloop_struct_236396->free_gtid_214442;
    int64_t x_214447 = futhark_mc_segmap_parloop_struct_236396->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236396->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236396->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236396->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_segmap_parloop_struct_236396->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_segmap_parloop_struct_236396->free_mem_219995,
                                  .size =0, .references =NULL};
    struct memblock mem_219998 = {.desc ="mem_219998", .mem =
                                  futhark_mc_segmap_parloop_struct_236396->free_mem_219998,
                                  .size =0, .references =NULL};
    struct memblock mem_220001 = {.desc ="mem_220001", .mem =
                                  futhark_mc_segmap_parloop_struct_236396->free_mem_220001,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233261 = start;
    
    for (; iter_233261 < end; iter_233261++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233344 = t_n_m_203650;
        int64_t gtid_232927 = iter_233261;
        int64_t remnant_233345 = iter_233261 - gtid_232927;
        int64_t x_232928;
        
        x_232928 = ((int64_t *) mem_217835.mem)[gtid_214442 * t_n_m_203650 +
                                                gtid_232927];
        
        double x_232929;
        
        x_232929 = ((double *) mem_217839.mem)[gtid_214442 * t_n_m_203650 +
                                               gtid_232927];
        
        int64_t min_arg_232930 = mul64(jump_t_203500, gtid_232927);
        int64_t min_res_232931 = smin64(i_203670, min_arg_232930);
        int64_t defunc_0_g_res_232932 = add64((int64_t) 1, min_res_232931);
        double defunc_2_reduce_res_232933;
        double defunc_2_reduce_res_232934;
        double defunc_2_reduce_res_232935;
        double defunc_2_reduce_res_232936;
        double defunc_2_reduce_res_232937;
        int64_t flat_tid_233262 = (int64_t) 0;
        int32_t num_tasks_233346;
        
        defunc_2_reduce_res_232933 = 0.0;
        defunc_2_reduce_res_232934 = 0.0;
        defunc_2_reduce_res_232935 = 0.0;
        defunc_2_reduce_res_232936 = 0.0;
        defunc_2_reduce_res_232937 = 0.0;
        
        struct futhark_mc_task_236398 futhark_mc_task_236398;
        
        futhark_mc_task_236398.ctx = ctx;
        futhark_mc_task_236398.free_n_203490 = n_203490;
        futhark_mc_task_236398.free_gtid_214442 = gtid_214442;
        futhark_mc_task_236398.free_x_214447 = x_214447;
        futhark_mc_task_236398.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236398.free_mem_219992 = mem_219992.mem;
        futhark_mc_task_236398.free_x_232928 = x_232928;
        futhark_mc_task_236398.free_x_232929 = x_232929;
        futhark_mc_task_236398.free_defunc_0_g_res_232932 =
            defunc_0_g_res_232932;
        futhark_mc_task_236398.retval_defunc_2_reduce_res_232933 =
            &defunc_2_reduce_res_232933;
        futhark_mc_task_236398.retval_defunc_2_reduce_res_232934 =
            &defunc_2_reduce_res_232934;
        futhark_mc_task_236398.retval_defunc_2_reduce_res_232935 =
            &defunc_2_reduce_res_232935;
        futhark_mc_task_236398.retval_defunc_2_reduce_res_232936 =
            &defunc_2_reduce_res_232936;
        futhark_mc_task_236398.retval_defunc_2_reduce_res_232937 =
            &defunc_2_reduce_res_232937;
        
        struct scheduler_segop futhark_mc_task_236398_task;
        
        futhark_mc_task_236398_task.args = &futhark_mc_task_236398;
        futhark_mc_task_236398_task.top_level_fn =
            futhark_mc_segred_task_236399;
        futhark_mc_task_236398_task.name = "futhark_mc_segred_task_236399";
        futhark_mc_task_236398_task.iterations = q_t_203494;
        futhark_mc_task_236398_task.task_time =
            &ctx->futhark_mc_segred_task_236399_total_time;
        futhark_mc_task_236398_task.task_iter =
            &ctx->futhark_mc_segred_task_236399_total_iter;
        futhark_mc_task_236398_task.sched = STATIC;
        futhark_mc_task_236398_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236399_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236398_task);
        
        if (futhark_mc_segred_task_236399_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_232977 = defunc_2_reduce_res_232935 *
               defunc_2_reduce_res_232937;
        double y_232978 = defunc_2_reduce_res_232936 *
               defunc_2_reduce_res_232936;
        double a12_232979 = x_232977 - y_232978;
        double x_232980 = defunc_2_reduce_res_232935 *
               defunc_2_reduce_res_232936;
        double y_232981 = defunc_2_reduce_res_232934 *
               defunc_2_reduce_res_232937;
        double b12_232982 = x_232980 - y_232981;
        double x_232983 = defunc_2_reduce_res_232934 *
               defunc_2_reduce_res_232936;
        double y_232984 = defunc_2_reduce_res_232935 *
               defunc_2_reduce_res_232935;
        double c12_232985 = x_232983 - y_232984;
        double x_232986 = defunc_2_reduce_res_232933 *
               defunc_2_reduce_res_232937;
        double b2_232987 = x_232986 - y_232984;
        double x_232988 = defunc_2_reduce_res_232934 *
               defunc_2_reduce_res_232935;
        double y_232989 = defunc_2_reduce_res_232933 *
               defunc_2_reduce_res_232936;
        double c2_232990 = x_232988 - y_232989;
        double x_232991 = defunc_2_reduce_res_232933 * a12_232979;
        double y_232992 = defunc_2_reduce_res_232934 * b12_232982;
        double x_232993 = x_232991 + y_232992;
        double y_232994 = defunc_2_reduce_res_232935 * c12_232985;
        double y_232995 = x_232993 + y_232994;
        double det_232996 = 1.0 / y_232995;
        double a12_232997 = a12_232979 * det_232996;
        double b12_232998 = b12_232982 * det_232996;
        double c12_232999 = c12_232985 * det_232996;
        double b2_233000 = b2_232987 * det_232996;
        double c2_233001 = c2_232990 * det_232996;
        double defunc_2_reduce_res_233002;
        double defunc_2_reduce_res_233003;
        int64_t flat_tid_233301 = (int64_t) 0;
        int32_t num_tasks_233379;
        
        defunc_2_reduce_res_233002 = 0.0;
        defunc_2_reduce_res_233003 = 0.0;
        
        struct futhark_mc_task_236407 futhark_mc_task_236407;
        
        futhark_mc_task_236407.ctx = ctx;
        futhark_mc_task_236407.free_n_203490 = n_203490;
        futhark_mc_task_236407.free_gtid_214442 = gtid_214442;
        futhark_mc_task_236407.free_x_214447 = x_214447;
        futhark_mc_task_236407.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236407.free_mem_219992 = mem_219992.mem;
        futhark_mc_task_236407.free_mem_219995 = mem_219995.mem;
        futhark_mc_task_236407.free_x_232928 = x_232928;
        futhark_mc_task_236407.free_x_232929 = x_232929;
        futhark_mc_task_236407.free_defunc_0_g_res_232932 =
            defunc_0_g_res_232932;
        futhark_mc_task_236407.free_a12_232997 = a12_232997;
        futhark_mc_task_236407.free_b12_232998 = b12_232998;
        futhark_mc_task_236407.free_c12_232999 = c12_232999;
        futhark_mc_task_236407.free_b2_233000 = b2_233000;
        futhark_mc_task_236407.free_c2_233001 = c2_233001;
        futhark_mc_task_236407.retval_defunc_2_reduce_res_233002 =
            &defunc_2_reduce_res_233002;
        futhark_mc_task_236407.retval_defunc_2_reduce_res_233003 =
            &defunc_2_reduce_res_233003;
        
        struct scheduler_segop futhark_mc_task_236407_task;
        
        futhark_mc_task_236407_task.args = &futhark_mc_task_236407;
        futhark_mc_task_236407_task.top_level_fn =
            futhark_mc_segred_task_236408;
        futhark_mc_task_236407_task.name = "futhark_mc_segred_task_236408";
        futhark_mc_task_236407_task.iterations = q_t_203494;
        futhark_mc_task_236407_task.task_time =
            &ctx->futhark_mc_segred_task_236408_total_time;
        futhark_mc_task_236407_task.task_iter =
            &ctx->futhark_mc_segred_task_236408_total_iter;
        futhark_mc_task_236407_task.sched = STATIC;
        futhark_mc_task_236407_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236408_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236407_task);
        
        if (futhark_mc_segred_task_236408_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219998.mem)[gtid_232927] = defunc_2_reduce_res_233002;
        ((double *) mem_220001.mem)[gtid_232927] = defunc_2_reduce_res_233003;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236397_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236397_end -
                 futhark_mc_segmap_parloop_236397_start;
        
        ctx->futhark_mc_segmap_parloop_236397_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236397_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236397_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236395(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232926 = tid;
    int num_tasks_233177 = info.nsubtasks;
    struct futhark_mc_task_236391 *futhark_mc_task_236391 =
                                  (struct futhark_mc_task_236391 *) args;
    struct futhark_context *ctx = futhark_mc_task_236391->ctx;
    uint64_t futhark_mc_segmap_nested_task_236395_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236395_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236391->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236391->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236391->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236391->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236391->free_i_203670;
    int64_t gtid_214442 = futhark_mc_task_236391->free_gtid_214442;
    int64_t x_214447 = futhark_mc_task_236391->free_x_214447;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236391->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236391->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236391->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_219992 = {.desc ="mem_219992", .mem =
                                  futhark_mc_task_236391->free_mem_219992,
                                  .size =0, .references =NULL};
    struct memblock mem_219995 = {.desc ="mem_219995", .mem =
                                  futhark_mc_task_236391->free_mem_219995,
                                  .size =0, .references =NULL};
    struct memblock mem_219998 = {.desc ="mem_219998", .mem =
                                  futhark_mc_task_236391->free_mem_219998,
                                  .size =0, .references =NULL};
    struct memblock mem_220001 = {.desc ="mem_220001", .mem =
                                  futhark_mc_task_236391->free_mem_220001,
                                  .size =0, .references =NULL};
    int64_t iter_233261;
    struct futhark_mc_segmap_parloop_struct_236396
    futhark_mc_segmap_parloop_struct_236396;
    
    futhark_mc_segmap_parloop_struct_236396.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236396.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236396.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236396.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236396.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236396.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236396.free_gtid_214442 = gtid_214442;
    futhark_mc_segmap_parloop_struct_236396.free_x_214447 = x_214447;
    futhark_mc_segmap_parloop_struct_236396.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236396.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236396.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236396.free_mem_219992 = mem_219992.mem;
    futhark_mc_segmap_parloop_struct_236396.free_mem_219995 = mem_219995.mem;
    futhark_mc_segmap_parloop_struct_236396.free_mem_219998 = mem_219998.mem;
    futhark_mc_segmap_parloop_struct_236396.free_mem_220001 = mem_220001.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236397_task;
    
    futhark_mc_segmap_parloop_236397_task.name =
        "futhark_mc_segmap_parloop_236397";
    futhark_mc_segmap_parloop_236397_task.fn = futhark_mc_segmap_parloop_236397;
    futhark_mc_segmap_parloop_236397_task.args =
        &futhark_mc_segmap_parloop_struct_236396;
    futhark_mc_segmap_parloop_236397_task.iterations = iterations;
    futhark_mc_segmap_parloop_236397_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236397_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236397_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236397_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236397_task);
    
    if (futhark_mc_segmap_parloop_236397_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236397_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236397_total_end -
                 futhark_mc_segmap_parloop_236397_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236397_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236397_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236397_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236395_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236395_end -
                 futhark_mc_segmap_nested_task_236395_start;
        
        ctx->futhark_mc_segmap_nested_task_236395_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236395_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236395_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236377(void *args, int64_t start,
                                            int64_t end, int flat_tid_214441,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236376
    *futhark_mc_segmap_parloop_struct_236376 =
    (struct futhark_mc_segmap_parloop_struct_236376 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236376->ctx;
    uint64_t futhark_mc_segmap_parloop_236377_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236377_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236376->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236376->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236376->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236376->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236376->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236376->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236376->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236376->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236376->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236376->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236376->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236376->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220080 = {.desc ="mem_220080", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_220080,
                                  .size =0, .references =NULL};
    struct memblock mem_220084 = {.desc ="mem_220084", .mem =
                                  futhark_mc_segmap_parloop_struct_236376->free_mem_220084,
                                  .size =0, .references =NULL};
    size_t mem_219989_cached_sizze_236378 = 0;
    unsigned char *mem_219989 = NULL;
    size_t mem_219992_cached_sizze_236379 = 0;
    unsigned char *mem_219992 = NULL;
    size_t mem_219995_cached_sizze_236380 = 0;
    unsigned char *mem_219995 = NULL;
    size_t mem_219998_cached_sizze_236381 = 0;
    unsigned char *mem_219998 = NULL;
    size_t mem_220001_cached_sizze_236382 = 0;
    unsigned char *mem_220001 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232906 = start;
    
    if (mem_219989_cached_sizze_236378 < (size_t) bytes_217302) {
        mem_219989 = realloc(mem_219989, bytes_217302);
        mem_219989_cached_sizze_236378 = bytes_217302;
    }
    if (mem_219992_cached_sizze_236379 < (size_t) bytes_217302) {
        mem_219992 = realloc(mem_219992, bytes_217302);
        mem_219992_cached_sizze_236379 = bytes_217302;
    }
    if (mem_219995_cached_sizze_236380 < (size_t) bytes_217302) {
        mem_219995 = realloc(mem_219995, bytes_217302);
        mem_219995_cached_sizze_236380 = bytes_217302;
    }
    if (mem_219998_cached_sizze_236381 < (size_t) bytes_217782) {
        mem_219998 = realloc(mem_219998, bytes_217782);
        mem_219998_cached_sizze_236381 = bytes_217782;
    }
    if (mem_220001_cached_sizze_236382 < (size_t) bytes_217782) {
        mem_220001 = realloc(mem_220001, bytes_217782);
        mem_220001_cached_sizze_236382 = bytes_217782;
    }
    for (; iter_232906 < end; iter_232906++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233159 = partition_sizze_203577;
        int64_t gtid_214442 = iter_232906;
        int64_t remnant_233160 = iter_232906 - gtid_214442;
        int64_t x_214447;
        
        x_214447 = ((int64_t *) mem_217343.mem)[gtid_214442];
        
        int64_t flat_tid_232907 = (int64_t) 0;
        int32_t num_tasks_233161;
        struct futhark_mc_task_236383 futhark_mc_task_236383;
        
        futhark_mc_task_236383.ctx = ctx;
        futhark_mc_task_236383.free_n_203490 = n_203490;
        futhark_mc_task_236383.free_gtid_214442 = gtid_214442;
        futhark_mc_task_236383.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236383.free_mem_219808 = mem_219808.mem;
        futhark_mc_task_236383.free_mem_219989 = mem_219989;
        
        struct scheduler_segop futhark_mc_task_236383_task;
        
        futhark_mc_task_236383_task.args = &futhark_mc_task_236383;
        futhark_mc_task_236383_task.top_level_fn =
            futhark_mc_segmap_task_236384;
        futhark_mc_task_236383_task.name = "futhark_mc_segmap_task_236384";
        futhark_mc_task_236383_task.iterations = n_203490;
        futhark_mc_task_236383_task.task_time =
            &ctx->futhark_mc_segmap_task_236384_total_time;
        futhark_mc_task_236383_task.task_iter =
            &ctx->futhark_mc_segmap_task_236384_total_iter;
        futhark_mc_task_236383_task.sched = STATIC;
        futhark_mc_task_236383_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236384_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236383_task);
        
        if (futhark_mc_segmap_task_236384_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232912 = (int64_t) 0;
        int32_t num_tasks_233165;
        struct futhark_mc_task_236387 futhark_mc_task_236387;
        
        futhark_mc_task_236387.ctx = ctx;
        futhark_mc_task_236387.free_n_203490 = n_203490;
        futhark_mc_task_236387.free_gtid_214442 = gtid_214442;
        futhark_mc_task_236387.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236387.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236387.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236387.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236387.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236387.free_mem_219989 = mem_219989;
        futhark_mc_task_236387.free_mem_219992 = mem_219992;
        futhark_mc_task_236387.free_mem_219995 = mem_219995;
        
        struct scheduler_segop futhark_mc_task_236387_task;
        
        futhark_mc_task_236387_task.args = &futhark_mc_task_236387;
        futhark_mc_task_236387_task.top_level_fn =
            futhark_mc_segmap_task_236388;
        futhark_mc_task_236387_task.name = "futhark_mc_segmap_task_236388";
        futhark_mc_task_236387_task.iterations = n_203490;
        futhark_mc_task_236387_task.task_time =
            &ctx->futhark_mc_segmap_task_236388_total_time;
        futhark_mc_task_236387_task.task_iter =
            &ctx->futhark_mc_segmap_task_236388_total_iter;
        futhark_mc_task_236387_task.sched = STATIC;
        futhark_mc_task_236387_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236388_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236387_task);
        
        if (futhark_mc_segmap_task_236388_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233047 = (int64_t) 0;
        int32_t num_tasks_233177;
        int64_t flat_tid_232926 = (int64_t) 0;
        struct futhark_mc_task_236391 futhark_mc_task_236391;
        
        futhark_mc_task_236391.ctx = ctx;
        futhark_mc_task_236391.free_n_203490 = n_203490;
        futhark_mc_task_236391.free_q_t_203494 = q_t_203494;
        futhark_mc_task_236391.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236391.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_236391.free_i_203670 = i_203670;
        futhark_mc_task_236391.free_gtid_214442 = gtid_214442;
        futhark_mc_task_236391.free_x_214447 = x_214447;
        futhark_mc_task_236391.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236391.free_mem_217835 = mem_217835.mem;
        futhark_mc_task_236391.free_mem_217839 = mem_217839.mem;
        futhark_mc_task_236391.free_mem_219992 = mem_219992;
        futhark_mc_task_236391.free_mem_219995 = mem_219995;
        futhark_mc_task_236391.free_mem_219998 = mem_219998;
        futhark_mc_task_236391.free_mem_220001 = mem_220001;
        
        struct scheduler_segop futhark_mc_task_236391_task;
        
        futhark_mc_task_236391_task.args = &futhark_mc_task_236391;
        futhark_mc_task_236391_task.top_level_fn =
            futhark_mc_segmap_task_236392;
        futhark_mc_task_236391_task.name = "futhark_mc_segmap_task_236392";
        futhark_mc_task_236391_task.iterations = t_n_m_203650;
        futhark_mc_task_236391_task.task_time =
            &ctx->futhark_mc_segmap_task_236392_total_time;
        futhark_mc_task_236391_task.task_iter =
            &ctx->futhark_mc_segmap_task_236392_total_iter;
        futhark_mc_task_236391_task.sched = STATIC;
        futhark_mc_task_236391_task.nested_fn =
            futhark_mc_segmap_nested_task_236395;
        
        int futhark_mc_segmap_task_236392_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236391_task);
        
        if (futhark_mc_segmap_task_236392_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220080.mem + gtid_214442 * t_n_m_203650 * (int64_t) 8,
                    mem_219998 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220084.mem + gtid_214442 * t_n_m_203650 * (int64_t) 8,
                    mem_220001 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219989);
    free(mem_219992);
    free(mem_219995);
    free(mem_219998);
    free(mem_220001);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236377_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236377_end -
                 futhark_mc_segmap_parloop_236377_start;
        
        ctx->futhark_mc_segmap_parloop_236377_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236377_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236377_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236375(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214441 = tid;
    int num_tasks_232752 = info.nsubtasks;
    struct futhark_mc_task_236366 *futhark_mc_task_236366 =
                                  (struct futhark_mc_task_236366 *) args;
    struct futhark_context *ctx = futhark_mc_task_236366->ctx;
    uint64_t futhark_mc_segmap_nested_task_236375_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236375_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236366->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236366->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236366->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236366->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236366->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236366->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236366->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236366->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236366->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236366->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236366->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236366->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236366->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236366->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236366->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236366->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236366->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236366->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220080 = {.desc ="mem_220080", .mem =
                                  futhark_mc_task_236366->free_mem_220080,
                                  .size =0, .references =NULL};
    struct memblock mem_220084 = {.desc ="mem_220084", .mem =
                                  futhark_mc_task_236366->free_mem_220084,
                                  .size =0, .references =NULL};
    int64_t iter_232906;
    struct futhark_mc_segmap_parloop_struct_236376
    futhark_mc_segmap_parloop_struct_236376;
    
    futhark_mc_segmap_parloop_struct_236376.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236376.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236376.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236376.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236376.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236376.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236376.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236376.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236376.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236376.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236376.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236376.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236376.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236376.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236376.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236376.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236376.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236376.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236376.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236376.free_mem_220080 = mem_220080.mem;
    futhark_mc_segmap_parloop_struct_236376.free_mem_220084 = mem_220084.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236377_task;
    
    futhark_mc_segmap_parloop_236377_task.name =
        "futhark_mc_segmap_parloop_236377";
    futhark_mc_segmap_parloop_236377_task.fn = futhark_mc_segmap_parloop_236377;
    futhark_mc_segmap_parloop_236377_task.args =
        &futhark_mc_segmap_parloop_struct_236376;
    futhark_mc_segmap_parloop_236377_task.iterations = iterations;
    futhark_mc_segmap_parloop_236377_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236377_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236377_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236377_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236377_task);
    
    if (futhark_mc_segmap_parloop_236377_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236377_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236377_total_end -
                 futhark_mc_segmap_parloop_236377_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236377_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236377_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236377_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236375_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236375_end -
                 futhark_mc_segmap_nested_task_236375_start;
        
        ctx->futhark_mc_segmap_nested_task_236375_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236375_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236375_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236413 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220103;
    unsigned char *free_mem_220201;
};
struct futhark_mc_segmap_parloop_struct_236415 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220103;
    unsigned char *free_mem_220201;
};
static int futhark_mc_segmap_parloop_236416(void *args, int64_t start,
                                            int64_t end, int flat_tid_214718,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236415
    *futhark_mc_segmap_parloop_struct_236415 =
    (struct futhark_mc_segmap_parloop_struct_236415 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236415->ctx;
    uint64_t futhark_mc_segmap_parloop_236416_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236416_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236415->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236415->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236415->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236415->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236415->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236415->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236415->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236415->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236415->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236415->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236415->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236415->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236415->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236415->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236415->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236415->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236415->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236415->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 =
            futhark_mc_segmap_parloop_struct_236415->free_bytes_220103;
    struct memblock mem_220201 = {.desc ="mem_220201", .mem =
                                  futhark_mc_segmap_parloop_struct_236415->free_mem_220201,
                                  .size =0, .references =NULL};
    size_t mem_220125_cached_sizze_236417 = 0;
    unsigned char *mem_220125 = NULL;
    size_t mem_220140_cached_sizze_236418 = 0;
    unsigned char *mem_220140 = NULL;
    size_t mem_220143_cached_sizze_236419 = 0;
    unsigned char *mem_220143 = NULL;
    size_t mem_220170_cached_sizze_236420 = 0;
    unsigned char *mem_220170 = NULL;
    size_t mem_220180_cached_sizze_236421 = 0;
    unsigned char *mem_220180 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233397 = start;
    
    if (mem_220125_cached_sizze_236417 < (size_t) bytes_217302) {
        mem_220125 = realloc(mem_220125, bytes_217302);
        mem_220125_cached_sizze_236417 = bytes_217302;
    }
    if (mem_220140_cached_sizze_236418 < (size_t) bytes_217302) {
        mem_220140 = realloc(mem_220140, bytes_217302);
        mem_220140_cached_sizze_236418 = bytes_217302;
    }
    if (mem_220143_cached_sizze_236419 < (size_t) bytes_217302) {
        mem_220143 = realloc(mem_220143, bytes_217302);
        mem_220143_cached_sizze_236419 = bytes_217302;
    }
    if (mem_220170_cached_sizze_236420 < (size_t) bytes_217782) {
        mem_220170 = realloc(mem_220170, bytes_217782);
        mem_220170_cached_sizze_236420 = bytes_217782;
    }
    if (mem_220180_cached_sizze_236421 < (size_t) bytes_220103) {
        mem_220180 = realloc(mem_220180, bytes_220103);
        mem_220180_cached_sizze_236421 = bytes_220103;
    }
    for (; iter_233397 < end; iter_233397++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233467 = partition_sizze_203577;
        int64_t gtid_214719 = iter_233397;
        int64_t remnant_233468 = iter_233397 - gtid_214719;
        int64_t x_206224;
        
        x_206224 = ((int64_t *) mem_217343.mem)[gtid_214719];
        for (int64_t i_233398 = 0; i_233398 < n_203490; i_233398++) {
            double x_233400;
            
            x_233400 = ((double *) mem_217297.mem)[gtid_214719 * n_203490 +
                                                   i_233398];
            
            double x_233401;
            
            x_233401 = ((double *) mem_219808.mem)[gtid_214719 * n_203490 +
                                                   i_233398];
            
            double defunc_1_f_res_233402 = x_233400 - x_233401;
            
            ((double *) mem_220125)[i_233398] = defunc_1_f_res_233402;
        }
        for (int64_t i_233404 = 0; i_233404 < n_203490; i_233404++) {
            int64_t x_233407;
            
            x_233407 = ((int64_t *) mem_217340.mem)[gtid_214719 * n_203490 +
                                                    i_233404];
            
            bool cond_233408 = sle64((int64_t) 0, x_233407);
            double defunc_0_f_res_233409;
            
            if (cond_233408) {
                bool y_233410 = slt64(x_233407, n_203490);
                bool bounds_check_233411 = cond_233408 && y_233410;
                bool index_certs_233412;
                
                if (!bounds_check_233411) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233407,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_233413;
                
                defunc_0_f_res_t_res_233413 = ((double *) mem_220125)[x_233407];
                defunc_0_f_res_233409 = defunc_0_f_res_t_res_233413;
            } else {
                defunc_0_f_res_233409 = 0.0;
            }
            
            double defunc_0_f_res_233414;
            
            if (cond_233408) {
                bool y_233415 = slt64(x_233407, n_203490);
                bool bounds_check_233416 = cond_233408 && y_233415;
                bool index_certs_233417;
                
                if (!bounds_check_233416) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233407,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_233418;
                
                defunc_0_f_res_t_res_233418 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_214719 *
                                                       ctx_param_ext_217867 +
                                                       x_233407 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_233414 = defunc_0_f_res_t_res_233418;
            } else {
                defunc_0_f_res_233414 = 0.0;
            }
            ((double *) mem_220140)[i_233404] = defunc_0_f_res_233414;
            ((double *) mem_220143)[i_233404] = defunc_0_f_res_233409;
        }
        for (int64_t i_233421 = 0; i_233421 < t_n_m_203650; i_233421++) {
            int64_t x_233423;
            
            x_233423 = ((int64_t *) mem_217835.mem)[gtid_214719 * t_n_m_203650 +
                                                    i_233421];
            
            double x_233424;
            
            x_233424 = ((double *) mem_217839.mem)[gtid_214719 * t_n_m_203650 +
                                                   i_233421];
            
            int64_t min_arg_233425 = mul64(jump_t_203500, i_233421);
            int64_t min_res_233426 = smin64(i_203670, min_arg_233425);
            int64_t defunc_0_g_res_233427 = add64((int64_t) 1, min_res_233426);
            double defunc_2_reduce_res_233429;
            double redout_233432 = 0.0;
            
            for (int64_t i_233431 = 0; i_233431 < q_t_203494; i_233431++) {
                bool cond_233434 = sle64(x_206224, i_233431);
                int64_t defunc_0_f_res_233435;
                
                if (cond_233434) {
                    defunc_0_f_res_233435 = (int64_t) 0;
                } else {
                    int64_t i_233436 = add64(x_233423, i_233431);
                    int64_t defunc_0_add_arg_233437;
                    
                    defunc_0_add_arg_233437 =
                        ((int64_t *) mem_217340.mem)[gtid_214719 * n_203490 +
                                                     i_233436];
                    
                    int64_t defunc_1_add_res_233438 = add64((int64_t) 1,
                                                            defunc_0_add_arg_233437);
                    
                    defunc_0_f_res_233435 = defunc_1_add_res_233438;
                }
                
                double defunc_0_f_res_233439;
                
                if (cond_233434) {
                    defunc_0_f_res_233439 = 0.0;
                } else {
                    int64_t i_233440 = add64(x_233423, i_233431);
                    double defunc_0_add_arg_233441;
                    
                    defunc_0_add_arg_233441 = ((double *) mem_220140)[i_233440];
                    defunc_0_f_res_233439 = defunc_0_add_arg_233441;
                }
                
                int64_t binop_p_233442 = sub64(defunc_0_f_res_233435,
                                               defunc_0_g_res_233427);
                double defunc_0_f_res_233443 = sitofp_i64_f64(binop_p_233442);
                double abs_res_233444 = fabs(defunc_0_f_res_233443);
                double tmp1_233445 = abs_res_233444 / x_233424;
                double x_233446 = tmp1_233445 * tmp1_233445;
                double y_233447 = tmp1_233445 * x_233446;
                double tmp2_233448 = 1.0 - y_233447;
                double x_233449 = tmp2_233448 * tmp2_233448;
                double tmp3_233450 = tmp2_233448 * x_233449;
                double tmp4_233451 = defunc_0_f_res_233439 * tmp3_233450;
                double defunc_1_op_res_233452 = tmp4_233451 + redout_233432;
                
                ((double *) mem_220180)[i_233431] = tmp4_233451;
                
                double redout_tmp_233473 = defunc_1_op_res_233452;
                
                redout_233432 = redout_tmp_233473;
            }
            defunc_2_reduce_res_233429 = redout_233432;
            
            double a0_233454 = 1.0 / defunc_2_reduce_res_233429;
            double defunc_2_reduce_res_233455;
            double redout_233457 = 0.0;
            
            for (int64_t i_233456 = 0; i_233456 < q_t_203494; i_233456++) {
                double x_233458;
                
                x_233458 = ((double *) mem_220180)[i_233456];
                
                bool cond_233459 = sle64(x_206224, i_233456);
                double defunc_0_f_res_233460;
                
                if (cond_233459) {
                    defunc_0_f_res_233460 = 0.0;
                } else {
                    int64_t i_233461 = add64(x_233423, i_233456);
                    double defunc_0_add_arg_233462;
                    
                    defunc_0_add_arg_233462 = ((double *) mem_220143)[i_233461];
                    defunc_0_f_res_233460 = defunc_0_add_arg_233462;
                }
                
                double x_233463 = a0_233454 * x_233458;
                double defunc_9_fit_fun_res_233464 = defunc_0_f_res_233460 *
                       x_233463;
                double defunc_1_op_res_233465 = defunc_9_fit_fun_res_233464 +
                       redout_233457;
                double redout_tmp_233475 = defunc_1_op_res_233465;
                
                redout_233457 = redout_tmp_233475;
            }
            defunc_2_reduce_res_233455 = redout_233457;
            ((double *) mem_220170)[i_233421] = defunc_2_reduce_res_233455;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220201.mem + gtid_214719 * t_n_m_203650 * (int64_t) 8,
                    mem_220170 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220125);
    free(mem_220140);
    free(mem_220143);
    free(mem_220170);
    free(mem_220180);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236416_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236416_end -
                 futhark_mc_segmap_parloop_236416_start;
        
        ctx->futhark_mc_segmap_parloop_236416_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236416_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236416_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236414(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214718 = tid;
    int num_tasks_233396 = info.nsubtasks;
    struct futhark_mc_task_236413 *futhark_mc_task_236413 =
                                  (struct futhark_mc_task_236413 *) args;
    struct futhark_context *ctx = futhark_mc_task_236413->ctx;
    uint64_t futhark_mc_segmap_task_236414_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236414_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236413->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236413->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236413->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236413->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236413->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236413->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236413->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236413->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236413->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236413->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236413->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236413->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236413->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236413->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236413->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236413->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236413->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236413->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 = futhark_mc_task_236413->free_bytes_220103;
    struct memblock mem_220201 = {.desc ="mem_220201", .mem =
                                  futhark_mc_task_236413->free_mem_220201,
                                  .size =0, .references =NULL};
    int64_t iter_233397;
    struct futhark_mc_segmap_parloop_struct_236415
    futhark_mc_segmap_parloop_struct_236415;
    
    futhark_mc_segmap_parloop_struct_236415.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236415.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236415.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236415.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236415.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236415.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236415.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236415.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236415.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236415.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236415.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236415.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236415.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236415.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236415.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236415.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236415.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236415.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236415.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236415.free_bytes_220103 = bytes_220103;
    futhark_mc_segmap_parloop_struct_236415.free_mem_220201 = mem_220201.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236416_task;
    
    futhark_mc_segmap_parloop_236416_task.name =
        "futhark_mc_segmap_parloop_236416";
    futhark_mc_segmap_parloop_236416_task.fn = futhark_mc_segmap_parloop_236416;
    futhark_mc_segmap_parloop_236416_task.args =
        &futhark_mc_segmap_parloop_struct_236415;
    futhark_mc_segmap_parloop_236416_task.iterations = iterations;
    futhark_mc_segmap_parloop_236416_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236416_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236416_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236416_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236416_task);
    
    if (futhark_mc_segmap_parloop_236416_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236416_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236416_total_end -
                 futhark_mc_segmap_parloop_236416_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236416_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236416_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236416_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236414_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236414_end -
                 futhark_mc_segmap_task_236414_start;
        
        ctx->futhark_mc_segmap_task_236414_runs[tid]++;
        ctx->futhark_mc_segmap_task_236414_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236414_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236423 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220103;
    unsigned char *free_mem_220201;
};
struct futhark_mc_task_236429 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214784;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220095;
};
struct futhark_mc_segmap_parloop_struct_236431 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214784;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220095;
};
static int futhark_mc_segmap_parloop_236432(void *args, int64_t start,
                                            int64_t end, int flat_tid_233477,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236431
    *futhark_mc_segmap_parloop_struct_236431 =
    (struct futhark_mc_segmap_parloop_struct_236431 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236431->ctx;
    uint64_t futhark_mc_segmap_parloop_236432_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236432_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236431->free_n_203490;
    int64_t gtid_214784 =
            futhark_mc_segmap_parloop_struct_236431->free_gtid_214784;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236431->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236431->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220095 = {.desc ="mem_220095", .mem =
                                  futhark_mc_segmap_parloop_struct_236431->free_mem_220095,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233592 = start;
    
    for (; iter_233592 < end; iter_233592++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233593 = n_203490;
        int64_t gtid_233478 = iter_233592;
        int64_t remnant_233594 = iter_233592 - gtid_233478;
        double x_233479;
        
        x_233479 = ((double *) mem_217297.mem)[gtid_214784 * n_203490 +
                                               gtid_233478];
        
        double x_233480;
        
        x_233480 = ((double *) mem_219808.mem)[gtid_214784 * n_203490 +
                                               gtid_233478];
        
        double defunc_1_f_res_233481 = x_233479 - x_233480;
        
        ((double *) mem_220095.mem)[gtid_233478] = defunc_1_f_res_233481;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236432_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236432_end -
                 futhark_mc_segmap_parloop_236432_start;
        
        ctx->futhark_mc_segmap_parloop_236432_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236432_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236432_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236430(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233477 = tid;
    int num_tasks_233591 = info.nsubtasks;
    struct futhark_mc_task_236429 *futhark_mc_task_236429 =
                                  (struct futhark_mc_task_236429 *) args;
    struct futhark_context *ctx = futhark_mc_task_236429->ctx;
    uint64_t futhark_mc_segmap_task_236430_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236430_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236429->free_n_203490;
    int64_t gtid_214784 = futhark_mc_task_236429->free_gtid_214784;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236429->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236429->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220095 = {.desc ="mem_220095", .mem =
                                  futhark_mc_task_236429->free_mem_220095,
                                  .size =0, .references =NULL};
    int64_t iter_233592;
    struct futhark_mc_segmap_parloop_struct_236431
    futhark_mc_segmap_parloop_struct_236431;
    
    futhark_mc_segmap_parloop_struct_236431.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236431.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236431.free_gtid_214784 = gtid_214784;
    futhark_mc_segmap_parloop_struct_236431.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236431.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236431.free_mem_220095 = mem_220095.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236432_task;
    
    futhark_mc_segmap_parloop_236432_task.name =
        "futhark_mc_segmap_parloop_236432";
    futhark_mc_segmap_parloop_236432_task.fn = futhark_mc_segmap_parloop_236432;
    futhark_mc_segmap_parloop_236432_task.args =
        &futhark_mc_segmap_parloop_struct_236431;
    futhark_mc_segmap_parloop_236432_task.iterations = iterations;
    futhark_mc_segmap_parloop_236432_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236432_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236432_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236432_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236432_task);
    
    if (futhark_mc_segmap_parloop_236432_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236432_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236432_total_end -
                 futhark_mc_segmap_parloop_236432_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236432_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236432_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236432_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236430_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236430_end -
                 futhark_mc_segmap_task_236430_start;
        
        ctx->futhark_mc_segmap_task_236430_runs[tid]++;
        ctx->futhark_mc_segmap_task_236430_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236430_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236433 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214784;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_220095;
    unsigned char *free_mem_220098;
    unsigned char *free_mem_220101;
};
struct futhark_mc_segmap_parloop_struct_236435 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214784;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_220095;
    unsigned char *free_mem_220098;
    unsigned char *free_mem_220101;
};
static int futhark_mc_segmap_parloop_236436(void *args, int64_t start,
                                            int64_t end, int flat_tid_233482,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236435
    *futhark_mc_segmap_parloop_struct_236435 =
    (struct futhark_mc_segmap_parloop_struct_236435 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236435->ctx;
    uint64_t futhark_mc_segmap_parloop_236436_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236436_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236435->free_n_203490;
    int64_t gtid_214784 =
            futhark_mc_segmap_parloop_struct_236435->free_gtid_214784;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236435->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236435->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236435->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236435->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236435->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_220095 = {.desc ="mem_220095", .mem =
                                  futhark_mc_segmap_parloop_struct_236435->free_mem_220095,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_segmap_parloop_struct_236435->free_mem_220098,
                                  .size =0, .references =NULL};
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_segmap_parloop_struct_236435->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233596 = start;
    
    for (; iter_233596 < end; iter_233596++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233605 = n_203490;
        int64_t gtid_233483 = iter_233596;
        int64_t remnant_233606 = iter_233596 - gtid_233483;
        int64_t x_233484;
        
        x_233484 = ((int64_t *) mem_217340.mem)[gtid_214784 * n_203490 +
                                                gtid_233483];
        
        bool cond_233485 = sle64((int64_t) 0, x_233484);
        double defunc_0_f_res_233486;
        
        if (cond_233485) {
            bool y_233597 = slt64(x_233484, n_203490);
            bool bounds_check_233598 = cond_233485 && y_233597;
            bool index_certs_233599;
            
            if (!bounds_check_233598) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233484,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_233600;
            
            defunc_0_f_res_t_res_233600 = ((double *) mem_220095.mem)[x_233484];
            defunc_0_f_res_233486 = defunc_0_f_res_t_res_233600;
        } else {
            defunc_0_f_res_233486 = 0.0;
        }
        
        double defunc_0_f_res_233491;
        
        if (cond_233485) {
            bool y_233601 = slt64(x_233484, n_203490);
            bool bounds_check_233602 = cond_233485 && y_233601;
            bool index_certs_233603;
            
            if (!bounds_check_233602) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233484,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_233604;
            
            defunc_0_f_res_t_res_233604 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_214784 *
                                                   ctx_param_ext_217867 +
                                                   x_233484 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_233491 = defunc_0_f_res_t_res_233604;
        } else {
            defunc_0_f_res_233491 = 0.0;
        }
        ((double *) mem_220098.mem)[gtid_233483] = defunc_0_f_res_233491;
        ((double *) mem_220101.mem)[gtid_233483] = defunc_0_f_res_233486;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236436_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236436_end -
                 futhark_mc_segmap_parloop_236436_start;
        
        ctx->futhark_mc_segmap_parloop_236436_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236436_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236436_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236434(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233482 = tid;
    int num_tasks_233595 = info.nsubtasks;
    struct futhark_mc_task_236433 *futhark_mc_task_236433 =
                                  (struct futhark_mc_task_236433 *) args;
    struct futhark_context *ctx = futhark_mc_task_236433->ctx;
    uint64_t futhark_mc_segmap_task_236434_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236434_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236433->free_n_203490;
    int64_t gtid_214784 = futhark_mc_task_236433->free_gtid_214784;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236433->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236433->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236433->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236433->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236433->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_220095 = {.desc ="mem_220095", .mem =
                                  futhark_mc_task_236433->free_mem_220095,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_task_236433->free_mem_220098,
                                  .size =0, .references =NULL};
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_task_236433->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t iter_233596;
    struct futhark_mc_segmap_parloop_struct_236435
    futhark_mc_segmap_parloop_struct_236435;
    
    futhark_mc_segmap_parloop_struct_236435.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236435.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236435.free_gtid_214784 = gtid_214784;
    futhark_mc_segmap_parloop_struct_236435.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236435.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236435.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236435.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236435.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236435.free_mem_220095 = mem_220095.mem;
    futhark_mc_segmap_parloop_struct_236435.free_mem_220098 = mem_220098.mem;
    futhark_mc_segmap_parloop_struct_236435.free_mem_220101 = mem_220101.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236436_task;
    
    futhark_mc_segmap_parloop_236436_task.name =
        "futhark_mc_segmap_parloop_236436";
    futhark_mc_segmap_parloop_236436_task.fn = futhark_mc_segmap_parloop_236436;
    futhark_mc_segmap_parloop_236436_task.args =
        &futhark_mc_segmap_parloop_struct_236435;
    futhark_mc_segmap_parloop_236436_task.iterations = iterations;
    futhark_mc_segmap_parloop_236436_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236436_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236436_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236436_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236436_task);
    
    if (futhark_mc_segmap_parloop_236436_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236436_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236436_total_end -
                 futhark_mc_segmap_parloop_236436_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236436_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236436_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236436_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236434_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236434_end -
                 futhark_mc_segmap_task_236434_start;
        
        ctx->futhark_mc_segmap_task_236434_runs[tid]++;
        ctx->futhark_mc_segmap_task_236434_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236434_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236437 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214784;
    int64_t free_x_214789;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220098;
    unsigned char *free_mem_220101;
    int64_t free_bytes_220103;
    unsigned char *free_mem_220122;
};
struct futhark_mc_segmap_parloop_struct_236439 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214784;
    int64_t free_x_214789;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220098;
    unsigned char *free_mem_220101;
    int64_t free_bytes_220103;
    unsigned char *free_mem_220122;
};
static int futhark_mc_segmap_parloop_236440(void *args, int64_t start,
                                            int64_t end, int flat_tid_233543,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236439
    *futhark_mc_segmap_parloop_struct_236439 =
    (struct futhark_mc_segmap_parloop_struct_236439 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236439->ctx;
    uint64_t futhark_mc_segmap_parloop_236440_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236440_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236439->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236439->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236439->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236439->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236439->free_i_203670;
    int64_t gtid_214784 =
            futhark_mc_segmap_parloop_struct_236439->free_gtid_214784;
    int64_t x_214789 = futhark_mc_segmap_parloop_struct_236439->free_x_214789;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236439->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236439->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236439->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_segmap_parloop_struct_236439->free_mem_220098,
                                  .size =0, .references =NULL};
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_segmap_parloop_struct_236439->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 =
            futhark_mc_segmap_parloop_struct_236439->free_bytes_220103;
    struct memblock mem_220122 = {.desc ="mem_220122", .mem =
                                  futhark_mc_segmap_parloop_struct_236439->free_mem_220122,
                                  .size =0, .references =NULL};
    size_t mem_233550_cached_sizze_236441 = 0;
    unsigned char *mem_233550 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233608 = start;
    
    if (mem_233550_cached_sizze_236441 < (size_t) bytes_220103) {
        mem_233550 = realloc(mem_233550, bytes_220103);
        mem_233550_cached_sizze_236441 = bytes_220103;
    }
    for (; iter_233608 < end; iter_233608++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233642 = t_n_m_203650;
        int64_t gtid_233544 = iter_233608;
        int64_t remnant_233643 = iter_233608 - gtid_233544;
        int64_t x_233545;
        
        x_233545 = ((int64_t *) mem_217835.mem)[gtid_214784 * t_n_m_203650 +
                                                gtid_233544];
        
        double x_233546;
        
        x_233546 = ((double *) mem_217839.mem)[gtid_214784 * t_n_m_203650 +
                                               gtid_233544];
        
        int64_t min_arg_233547 = mul64(jump_t_203500, gtid_233544);
        int64_t min_res_233548 = smin64(i_203670, min_arg_233547);
        int64_t defunc_0_g_res_233549 = add64((int64_t) 1, min_res_233548);
        double defunc_2_reduce_res_233552;
        double redout_233610 = 0.0;
        
        for (int64_t i_233609 = 0; i_233609 < q_t_203494; i_233609++) {
            bool cond_233612 = sle64(x_214789, i_233609);
            int64_t defunc_0_f_res_233613;
            
            if (cond_233612) {
                defunc_0_f_res_233613 = (int64_t) 0;
            } else {
                int64_t i_233614 = add64(x_233545, i_233609);
                int64_t defunc_0_add_arg_233615;
                
                defunc_0_add_arg_233615 =
                    ((int64_t *) mem_217340.mem)[gtid_214784 * n_203490 +
                                                 i_233614];
                
                int64_t defunc_1_add_res_233616 = add64((int64_t) 1,
                                                        defunc_0_add_arg_233615);
                
                defunc_0_f_res_233613 = defunc_1_add_res_233616;
            }
            
            double defunc_0_f_res_233617;
            
            if (cond_233612) {
                defunc_0_f_res_233617 = 0.0;
            } else {
                int64_t i_233618 = add64(x_233545, i_233609);
                double defunc_0_add_arg_233619;
                
                defunc_0_add_arg_233619 = ((double *) mem_220098.mem)[i_233618];
                defunc_0_f_res_233617 = defunc_0_add_arg_233619;
            }
            
            int64_t binop_p_233620 = sub64(defunc_0_f_res_233613,
                                           defunc_0_g_res_233549);
            double defunc_0_f_res_233621 = sitofp_i64_f64(binop_p_233620);
            double abs_res_233622 = fabs(defunc_0_f_res_233621);
            double tmp1_233623 = abs_res_233622 / x_233546;
            double x_233624 = tmp1_233623 * tmp1_233623;
            double y_233625 = tmp1_233623 * x_233624;
            double tmp2_233626 = 1.0 - y_233625;
            double x_233627 = tmp2_233626 * tmp2_233626;
            double tmp3_233628 = tmp2_233626 * x_233627;
            double tmp4_233629 = defunc_0_f_res_233617 * tmp3_233628;
            double defunc_1_op_res_233630 = tmp4_233629 + redout_233610;
            
            ((double *) mem_233550)[i_233609] = tmp4_233629;
            
            double redout_tmp_233644 = defunc_1_op_res_233630;
            
            redout_233610 = redout_tmp_233644;
        }
        defunc_2_reduce_res_233552 = redout_233610;
        
        double a0_233577 = 1.0 / defunc_2_reduce_res_233552;
        double defunc_2_reduce_res_233578;
        double redout_233633 = 0.0;
        
        for (int64_t i_233632 = 0; i_233632 < q_t_203494; i_233632++) {
            double x_233634;
            
            x_233634 = ((double *) mem_233550)[i_233632];
            
            bool cond_233635 = sle64(x_214789, i_233632);
            double defunc_0_f_res_233636;
            
            if (cond_233635) {
                defunc_0_f_res_233636 = 0.0;
            } else {
                int64_t i_233637 = add64(x_233545, i_233632);
                double defunc_0_add_arg_233638;
                
                defunc_0_add_arg_233638 = ((double *) mem_220101.mem)[i_233637];
                defunc_0_f_res_233636 = defunc_0_add_arg_233638;
            }
            
            double x_233639 = a0_233577 * x_233634;
            double defunc_9_fit_fun_res_233640 = defunc_0_f_res_233636 *
                   x_233639;
            double defunc_1_op_res_233641 = defunc_9_fit_fun_res_233640 +
                   redout_233633;
            double redout_tmp_233646 = defunc_1_op_res_233641;
            
            redout_233633 = redout_tmp_233646;
        }
        defunc_2_reduce_res_233578 = redout_233633;
        ((double *) mem_220122.mem)[gtid_233544] = defunc_2_reduce_res_233578;
    }
    
  cleanup:
    { }
    free(mem_233550);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236440_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236440_end -
                 futhark_mc_segmap_parloop_236440_start;
        
        ctx->futhark_mc_segmap_parloop_236440_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236440_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236440_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236438(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233543 = tid;
    int num_tasks_233607 = info.nsubtasks;
    struct futhark_mc_task_236437 *futhark_mc_task_236437 =
                                  (struct futhark_mc_task_236437 *) args;
    struct futhark_context *ctx = futhark_mc_task_236437->ctx;
    uint64_t futhark_mc_segmap_task_236438_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236438_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236437->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236437->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236437->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236437->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236437->free_i_203670;
    int64_t gtid_214784 = futhark_mc_task_236437->free_gtid_214784;
    int64_t x_214789 = futhark_mc_task_236437->free_x_214789;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236437->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236437->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236437->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_task_236437->free_mem_220098,
                                  .size =0, .references =NULL};
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_task_236437->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 = futhark_mc_task_236437->free_bytes_220103;
    struct memblock mem_220122 = {.desc ="mem_220122", .mem =
                                  futhark_mc_task_236437->free_mem_220122,
                                  .size =0, .references =NULL};
    int64_t iter_233608;
    struct futhark_mc_segmap_parloop_struct_236439
    futhark_mc_segmap_parloop_struct_236439;
    
    futhark_mc_segmap_parloop_struct_236439.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236439.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236439.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236439.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236439.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236439.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236439.free_gtid_214784 = gtid_214784;
    futhark_mc_segmap_parloop_struct_236439.free_x_214789 = x_214789;
    futhark_mc_segmap_parloop_struct_236439.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236439.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236439.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236439.free_mem_220098 = mem_220098.mem;
    futhark_mc_segmap_parloop_struct_236439.free_mem_220101 = mem_220101.mem;
    futhark_mc_segmap_parloop_struct_236439.free_bytes_220103 = bytes_220103;
    futhark_mc_segmap_parloop_struct_236439.free_mem_220122 = mem_220122.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236440_task;
    
    futhark_mc_segmap_parloop_236440_task.name =
        "futhark_mc_segmap_parloop_236440";
    futhark_mc_segmap_parloop_236440_task.fn = futhark_mc_segmap_parloop_236440;
    futhark_mc_segmap_parloop_236440_task.args =
        &futhark_mc_segmap_parloop_struct_236439;
    futhark_mc_segmap_parloop_236440_task.iterations = iterations;
    futhark_mc_segmap_parloop_236440_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236440_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236440_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236440_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236440_task);
    
    if (futhark_mc_segmap_parloop_236440_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236440_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236440_total_end -
                 futhark_mc_segmap_parloop_236440_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236440_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236440_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236440_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236438_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236438_end -
                 futhark_mc_segmap_task_236438_start;
        
        ctx->futhark_mc_segmap_task_236438_runs[tid]++;
        ctx->futhark_mc_segmap_task_236438_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236438_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236443 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_214784;
    int64_t free_x_214789;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220098;
    unsigned char *free_mem_220101;
    int64_t free_bytes_220103;
    unsigned char *free_mem_220122;
};
struct futhark_mc_task_236446 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214784;
    int64_t free_x_214789;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220098;
    int64_t free_x_233498;
    double free_x_233499;
    int64_t free_defunc_0_g_res_233502;
    double *retval_defunc_2_reduce_res_233504;
    unsigned char *retval_mem_233503;
};
struct futhark_mc_segred_stage_1_parloop_struct_236449 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_214784;
    int64_t free_x_214789;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220098;
    int64_t free_x_233498;
    double free_x_233499;
    int64_t free_defunc_0_g_res_233502;
    unsigned char *free_mem_233503;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233686;
};
static int futhark_mc_segred_stage_1_parloop_236450(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233648,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236449
    *futhark_mc_segred_stage_1_parloop_struct_236449 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236449 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236449->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236450_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236450_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236449->free_n_203490;
    int64_t gtid_214784 =
            futhark_mc_segred_stage_1_parloop_struct_236449->free_gtid_214784;
    int64_t x_214789 =
            futhark_mc_segred_stage_1_parloop_struct_236449->free_x_214789;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236449->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236449->free_mem_220098,
                                  .size =0, .references =NULL};
    int64_t x_233498 =
            futhark_mc_segred_stage_1_parloop_struct_236449->free_x_233498;
    double x_233499 =
           futhark_mc_segred_stage_1_parloop_struct_236449->free_x_233499;
    int64_t defunc_0_g_res_233502 =
            futhark_mc_segred_stage_1_parloop_struct_236449->free_defunc_0_g_res_233502;
    struct memblock mem_233503 = {.desc ="mem_233503", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236449->free_mem_233503,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233686 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233686",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236449->free_reduce_stage_1_tid_res_arr_mem_233686,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233688 = start;
    double x_233650;
    double x_233651;
    double local_acc_233689 = 0.0;
    
    for (; iter_233688 < end; iter_233688++) {
        int64_t gtid_233649 = iter_233688;
        bool cond_233653 = sle64(x_214789, gtid_233649);
        int64_t defunc_0_f_res_233654;
        
        if (cond_233653) {
            defunc_0_f_res_233654 = (int64_t) 0;
        } else {
            int64_t i_233655 = add64(x_233498, gtid_233649);
            int64_t defunc_0_add_arg_233656;
            
            defunc_0_add_arg_233656 = ((int64_t *) mem_217340.mem)[gtid_214784 *
                                                                   n_203490 +
                                                                   i_233655];
            
            int64_t defunc_1_add_res_233657 = add64((int64_t) 1,
                                                    defunc_0_add_arg_233656);
            
            defunc_0_f_res_233654 = defunc_1_add_res_233657;
        }
        
        double defunc_0_f_res_233658;
        
        if (cond_233653) {
            defunc_0_f_res_233658 = 0.0;
        } else {
            int64_t i_233659 = add64(x_233498, gtid_233649);
            double defunc_0_add_arg_233660;
            
            defunc_0_add_arg_233660 = ((double *) mem_220098.mem)[i_233659];
            defunc_0_f_res_233658 = defunc_0_add_arg_233660;
        }
        
        int64_t binop_p_233661 = sub64(defunc_0_f_res_233654,
                                       defunc_0_g_res_233502);
        double defunc_0_f_res_233662 = sitofp_i64_f64(binop_p_233661);
        double abs_res_233663 = fabs(defunc_0_f_res_233662);
        double tmp1_233664 = abs_res_233663 / x_233499;
        double x_233665 = tmp1_233664 * tmp1_233664;
        double y_233666 = tmp1_233664 * x_233665;
        double tmp2_233667 = 1.0 - y_233666;
        double x_233668 = tmp2_233667 * tmp2_233667;
        double tmp3_233669 = tmp2_233667 * x_233668;
        double tmp4_233670 = defunc_0_f_res_233658 * tmp3_233669;
        
        // save map-out results
        {
            ((double *) mem_233503.mem)[gtid_233649] = tmp4_233670;
        }
        // Load accum params
        {
            x_233650 = local_acc_233689;
        }
        // Load next params
        {
            x_233651 = tmp4_233670;
        }
        // Red body
        {
            double defunc_1_op_res_233652 = x_233650 + x_233651;
            
            local_acc_233689 = defunc_1_op_res_233652;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233686.mem)[flat_tid_233648] =
        local_acc_233689;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236450_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236450_end -
                 futhark_mc_segred_stage_1_parloop_236450_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236450_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236450_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236450_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236447(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233648 = tid;
    int num_tasks_233685 = info.nsubtasks;
    struct futhark_mc_task_236446 *futhark_mc_task_236446 =
                                  (struct futhark_mc_task_236446 *) args;
    struct futhark_context *ctx = futhark_mc_task_236446->ctx;
    uint64_t futhark_mc_segred_task_236447_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236447_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236446->free_n_203490;
    int64_t gtid_214784 = futhark_mc_task_236446->free_gtid_214784;
    int64_t x_214789 = futhark_mc_task_236446->free_x_214789;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236446->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_task_236446->free_mem_220098,
                                  .size =0, .references =NULL};
    int64_t x_233498 = futhark_mc_task_236446->free_x_233498;
    double x_233499 = futhark_mc_task_236446->free_x_233499;
    int64_t defunc_0_g_res_233502 =
            futhark_mc_task_236446->free_defunc_0_g_res_233502;
    double defunc_2_reduce_res_233504 =
           *futhark_mc_task_236446->retval_defunc_2_reduce_res_233504;
    struct memblock mem_233503 = {.desc ="mem_233503", .mem =
                                  futhark_mc_task_236446->retval_mem_233503,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_233686_cached_sizze_236448 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233686 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233686_cached_sizze_236448 <
        (size_t) ((int64_t) 8 * num_tasks_233685)) {
        reduce_stage_1_tid_res_arr_mem_233686 =
            realloc(reduce_stage_1_tid_res_arr_mem_233686, (int64_t) 8 *
                    num_tasks_233685);
        reduce_stage_1_tid_res_arr_mem_233686_cached_sizze_236448 =
            (int64_t) 8 * num_tasks_233685;
    }
    
    int64_t iter_233688;
    struct futhark_mc_segred_stage_1_parloop_struct_236449
    futhark_mc_segred_stage_1_parloop_struct_236449;
    
    futhark_mc_segred_stage_1_parloop_struct_236449.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_gtid_214784 =
        gtid_214784;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_x_214789 = x_214789;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_mem_220098 =
        mem_220098.mem;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_x_233498 = x_233498;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_x_233499 = x_233499;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_defunc_0_g_res_233502 =
        defunc_0_g_res_233502;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_mem_233503 =
        mem_233503.mem;
    futhark_mc_segred_stage_1_parloop_struct_236449.free_reduce_stage_1_tid_res_arr_mem_233686 =
        reduce_stage_1_tid_res_arr_mem_233686;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236450_task;
    
    futhark_mc_segred_stage_1_parloop_236450_task.name =
        "futhark_mc_segred_stage_1_parloop_236450";
    futhark_mc_segred_stage_1_parloop_236450_task.fn =
        futhark_mc_segred_stage_1_parloop_236450;
    futhark_mc_segred_stage_1_parloop_236450_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236449;
    futhark_mc_segred_stage_1_parloop_236450_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236450_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236450_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236450_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236450_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236450_task);
    
    if (futhark_mc_segred_stage_1_parloop_236450_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236450_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236450_total_end -
                 futhark_mc_segred_stage_1_parloop_236450_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236450_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236450_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236450_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233504 = 0.0;
    }
    
    double x_233690;
    double x_233691;
    
    for (int32_t i_233693 = 0; i_233693 < num_tasks_233685; i_233693++) {
        flat_tid_233648 = i_233693;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233690 = defunc_2_reduce_res_233504;
            }
            // load next params
            {
                x_233691 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233686)[flat_tid_233648];
            }
            // red body
            {
                double defunc_1_op_res_233692 = x_233690 + x_233691;
                
                defunc_2_reduce_res_233504 = defunc_1_op_res_233692;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233686);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236447_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236447_end -
                 futhark_mc_segred_task_236447_start;
        
        ctx->futhark_mc_segred_task_236447_runs[tid]++;
        ctx->futhark_mc_segred_task_236447_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236447_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236446->retval_defunc_2_reduce_res_233504 =
            defunc_2_reduce_res_233504;
        futhark_mc_task_236446->retval_mem_233503 = mem_233503.mem;
    }
    return err;
}
struct futhark_mc_task_236451 {
    struct futhark_context *ctx;
    int64_t free_x_214789;
    unsigned char *free_mem_220101;
    int64_t free_x_233498;
    unsigned char *free_mem_233503;
    double free_a0_233529;
    double *retval_defunc_2_reduce_res_233530;
};
struct futhark_mc_segred_stage_1_parloop_struct_236454 {
    struct futhark_context *ctx;
    int64_t free_x_214789;
    unsigned char *free_mem_220101;
    int64_t free_x_233498;
    unsigned char *free_mem_233503;
    double free_a0_233529;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233695;
};
static int futhark_mc_segred_stage_1_parloop_236455(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233671,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236454
    *futhark_mc_segred_stage_1_parloop_struct_236454 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236454 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236454->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236455_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236455_start = get_wall_time();
    
    int64_t x_214789 =
            futhark_mc_segred_stage_1_parloop_struct_236454->free_x_214789;
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236454->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t x_233498 =
            futhark_mc_segred_stage_1_parloop_struct_236454->free_x_233498;
    struct memblock mem_233503 = {.desc ="mem_233503", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236454->free_mem_233503,
                                  .size =0, .references =NULL};
    double a0_233529 =
           futhark_mc_segred_stage_1_parloop_struct_236454->free_a0_233529;
    struct memblock reduce_stage_1_tid_res_arr_mem_233695 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233695",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236454->free_reduce_stage_1_tid_res_arr_mem_233695,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233697 = start;
    double x_233673;
    double x_233674;
    double local_acc_233698 = 0.0;
    
    for (; iter_233697 < end; iter_233697++) {
        int64_t gtid_233672 = iter_233697;
        double x_233676;
        
        x_233676 = ((double *) mem_233503.mem)[gtid_233672];
        
        bool cond_233677 = sle64(x_214789, gtid_233672);
        double defunc_0_f_res_233678;
        
        if (cond_233677) {
            defunc_0_f_res_233678 = 0.0;
        } else {
            int64_t i_233679 = add64(x_233498, gtid_233672);
            double defunc_0_add_arg_233680;
            
            defunc_0_add_arg_233680 = ((double *) mem_220101.mem)[i_233679];
            defunc_0_f_res_233678 = defunc_0_add_arg_233680;
        }
        
        double x_233681 = a0_233529 * x_233676;
        double defunc_9_fit_fun_res_233682 = defunc_0_f_res_233678 * x_233681;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_233673 = local_acc_233698;
        }
        // Load next params
        {
            x_233674 = defunc_9_fit_fun_res_233682;
        }
        // Red body
        {
            double defunc_1_op_res_233675 = x_233673 + x_233674;
            
            local_acc_233698 = defunc_1_op_res_233675;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233695.mem)[flat_tid_233671] =
        local_acc_233698;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236455_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236455_end -
                 futhark_mc_segred_stage_1_parloop_236455_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236455_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236455_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236455_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236452(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233671 = tid;
    int num_tasks_233694 = info.nsubtasks;
    struct futhark_mc_task_236451 *futhark_mc_task_236451 =
                                  (struct futhark_mc_task_236451 *) args;
    struct futhark_context *ctx = futhark_mc_task_236451->ctx;
    uint64_t futhark_mc_segred_task_236452_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236452_start = get_wall_time();
    
    int64_t x_214789 = futhark_mc_task_236451->free_x_214789;
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_task_236451->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t x_233498 = futhark_mc_task_236451->free_x_233498;
    struct memblock mem_233503 = {.desc ="mem_233503", .mem =
                                  futhark_mc_task_236451->free_mem_233503,
                                  .size =0, .references =NULL};
    double a0_233529 = futhark_mc_task_236451->free_a0_233529;
    double defunc_2_reduce_res_233530 =
           *futhark_mc_task_236451->retval_defunc_2_reduce_res_233530;
    size_t reduce_stage_1_tid_res_arr_mem_233695_cached_sizze_236453 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233695 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233695_cached_sizze_236453 <
        (size_t) ((int64_t) 8 * num_tasks_233694)) {
        reduce_stage_1_tid_res_arr_mem_233695 =
            realloc(reduce_stage_1_tid_res_arr_mem_233695, (int64_t) 8 *
                    num_tasks_233694);
        reduce_stage_1_tid_res_arr_mem_233695_cached_sizze_236453 =
            (int64_t) 8 * num_tasks_233694;
    }
    
    int64_t iter_233697;
    struct futhark_mc_segred_stage_1_parloop_struct_236454
    futhark_mc_segred_stage_1_parloop_struct_236454;
    
    futhark_mc_segred_stage_1_parloop_struct_236454.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236454.free_x_214789 = x_214789;
    futhark_mc_segred_stage_1_parloop_struct_236454.free_mem_220101 =
        mem_220101.mem;
    futhark_mc_segred_stage_1_parloop_struct_236454.free_x_233498 = x_233498;
    futhark_mc_segred_stage_1_parloop_struct_236454.free_mem_233503 =
        mem_233503.mem;
    futhark_mc_segred_stage_1_parloop_struct_236454.free_a0_233529 = a0_233529;
    futhark_mc_segred_stage_1_parloop_struct_236454.free_reduce_stage_1_tid_res_arr_mem_233695 =
        reduce_stage_1_tid_res_arr_mem_233695;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236455_task;
    
    futhark_mc_segred_stage_1_parloop_236455_task.name =
        "futhark_mc_segred_stage_1_parloop_236455";
    futhark_mc_segred_stage_1_parloop_236455_task.fn =
        futhark_mc_segred_stage_1_parloop_236455;
    futhark_mc_segred_stage_1_parloop_236455_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236454;
    futhark_mc_segred_stage_1_parloop_236455_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236455_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236455_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236455_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236455_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236455_task);
    
    if (futhark_mc_segred_stage_1_parloop_236455_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236455_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236455_total_end -
                 futhark_mc_segred_stage_1_parloop_236455_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236455_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236455_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236455_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233530 = 0.0;
    }
    
    double x_233699;
    double x_233700;
    
    for (int32_t i_233702 = 0; i_233702 < num_tasks_233694; i_233702++) {
        flat_tid_233671 = i_233702;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233699 = defunc_2_reduce_res_233530;
            }
            // load next params
            {
                x_233700 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233695)[flat_tid_233671];
            }
            // red body
            {
                double defunc_1_op_res_233701 = x_233699 + x_233700;
                
                defunc_2_reduce_res_233530 = defunc_1_op_res_233701;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233695);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236452_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236452_end -
                 futhark_mc_segred_task_236452_start;
        
        ctx->futhark_mc_segred_task_236452_runs[tid]++;
        ctx->futhark_mc_segred_task_236452_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236452_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236451->retval_defunc_2_reduce_res_233530 =
            defunc_2_reduce_res_233530;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236444(void *args, int64_t start,
                                            int64_t end, int flat_tid_233496,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236443
    *futhark_mc_segmap_parloop_struct_236443 =
    (struct futhark_mc_segmap_parloop_struct_236443 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236443->ctx;
    uint64_t futhark_mc_segmap_parloop_236444_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236444_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236443->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236443->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236443->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236443->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236443->free_i_203670;
    int64_t gtid_214784 =
            futhark_mc_segmap_parloop_struct_236443->free_gtid_214784;
    int64_t x_214789 = futhark_mc_segmap_parloop_struct_236443->free_x_214789;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236443->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236443->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236443->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_segmap_parloop_struct_236443->free_mem_220098,
                                  .size =0, .references =NULL};
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_segmap_parloop_struct_236443->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 =
            futhark_mc_segmap_parloop_struct_236443->free_bytes_220103;
    struct memblock mem_220122 = {.desc ="mem_220122", .mem =
                                  futhark_mc_segmap_parloop_struct_236443->free_mem_220122,
                                  .size =0, .references =NULL};
    size_t mem_233503_cached_sizze_236445 = 0;
    unsigned char *mem_233503 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233647 = start;
    
    if (mem_233503_cached_sizze_236445 < (size_t) bytes_220103) {
        mem_233503 = realloc(mem_233503, bytes_220103);
        mem_233503_cached_sizze_236445 = bytes_220103;
    }
    for (; iter_233647 < end; iter_233647++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233683 = t_n_m_203650;
        int64_t gtid_233497 = iter_233647;
        int64_t remnant_233684 = iter_233647 - gtid_233497;
        int64_t x_233498;
        
        x_233498 = ((int64_t *) mem_217835.mem)[gtid_214784 * t_n_m_203650 +
                                                gtid_233497];
        
        double x_233499;
        
        x_233499 = ((double *) mem_217839.mem)[gtid_214784 * t_n_m_203650 +
                                               gtid_233497];
        
        int64_t min_arg_233500 = mul64(jump_t_203500, gtid_233497);
        int64_t min_res_233501 = smin64(i_203670, min_arg_233500);
        int64_t defunc_0_g_res_233502 = add64((int64_t) 1, min_res_233501);
        double defunc_2_reduce_res_233504;
        int64_t flat_tid_233648 = (int64_t) 0;
        int32_t num_tasks_233685;
        
        defunc_2_reduce_res_233504 = 0.0;
        
        struct futhark_mc_task_236446 futhark_mc_task_236446;
        
        futhark_mc_task_236446.ctx = ctx;
        futhark_mc_task_236446.free_n_203490 = n_203490;
        futhark_mc_task_236446.free_gtid_214784 = gtid_214784;
        futhark_mc_task_236446.free_x_214789 = x_214789;
        futhark_mc_task_236446.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236446.free_mem_220098 = mem_220098.mem;
        futhark_mc_task_236446.free_x_233498 = x_233498;
        futhark_mc_task_236446.free_x_233499 = x_233499;
        futhark_mc_task_236446.free_defunc_0_g_res_233502 =
            defunc_0_g_res_233502;
        futhark_mc_task_236446.retval_defunc_2_reduce_res_233504 =
            &defunc_2_reduce_res_233504;
        futhark_mc_task_236446.retval_mem_233503 = mem_233503;
        
        struct scheduler_segop futhark_mc_task_236446_task;
        
        futhark_mc_task_236446_task.args = &futhark_mc_task_236446;
        futhark_mc_task_236446_task.top_level_fn =
            futhark_mc_segred_task_236447;
        futhark_mc_task_236446_task.name = "futhark_mc_segred_task_236447";
        futhark_mc_task_236446_task.iterations = q_t_203494;
        futhark_mc_task_236446_task.task_time =
            &ctx->futhark_mc_segred_task_236447_total_time;
        futhark_mc_task_236446_task.task_iter =
            &ctx->futhark_mc_segred_task_236447_total_iter;
        futhark_mc_task_236446_task.sched = STATIC;
        futhark_mc_task_236446_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236447_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236446_task);
        
        if (futhark_mc_segred_task_236447_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_233529 = 1.0 / defunc_2_reduce_res_233504;
        double defunc_2_reduce_res_233530;
        int64_t flat_tid_233671 = (int64_t) 0;
        int32_t num_tasks_233694;
        
        defunc_2_reduce_res_233530 = 0.0;
        
        struct futhark_mc_task_236451 futhark_mc_task_236451;
        
        futhark_mc_task_236451.ctx = ctx;
        futhark_mc_task_236451.free_x_214789 = x_214789;
        futhark_mc_task_236451.free_mem_220101 = mem_220101.mem;
        futhark_mc_task_236451.free_x_233498 = x_233498;
        futhark_mc_task_236451.free_mem_233503 = mem_233503;
        futhark_mc_task_236451.free_a0_233529 = a0_233529;
        futhark_mc_task_236451.retval_defunc_2_reduce_res_233530 =
            &defunc_2_reduce_res_233530;
        
        struct scheduler_segop futhark_mc_task_236451_task;
        
        futhark_mc_task_236451_task.args = &futhark_mc_task_236451;
        futhark_mc_task_236451_task.top_level_fn =
            futhark_mc_segred_task_236452;
        futhark_mc_task_236451_task.name = "futhark_mc_segred_task_236452";
        futhark_mc_task_236451_task.iterations = q_t_203494;
        futhark_mc_task_236451_task.task_time =
            &ctx->futhark_mc_segred_task_236452_total_time;
        futhark_mc_task_236451_task.task_iter =
            &ctx->futhark_mc_segred_task_236452_total_iter;
        futhark_mc_task_236451_task.sched = STATIC;
        futhark_mc_task_236451_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236452_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236451_task);
        
        if (futhark_mc_segred_task_236452_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220122.mem)[gtid_233497] = defunc_2_reduce_res_233530;
    }
    
  cleanup:
    { }
    free(mem_233503);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236444_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236444_end -
                 futhark_mc_segmap_parloop_236444_start;
        
        ctx->futhark_mc_segmap_parloop_236444_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236444_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236444_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236442(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233496 = tid;
    int num_tasks_233607 = info.nsubtasks;
    struct futhark_mc_task_236437 *futhark_mc_task_236437 =
                                  (struct futhark_mc_task_236437 *) args;
    struct futhark_context *ctx = futhark_mc_task_236437->ctx;
    uint64_t futhark_mc_segmap_nested_task_236442_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236442_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236437->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236437->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236437->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236437->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236437->free_i_203670;
    int64_t gtid_214784 = futhark_mc_task_236437->free_gtid_214784;
    int64_t x_214789 = futhark_mc_task_236437->free_x_214789;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236437->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236437->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236437->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220098 = {.desc ="mem_220098", .mem =
                                  futhark_mc_task_236437->free_mem_220098,
                                  .size =0, .references =NULL};
    struct memblock mem_220101 = {.desc ="mem_220101", .mem =
                                  futhark_mc_task_236437->free_mem_220101,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 = futhark_mc_task_236437->free_bytes_220103;
    struct memblock mem_220122 = {.desc ="mem_220122", .mem =
                                  futhark_mc_task_236437->free_mem_220122,
                                  .size =0, .references =NULL};
    int64_t iter_233647;
    struct futhark_mc_segmap_parloop_struct_236443
    futhark_mc_segmap_parloop_struct_236443;
    
    futhark_mc_segmap_parloop_struct_236443.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236443.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236443.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236443.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236443.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236443.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236443.free_gtid_214784 = gtid_214784;
    futhark_mc_segmap_parloop_struct_236443.free_x_214789 = x_214789;
    futhark_mc_segmap_parloop_struct_236443.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236443.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236443.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236443.free_mem_220098 = mem_220098.mem;
    futhark_mc_segmap_parloop_struct_236443.free_mem_220101 = mem_220101.mem;
    futhark_mc_segmap_parloop_struct_236443.free_bytes_220103 = bytes_220103;
    futhark_mc_segmap_parloop_struct_236443.free_mem_220122 = mem_220122.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236444_task;
    
    futhark_mc_segmap_parloop_236444_task.name =
        "futhark_mc_segmap_parloop_236444";
    futhark_mc_segmap_parloop_236444_task.fn = futhark_mc_segmap_parloop_236444;
    futhark_mc_segmap_parloop_236444_task.args =
        &futhark_mc_segmap_parloop_struct_236443;
    futhark_mc_segmap_parloop_236444_task.iterations = iterations;
    futhark_mc_segmap_parloop_236444_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236444_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236444_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236444_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236444_task);
    
    if (futhark_mc_segmap_parloop_236444_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236444_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236444_total_end -
                 futhark_mc_segmap_parloop_236444_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236444_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236444_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236444_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236442_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236442_end -
                 futhark_mc_segmap_nested_task_236442_start;
        
        ctx->futhark_mc_segmap_nested_task_236442_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236442_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236442_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236424(void *args, int64_t start,
                                            int64_t end, int flat_tid_214783,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236423
    *futhark_mc_segmap_parloop_struct_236423 =
    (struct futhark_mc_segmap_parloop_struct_236423 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236423->ctx;
    uint64_t futhark_mc_segmap_parloop_236424_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236424_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236423->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236423->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236423->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236423->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236423->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236423->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236423->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236423->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236423->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236423->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236423->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236423->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236423->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236423->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236423->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236423->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236423->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236423->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 =
            futhark_mc_segmap_parloop_struct_236423->free_bytes_220103;
    struct memblock mem_220201 = {.desc ="mem_220201", .mem =
                                  futhark_mc_segmap_parloop_struct_236423->free_mem_220201,
                                  .size =0, .references =NULL};
    size_t mem_220095_cached_sizze_236425 = 0;
    unsigned char *mem_220095 = NULL;
    size_t mem_220098_cached_sizze_236426 = 0;
    unsigned char *mem_220098 = NULL;
    size_t mem_220101_cached_sizze_236427 = 0;
    unsigned char *mem_220101 = NULL;
    size_t mem_220122_cached_sizze_236428 = 0;
    unsigned char *mem_220122 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233476 = start;
    
    if (mem_220095_cached_sizze_236425 < (size_t) bytes_217302) {
        mem_220095 = realloc(mem_220095, bytes_217302);
        mem_220095_cached_sizze_236425 = bytes_217302;
    }
    if (mem_220098_cached_sizze_236426 < (size_t) bytes_217302) {
        mem_220098 = realloc(mem_220098, bytes_217302);
        mem_220098_cached_sizze_236426 = bytes_217302;
    }
    if (mem_220101_cached_sizze_236427 < (size_t) bytes_217302) {
        mem_220101 = realloc(mem_220101, bytes_217302);
        mem_220101_cached_sizze_236427 = bytes_217302;
    }
    if (mem_220122_cached_sizze_236428 < (size_t) bytes_217782) {
        mem_220122 = realloc(mem_220122, bytes_217782);
        mem_220122_cached_sizze_236428 = bytes_217782;
    }
    for (; iter_233476 < end; iter_233476++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233589 = partition_sizze_203577;
        int64_t gtid_214784 = iter_233476;
        int64_t remnant_233590 = iter_233476 - gtid_214784;
        int64_t x_214789;
        
        x_214789 = ((int64_t *) mem_217343.mem)[gtid_214784];
        
        int64_t flat_tid_233477 = (int64_t) 0;
        int32_t num_tasks_233591;
        struct futhark_mc_task_236429 futhark_mc_task_236429;
        
        futhark_mc_task_236429.ctx = ctx;
        futhark_mc_task_236429.free_n_203490 = n_203490;
        futhark_mc_task_236429.free_gtid_214784 = gtid_214784;
        futhark_mc_task_236429.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236429.free_mem_219808 = mem_219808.mem;
        futhark_mc_task_236429.free_mem_220095 = mem_220095;
        
        struct scheduler_segop futhark_mc_task_236429_task;
        
        futhark_mc_task_236429_task.args = &futhark_mc_task_236429;
        futhark_mc_task_236429_task.top_level_fn =
            futhark_mc_segmap_task_236430;
        futhark_mc_task_236429_task.name = "futhark_mc_segmap_task_236430";
        futhark_mc_task_236429_task.iterations = n_203490;
        futhark_mc_task_236429_task.task_time =
            &ctx->futhark_mc_segmap_task_236430_total_time;
        futhark_mc_task_236429_task.task_iter =
            &ctx->futhark_mc_segmap_task_236430_total_iter;
        futhark_mc_task_236429_task.sched = STATIC;
        futhark_mc_task_236429_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236430_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236429_task);
        
        if (futhark_mc_segmap_task_236430_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233482 = (int64_t) 0;
        int32_t num_tasks_233595;
        struct futhark_mc_task_236433 futhark_mc_task_236433;
        
        futhark_mc_task_236433.ctx = ctx;
        futhark_mc_task_236433.free_n_203490 = n_203490;
        futhark_mc_task_236433.free_gtid_214784 = gtid_214784;
        futhark_mc_task_236433.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236433.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236433.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236433.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236433.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236433.free_mem_220095 = mem_220095;
        futhark_mc_task_236433.free_mem_220098 = mem_220098;
        futhark_mc_task_236433.free_mem_220101 = mem_220101;
        
        struct scheduler_segop futhark_mc_task_236433_task;
        
        futhark_mc_task_236433_task.args = &futhark_mc_task_236433;
        futhark_mc_task_236433_task.top_level_fn =
            futhark_mc_segmap_task_236434;
        futhark_mc_task_236433_task.name = "futhark_mc_segmap_task_236434";
        futhark_mc_task_236433_task.iterations = n_203490;
        futhark_mc_task_236433_task.task_time =
            &ctx->futhark_mc_segmap_task_236434_total_time;
        futhark_mc_task_236433_task.task_iter =
            &ctx->futhark_mc_segmap_task_236434_total_iter;
        futhark_mc_task_236433_task.sched = STATIC;
        futhark_mc_task_236433_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236434_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236433_task);
        
        if (futhark_mc_segmap_task_236434_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233543 = (int64_t) 0;
        int32_t num_tasks_233607;
        int64_t flat_tid_233496 = (int64_t) 0;
        struct futhark_mc_task_236437 futhark_mc_task_236437;
        
        futhark_mc_task_236437.ctx = ctx;
        futhark_mc_task_236437.free_n_203490 = n_203490;
        futhark_mc_task_236437.free_q_t_203494 = q_t_203494;
        futhark_mc_task_236437.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236437.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_236437.free_i_203670 = i_203670;
        futhark_mc_task_236437.free_gtid_214784 = gtid_214784;
        futhark_mc_task_236437.free_x_214789 = x_214789;
        futhark_mc_task_236437.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236437.free_mem_217835 = mem_217835.mem;
        futhark_mc_task_236437.free_mem_217839 = mem_217839.mem;
        futhark_mc_task_236437.free_mem_220098 = mem_220098;
        futhark_mc_task_236437.free_mem_220101 = mem_220101;
        futhark_mc_task_236437.free_bytes_220103 = bytes_220103;
        futhark_mc_task_236437.free_mem_220122 = mem_220122;
        
        struct scheduler_segop futhark_mc_task_236437_task;
        
        futhark_mc_task_236437_task.args = &futhark_mc_task_236437;
        futhark_mc_task_236437_task.top_level_fn =
            futhark_mc_segmap_task_236438;
        futhark_mc_task_236437_task.name = "futhark_mc_segmap_task_236438";
        futhark_mc_task_236437_task.iterations = t_n_m_203650;
        futhark_mc_task_236437_task.task_time =
            &ctx->futhark_mc_segmap_task_236438_total_time;
        futhark_mc_task_236437_task.task_iter =
            &ctx->futhark_mc_segmap_task_236438_total_iter;
        futhark_mc_task_236437_task.sched = STATIC;
        futhark_mc_task_236437_task.nested_fn =
            futhark_mc_segmap_nested_task_236442;
        
        int futhark_mc_segmap_task_236438_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236437_task);
        
        if (futhark_mc_segmap_task_236438_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220201.mem + gtid_214784 * t_n_m_203650 * (int64_t) 8,
                    mem_220122 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220095);
    free(mem_220098);
    free(mem_220101);
    free(mem_220122);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236424_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236424_end -
                 futhark_mc_segmap_parloop_236424_start;
        
        ctx->futhark_mc_segmap_parloop_236424_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236424_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236424_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236422(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214783 = tid;
    int num_tasks_233396 = info.nsubtasks;
    struct futhark_mc_task_236413 *futhark_mc_task_236413 =
                                  (struct futhark_mc_task_236413 *) args;
    struct futhark_context *ctx = futhark_mc_task_236413->ctx;
    uint64_t futhark_mc_segmap_nested_task_236422_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236422_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236413->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236413->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236413->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236413->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236413->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236413->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236413->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236413->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236413->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236413->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236413->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236413->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236413->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236413->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236413->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236413->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236413->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236413->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220103 = futhark_mc_task_236413->free_bytes_220103;
    struct memblock mem_220201 = {.desc ="mem_220201", .mem =
                                  futhark_mc_task_236413->free_mem_220201,
                                  .size =0, .references =NULL};
    int64_t iter_233476;
    struct futhark_mc_segmap_parloop_struct_236423
    futhark_mc_segmap_parloop_struct_236423;
    
    futhark_mc_segmap_parloop_struct_236423.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236423.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236423.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236423.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236423.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236423.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236423.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236423.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236423.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236423.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236423.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236423.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236423.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236423.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236423.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236423.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236423.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236423.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236423.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236423.free_bytes_220103 = bytes_220103;
    futhark_mc_segmap_parloop_struct_236423.free_mem_220201 = mem_220201.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236424_task;
    
    futhark_mc_segmap_parloop_236424_task.name =
        "futhark_mc_segmap_parloop_236424";
    futhark_mc_segmap_parloop_236424_task.fn = futhark_mc_segmap_parloop_236424;
    futhark_mc_segmap_parloop_236424_task.args =
        &futhark_mc_segmap_parloop_struct_236423;
    futhark_mc_segmap_parloop_236424_task.iterations = iterations;
    futhark_mc_segmap_parloop_236424_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236424_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236424_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236424_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236424_task);
    
    if (futhark_mc_segmap_parloop_236424_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236424_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236424_total_end -
                 futhark_mc_segmap_parloop_236424_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236424_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236424_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236424_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236422_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236422_end -
                 futhark_mc_segmap_nested_task_236422_start;
        
        ctx->futhark_mc_segmap_nested_task_236422_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236422_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236422_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236456 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220212;
    unsigned char *free_mem_220361;
    unsigned char *free_mem_220365;
};
struct futhark_mc_segmap_parloop_struct_236458 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220212;
    unsigned char *free_mem_220361;
    unsigned char *free_mem_220365;
};
static int futhark_mc_segmap_parloop_236459(void *args, int64_t start,
                                            int64_t end, int flat_tid_214909,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236458
    *futhark_mc_segmap_parloop_struct_236458 =
    (struct futhark_mc_segmap_parloop_struct_236458 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236458->ctx;
    uint64_t futhark_mc_segmap_parloop_236459_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236459_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236458->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236458->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236458->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236458->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236458->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236458->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236458->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236458->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236458->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236458->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236458->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236458->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 =
            futhark_mc_segmap_parloop_struct_236458->free_bytes_220212;
    struct memblock mem_220361 = {.desc ="mem_220361", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_220361,
                                  .size =0, .references =NULL};
    struct memblock mem_220365 = {.desc ="mem_220365", .mem =
                                  futhark_mc_segmap_parloop_struct_236458->free_mem_220365,
                                  .size =0, .references =NULL};
    size_t mem_220255_cached_sizze_236460 = 0;
    unsigned char *mem_220255 = NULL;
    size_t mem_220270_cached_sizze_236461 = 0;
    unsigned char *mem_220270 = NULL;
    size_t mem_220273_cached_sizze_236462 = 0;
    unsigned char *mem_220273 = NULL;
    size_t mem_220300_cached_sizze_236463 = 0;
    unsigned char *mem_220300 = NULL;
    size_t mem_220303_cached_sizze_236464 = 0;
    unsigned char *mem_220303 = NULL;
    size_t mem_220320_cached_sizze_236465 = 0;
    unsigned char *mem_220320 = NULL;
    size_t mem_220323_cached_sizze_236466 = 0;
    unsigned char *mem_220323 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233704 = start;
    
    if (mem_220255_cached_sizze_236460 < (size_t) bytes_217302) {
        mem_220255 = realloc(mem_220255, bytes_217302);
        mem_220255_cached_sizze_236460 = bytes_217302;
    }
    if (mem_220270_cached_sizze_236461 < (size_t) bytes_217302) {
        mem_220270 = realloc(mem_220270, bytes_217302);
        mem_220270_cached_sizze_236461 = bytes_217302;
    }
    if (mem_220273_cached_sizze_236462 < (size_t) bytes_217302) {
        mem_220273 = realloc(mem_220273, bytes_217302);
        mem_220273_cached_sizze_236462 = bytes_217302;
    }
    if (mem_220300_cached_sizze_236463 < (size_t) bytes_217782) {
        mem_220300 = realloc(mem_220300, bytes_217782);
        mem_220300_cached_sizze_236463 = bytes_217782;
    }
    if (mem_220303_cached_sizze_236464 < (size_t) bytes_217782) {
        mem_220303 = realloc(mem_220303, bytes_217782);
        mem_220303_cached_sizze_236464 = bytes_217782;
    }
    if (mem_220320_cached_sizze_236465 < (size_t) bytes_220212) {
        mem_220320 = realloc(mem_220320, bytes_220212);
        mem_220320_cached_sizze_236465 = bytes_220212;
    }
    if (mem_220323_cached_sizze_236466 < (size_t) bytes_220212) {
        mem_220323 = realloc(mem_220323, bytes_220212);
        mem_220323_cached_sizze_236466 = bytes_220212;
    }
    for (; iter_233704 < end; iter_233704++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233805 = partition_sizze_203577;
        int64_t gtid_214910 = iter_233704;
        int64_t remnant_233806 = iter_233704 - gtid_214910;
        int64_t x_206301;
        
        x_206301 = ((int64_t *) mem_217343.mem)[gtid_214910];
        for (int64_t i_233705 = 0; i_233705 < n_203490; i_233705++) {
            double x_233707;
            
            x_233707 = ((double *) mem_217297.mem)[gtid_214910 * n_203490 +
                                                   i_233705];
            
            double x_233708;
            
            x_233708 = ((double *) mem_219808.mem)[gtid_214910 * n_203490 +
                                                   i_233705];
            
            double defunc_1_f_res_233709 = x_233707 - x_233708;
            
            ((double *) mem_220255)[i_233705] = defunc_1_f_res_233709;
        }
        for (int64_t i_233711 = 0; i_233711 < n_203490; i_233711++) {
            int64_t x_233714;
            
            x_233714 = ((int64_t *) mem_217340.mem)[gtid_214910 * n_203490 +
                                                    i_233711];
            
            bool cond_233715 = sle64((int64_t) 0, x_233714);
            double defunc_0_f_res_233716;
            
            if (cond_233715) {
                bool y_233717 = slt64(x_233714, n_203490);
                bool bounds_check_233718 = cond_233715 && y_233717;
                bool index_certs_233719;
                
                if (!bounds_check_233718) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233714,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_233720;
                
                defunc_0_f_res_t_res_233720 = ((double *) mem_220255)[x_233714];
                defunc_0_f_res_233716 = defunc_0_f_res_t_res_233720;
            } else {
                defunc_0_f_res_233716 = 0.0;
            }
            
            double defunc_0_f_res_233721;
            
            if (cond_233715) {
                bool y_233722 = slt64(x_233714, n_203490);
                bool bounds_check_233723 = cond_233715 && y_233722;
                bool index_certs_233724;
                
                if (!bounds_check_233723) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233714,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_233725;
                
                defunc_0_f_res_t_res_233725 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_214910 *
                                                       ctx_param_ext_217867 +
                                                       x_233714 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_233721 = defunc_0_f_res_t_res_233725;
            } else {
                defunc_0_f_res_233721 = 0.0;
            }
            ((double *) mem_220270)[i_233711] = defunc_0_f_res_233721;
            ((double *) mem_220273)[i_233711] = defunc_0_f_res_233716;
        }
        for (int64_t i_233728 = 0; i_233728 < t_n_m_203650; i_233728++) {
            int64_t x_233731;
            
            x_233731 = ((int64_t *) mem_217835.mem)[gtid_214910 * t_n_m_203650 +
                                                    i_233728];
            
            double x_233732;
            
            x_233732 = ((double *) mem_217839.mem)[gtid_214910 * t_n_m_203650 +
                                                   i_233728];
            
            int64_t min_arg_233733 = mul64(jump_t_203500, i_233728);
            int64_t min_res_233734 = smin64(i_203670, min_arg_233733);
            int64_t defunc_0_g_res_233735 = add64((int64_t) 1, min_res_233734);
            double defunc_2_reduce_res_233738;
            double defunc_2_reduce_res_233739;
            double defunc_2_reduce_res_233740;
            double redout_233744;
            double redout_233745;
            double redout_233746;
            
            redout_233744 = 0.0;
            redout_233745 = 0.0;
            redout_233746 = 0.0;
            for (int64_t i_233743 = 0; i_233743 < q_t_203494; i_233743++) {
                bool cond_233749 = sle64(x_206301, i_233743);
                int64_t defunc_0_f_res_233750;
                
                if (cond_233749) {
                    defunc_0_f_res_233750 = (int64_t) 0;
                } else {
                    int64_t i_233751 = add64(x_233731, i_233743);
                    int64_t defunc_0_add_arg_233752;
                    
                    defunc_0_add_arg_233752 =
                        ((int64_t *) mem_217340.mem)[gtid_214910 * n_203490 +
                                                     i_233751];
                    
                    int64_t defunc_1_add_res_233753 = add64((int64_t) 1,
                                                            defunc_0_add_arg_233752);
                    
                    defunc_0_f_res_233750 = defunc_1_add_res_233753;
                }
                
                double defunc_0_f_res_233754;
                
                if (cond_233749) {
                    defunc_0_f_res_233754 = 0.0;
                } else {
                    int64_t i_233755 = add64(x_233731, i_233743);
                    double defunc_0_add_arg_233756;
                    
                    defunc_0_add_arg_233756 = ((double *) mem_220270)[i_233755];
                    defunc_0_f_res_233754 = defunc_0_add_arg_233756;
                }
                
                int64_t binop_p_233757 = sub64(defunc_0_f_res_233750,
                                               defunc_0_g_res_233735);
                double defunc_0_f_res_233758 = sitofp_i64_f64(binop_p_233757);
                double abs_res_233759 = fabs(defunc_0_f_res_233758);
                double tmp1_233760 = abs_res_233759 / x_233732;
                double x_233761 = tmp1_233760 * tmp1_233760;
                double y_233762 = tmp1_233760 * x_233761;
                double tmp2_233763 = 1.0 - y_233762;
                double x_233764 = tmp2_233763 * tmp2_233763;
                double tmp3_233765 = tmp2_233763 * x_233764;
                double tmp4_233766 = defunc_0_f_res_233754 * tmp3_233765;
                double defunc_1_f_res_233767 = defunc_0_f_res_233758 *
                       tmp4_233766;
                double defunc_1_f_res_233768 = defunc_0_f_res_233758 *
                       defunc_1_f_res_233767;
                double defunc_1_op_res_233769 = tmp4_233766 + redout_233744;
                double defunc_1_op_res_233770 = defunc_1_f_res_233767 +
                       redout_233745;
                double defunc_1_op_res_233771 = defunc_1_f_res_233768 +
                       redout_233746;
                
                ((double *) mem_220320)[i_233743] = defunc_1_f_res_233767;
                ((double *) mem_220323)[i_233743] = tmp4_233766;
                
                double redout_tmp_233812 = defunc_1_op_res_233769;
                double redout_tmp_233813 = defunc_1_op_res_233770;
                double redout_tmp_233814 = defunc_1_op_res_233771;
                
                redout_233744 = redout_tmp_233812;
                redout_233745 = redout_tmp_233813;
                redout_233746 = redout_tmp_233814;
            }
            defunc_2_reduce_res_233738 = redout_233744;
            defunc_2_reduce_res_233739 = redout_233745;
            defunc_2_reduce_res_233740 = redout_233746;
            
            double x_233774 = defunc_2_reduce_res_233738 *
                   defunc_2_reduce_res_233740;
            double y_233775 = defunc_2_reduce_res_233739 *
                   defunc_2_reduce_res_233739;
            double y_233776 = x_233774 - y_233775;
            double det1_233777 = 1.0 / y_233776;
            double a11_233778 = defunc_2_reduce_res_233740 * det1_233777;
            double x_233779 = 0.0 - defunc_2_reduce_res_233739;
            double b11_233780 = det1_233777 * x_233779;
            double c11_233781 = defunc_2_reduce_res_233738 * det1_233777;
            double defunc_2_reduce_res_233782;
            double defunc_2_reduce_res_233783;
            double redout_233785;
            double redout_233786;
            
            redout_233785 = 0.0;
            redout_233786 = 0.0;
            for (int64_t i_233784 = 0; i_233784 < q_t_203494; i_233784++) {
                double x_233787;
                
                x_233787 = ((double *) mem_220323)[i_233784];
                
                double x_233788;
                
                x_233788 = ((double *) mem_220320)[i_233784];
                
                bool cond_233789 = sle64(x_206301, i_233784);
                double defunc_0_f_res_233790;
                
                if (cond_233789) {
                    defunc_0_f_res_233790 = 0.0;
                } else {
                    int64_t i_233791 = add64(x_233731, i_233784);
                    double defunc_0_add_arg_233792;
                    
                    defunc_0_add_arg_233792 = ((double *) mem_220273)[i_233791];
                    defunc_0_f_res_233790 = defunc_0_add_arg_233792;
                }
                
                double x_233793 = a11_233778 * x_233787;
                double y_233794 = b11_233780 * x_233788;
                double x_233795 = x_233793 + y_233794;
                double defunc_9_fit_fun_res_233796 = defunc_0_f_res_233790 *
                       x_233795;
                double x_233797 = b11_233780 * x_233787;
                double y_233798 = c11_233781 * x_233788;
                double x_233799 = x_233797 + y_233798;
                double defunc_9_slope_fun_res_233800 = defunc_0_f_res_233790 *
                       x_233799;
                double defunc_1_op_res_233801 = defunc_9_fit_fun_res_233796 +
                       redout_233785;
                double defunc_1_op_res_233802 = defunc_9_slope_fun_res_233800 +
                       redout_233786;
                double redout_tmp_233817 = defunc_1_op_res_233801;
                double redout_tmp_233818 = defunc_1_op_res_233802;
                
                redout_233785 = redout_tmp_233817;
                redout_233786 = redout_tmp_233818;
            }
            defunc_2_reduce_res_233782 = redout_233785;
            defunc_2_reduce_res_233783 = redout_233786;
            ((double *) mem_220300)[i_233728] = defunc_2_reduce_res_233782;
            ((double *) mem_220303)[i_233728] = defunc_2_reduce_res_233783;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220361.mem + gtid_214910 * t_n_m_203650 * (int64_t) 8,
                    mem_220300 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220365.mem + gtid_214910 * t_n_m_203650 * (int64_t) 8,
                    mem_220303 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220255);
    free(mem_220270);
    free(mem_220273);
    free(mem_220300);
    free(mem_220303);
    free(mem_220320);
    free(mem_220323);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236459_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236459_end -
                 futhark_mc_segmap_parloop_236459_start;
        
        ctx->futhark_mc_segmap_parloop_236459_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236459_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236459_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236457(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214909 = tid;
    int num_tasks_233703 = info.nsubtasks;
    struct futhark_mc_task_236456 *futhark_mc_task_236456 =
                                  (struct futhark_mc_task_236456 *) args;
    struct futhark_context *ctx = futhark_mc_task_236456->ctx;
    uint64_t futhark_mc_segmap_task_236457_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236457_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236456->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236456->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236456->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236456->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236456->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236456->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236456->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236456->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236456->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236456->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236456->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236456->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236456->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236456->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236456->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236456->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236456->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236456->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 = futhark_mc_task_236456->free_bytes_220212;
    struct memblock mem_220361 = {.desc ="mem_220361", .mem =
                                  futhark_mc_task_236456->free_mem_220361,
                                  .size =0, .references =NULL};
    struct memblock mem_220365 = {.desc ="mem_220365", .mem =
                                  futhark_mc_task_236456->free_mem_220365,
                                  .size =0, .references =NULL};
    int64_t iter_233704;
    struct futhark_mc_segmap_parloop_struct_236458
    futhark_mc_segmap_parloop_struct_236458;
    
    futhark_mc_segmap_parloop_struct_236458.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236458.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236458.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236458.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236458.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236458.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236458.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236458.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236458.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236458.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236458.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236458.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236458.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236458.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236458.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236458.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236458.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236458.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236458.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236458.free_bytes_220212 = bytes_220212;
    futhark_mc_segmap_parloop_struct_236458.free_mem_220361 = mem_220361.mem;
    futhark_mc_segmap_parloop_struct_236458.free_mem_220365 = mem_220365.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236459_task;
    
    futhark_mc_segmap_parloop_236459_task.name =
        "futhark_mc_segmap_parloop_236459";
    futhark_mc_segmap_parloop_236459_task.fn = futhark_mc_segmap_parloop_236459;
    futhark_mc_segmap_parloop_236459_task.args =
        &futhark_mc_segmap_parloop_struct_236458;
    futhark_mc_segmap_parloop_236459_task.iterations = iterations;
    futhark_mc_segmap_parloop_236459_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236459_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236459_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236459_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236459_task);
    
    if (futhark_mc_segmap_parloop_236459_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236459_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236459_total_end -
                 futhark_mc_segmap_parloop_236459_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236459_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236459_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236459_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236457_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236457_end -
                 futhark_mc_segmap_task_236457_start;
        
        ctx->futhark_mc_segmap_task_236457_runs[tid]++;
        ctx->futhark_mc_segmap_task_236457_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236457_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236468 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220212;
    unsigned char *free_mem_220361;
    unsigned char *free_mem_220365;
};
struct futhark_mc_task_236475 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215004;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220204;
};
struct futhark_mc_segmap_parloop_struct_236477 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215004;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220204;
};
static int futhark_mc_segmap_parloop_236478(void *args, int64_t start,
                                            int64_t end, int flat_tid_233820,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236477
    *futhark_mc_segmap_parloop_struct_236477 =
    (struct futhark_mc_segmap_parloop_struct_236477 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236477->ctx;
    uint64_t futhark_mc_segmap_parloop_236478_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236478_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236477->free_n_203490;
    int64_t gtid_215004 =
            futhark_mc_segmap_parloop_struct_236477->free_gtid_215004;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236477->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236477->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220204 = {.desc ="mem_220204", .mem =
                                  futhark_mc_segmap_parloop_struct_236477->free_mem_220204,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233995 = start;
    
    for (; iter_233995 < end; iter_233995++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233996 = n_203490;
        int64_t gtid_233821 = iter_233995;
        int64_t remnant_233997 = iter_233995 - gtid_233821;
        double x_233822;
        
        x_233822 = ((double *) mem_217297.mem)[gtid_215004 * n_203490 +
                                               gtid_233821];
        
        double x_233823;
        
        x_233823 = ((double *) mem_219808.mem)[gtid_215004 * n_203490 +
                                               gtid_233821];
        
        double defunc_1_f_res_233824 = x_233822 - x_233823;
        
        ((double *) mem_220204.mem)[gtid_233821] = defunc_1_f_res_233824;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236478_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236478_end -
                 futhark_mc_segmap_parloop_236478_start;
        
        ctx->futhark_mc_segmap_parloop_236478_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236478_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236478_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236476(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233820 = tid;
    int num_tasks_233994 = info.nsubtasks;
    struct futhark_mc_task_236475 *futhark_mc_task_236475 =
                                  (struct futhark_mc_task_236475 *) args;
    struct futhark_context *ctx = futhark_mc_task_236475->ctx;
    uint64_t futhark_mc_segmap_task_236476_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236476_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236475->free_n_203490;
    int64_t gtid_215004 = futhark_mc_task_236475->free_gtid_215004;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236475->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236475->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220204 = {.desc ="mem_220204", .mem =
                                  futhark_mc_task_236475->free_mem_220204,
                                  .size =0, .references =NULL};
    int64_t iter_233995;
    struct futhark_mc_segmap_parloop_struct_236477
    futhark_mc_segmap_parloop_struct_236477;
    
    futhark_mc_segmap_parloop_struct_236477.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236477.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236477.free_gtid_215004 = gtid_215004;
    futhark_mc_segmap_parloop_struct_236477.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236477.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236477.free_mem_220204 = mem_220204.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236478_task;
    
    futhark_mc_segmap_parloop_236478_task.name =
        "futhark_mc_segmap_parloop_236478";
    futhark_mc_segmap_parloop_236478_task.fn = futhark_mc_segmap_parloop_236478;
    futhark_mc_segmap_parloop_236478_task.args =
        &futhark_mc_segmap_parloop_struct_236477;
    futhark_mc_segmap_parloop_236478_task.iterations = iterations;
    futhark_mc_segmap_parloop_236478_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236478_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236478_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236478_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236478_task);
    
    if (futhark_mc_segmap_parloop_236478_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236478_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236478_total_end -
                 futhark_mc_segmap_parloop_236478_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236478_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236478_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236478_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236476_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236476_end -
                 futhark_mc_segmap_task_236476_start;
        
        ctx->futhark_mc_segmap_task_236476_runs[tid]++;
        ctx->futhark_mc_segmap_task_236476_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236476_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236479 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215004;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_220204;
    unsigned char *free_mem_220207;
    unsigned char *free_mem_220210;
};
struct futhark_mc_segmap_parloop_struct_236481 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215004;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_220204;
    unsigned char *free_mem_220207;
    unsigned char *free_mem_220210;
};
static int futhark_mc_segmap_parloop_236482(void *args, int64_t start,
                                            int64_t end, int flat_tid_233825,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236481
    *futhark_mc_segmap_parloop_struct_236481 =
    (struct futhark_mc_segmap_parloop_struct_236481 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236481->ctx;
    uint64_t futhark_mc_segmap_parloop_236482_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236482_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236481->free_n_203490;
    int64_t gtid_215004 =
            futhark_mc_segmap_parloop_struct_236481->free_gtid_215004;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236481->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236481->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236481->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236481->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236481->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_220204 = {.desc ="mem_220204", .mem =
                                  futhark_mc_segmap_parloop_struct_236481->free_mem_220204,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_segmap_parloop_struct_236481->free_mem_220207,
                                  .size =0, .references =NULL};
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_segmap_parloop_struct_236481->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233999 = start;
    
    for (; iter_233999 < end; iter_233999++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234008 = n_203490;
        int64_t gtid_233826 = iter_233999;
        int64_t remnant_234009 = iter_233999 - gtid_233826;
        int64_t x_233827;
        
        x_233827 = ((int64_t *) mem_217340.mem)[gtid_215004 * n_203490 +
                                                gtid_233826];
        
        bool cond_233828 = sle64((int64_t) 0, x_233827);
        double defunc_0_f_res_233829;
        
        if (cond_233828) {
            bool y_234000 = slt64(x_233827, n_203490);
            bool bounds_check_234001 = cond_233828 && y_234000;
            bool index_certs_234002;
            
            if (!bounds_check_234001) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233827,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_234003;
            
            defunc_0_f_res_t_res_234003 = ((double *) mem_220204.mem)[x_233827];
            defunc_0_f_res_233829 = defunc_0_f_res_t_res_234003;
        } else {
            defunc_0_f_res_233829 = 0.0;
        }
        
        double defunc_0_f_res_233834;
        
        if (cond_233828) {
            bool y_234004 = slt64(x_233827, n_203490);
            bool bounds_check_234005 = cond_233828 && y_234004;
            bool index_certs_234006;
            
            if (!bounds_check_234005) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233827,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_234007;
            
            defunc_0_f_res_t_res_234007 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_215004 *
                                                   ctx_param_ext_217867 +
                                                   x_233827 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_233834 = defunc_0_f_res_t_res_234007;
        } else {
            defunc_0_f_res_233834 = 0.0;
        }
        ((double *) mem_220207.mem)[gtid_233826] = defunc_0_f_res_233834;
        ((double *) mem_220210.mem)[gtid_233826] = defunc_0_f_res_233829;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236482_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236482_end -
                 futhark_mc_segmap_parloop_236482_start;
        
        ctx->futhark_mc_segmap_parloop_236482_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236482_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236482_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236480(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233825 = tid;
    int num_tasks_233998 = info.nsubtasks;
    struct futhark_mc_task_236479 *futhark_mc_task_236479 =
                                  (struct futhark_mc_task_236479 *) args;
    struct futhark_context *ctx = futhark_mc_task_236479->ctx;
    uint64_t futhark_mc_segmap_task_236480_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236480_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236479->free_n_203490;
    int64_t gtid_215004 = futhark_mc_task_236479->free_gtid_215004;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236479->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236479->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236479->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236479->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236479->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_220204 = {.desc ="mem_220204", .mem =
                                  futhark_mc_task_236479->free_mem_220204,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_task_236479->free_mem_220207,
                                  .size =0, .references =NULL};
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_task_236479->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t iter_233999;
    struct futhark_mc_segmap_parloop_struct_236481
    futhark_mc_segmap_parloop_struct_236481;
    
    futhark_mc_segmap_parloop_struct_236481.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236481.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236481.free_gtid_215004 = gtid_215004;
    futhark_mc_segmap_parloop_struct_236481.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236481.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236481.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236481.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236481.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236481.free_mem_220204 = mem_220204.mem;
    futhark_mc_segmap_parloop_struct_236481.free_mem_220207 = mem_220207.mem;
    futhark_mc_segmap_parloop_struct_236481.free_mem_220210 = mem_220210.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236482_task;
    
    futhark_mc_segmap_parloop_236482_task.name =
        "futhark_mc_segmap_parloop_236482";
    futhark_mc_segmap_parloop_236482_task.fn = futhark_mc_segmap_parloop_236482;
    futhark_mc_segmap_parloop_236482_task.args =
        &futhark_mc_segmap_parloop_struct_236481;
    futhark_mc_segmap_parloop_236482_task.iterations = iterations;
    futhark_mc_segmap_parloop_236482_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236482_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236482_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236482_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236482_task);
    
    if (futhark_mc_segmap_parloop_236482_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236482_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236482_total_end -
                 futhark_mc_segmap_parloop_236482_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236482_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236482_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236482_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236480_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236480_end -
                 futhark_mc_segmap_task_236480_start;
        
        ctx->futhark_mc_segmap_task_236480_runs[tid]++;
        ctx->futhark_mc_segmap_task_236480_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236480_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236483 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_215004;
    int64_t free_x_215009;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220207;
    unsigned char *free_mem_220210;
    int64_t free_bytes_220212;
    unsigned char *free_mem_220249;
    unsigned char *free_mem_220252;
};
struct futhark_mc_segmap_parloop_struct_236485 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_215004;
    int64_t free_x_215009;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220207;
    unsigned char *free_mem_220210;
    int64_t free_bytes_220212;
    unsigned char *free_mem_220249;
    unsigned char *free_mem_220252;
};
static int futhark_mc_segmap_parloop_236486(void *args, int64_t start,
                                            int64_t end, int flat_tid_233916,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236485
    *futhark_mc_segmap_parloop_struct_236485 =
    (struct futhark_mc_segmap_parloop_struct_236485 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236485->ctx;
    uint64_t futhark_mc_segmap_parloop_236486_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236486_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236485->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236485->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236485->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236485->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236485->free_i_203670;
    int64_t gtid_215004 =
            futhark_mc_segmap_parloop_struct_236485->free_gtid_215004;
    int64_t x_215009 = futhark_mc_segmap_parloop_struct_236485->free_x_215009;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236485->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236485->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236485->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_segmap_parloop_struct_236485->free_mem_220207,
                                  .size =0, .references =NULL};
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_segmap_parloop_struct_236485->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 =
            futhark_mc_segmap_parloop_struct_236485->free_bytes_220212;
    struct memblock mem_220249 = {.desc ="mem_220249", .mem =
                                  futhark_mc_segmap_parloop_struct_236485->free_mem_220249,
                                  .size =0, .references =NULL};
    struct memblock mem_220252 = {.desc ="mem_220252", .mem =
                                  futhark_mc_segmap_parloop_struct_236485->free_mem_220252,
                                  .size =0, .references =NULL};
    size_t mem_233923_cached_sizze_236487 = 0;
    unsigned char *mem_233923 = NULL;
    size_t mem_233925_cached_sizze_236488 = 0;
    unsigned char *mem_233925 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234011 = start;
    
    if (mem_233923_cached_sizze_236487 < (size_t) bytes_220212) {
        mem_233923 = realloc(mem_233923, bytes_220212);
        mem_233923_cached_sizze_236487 = bytes_220212;
    }
    if (mem_233925_cached_sizze_236488 < (size_t) bytes_220212) {
        mem_233925 = realloc(mem_233925, bytes_220212);
        mem_233925_cached_sizze_236488 = bytes_220212;
    }
    for (; iter_234011 < end; iter_234011++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234062 = t_n_m_203650;
        int64_t gtid_233917 = iter_234011;
        int64_t remnant_234063 = iter_234011 - gtid_233917;
        int64_t x_233918;
        
        x_233918 = ((int64_t *) mem_217835.mem)[gtid_215004 * t_n_m_203650 +
                                                gtid_233917];
        
        double x_233919;
        
        x_233919 = ((double *) mem_217839.mem)[gtid_215004 * t_n_m_203650 +
                                               gtid_233917];
        
        int64_t min_arg_233920 = mul64(jump_t_203500, gtid_233917);
        int64_t min_res_233921 = smin64(i_203670, min_arg_233920);
        int64_t defunc_0_g_res_233922 = add64((int64_t) 1, min_res_233921);
        double defunc_2_reduce_res_233927;
        double defunc_2_reduce_res_233928;
        double defunc_2_reduce_res_233929;
        double redout_234013;
        double redout_234014;
        double redout_234015;
        
        redout_234013 = 0.0;
        redout_234014 = 0.0;
        redout_234015 = 0.0;
        for (int64_t i_234012 = 0; i_234012 < q_t_203494; i_234012++) {
            bool cond_234018 = sle64(x_215009, i_234012);
            int64_t defunc_0_f_res_234019;
            
            if (cond_234018) {
                defunc_0_f_res_234019 = (int64_t) 0;
            } else {
                int64_t i_234020 = add64(x_233918, i_234012);
                int64_t defunc_0_add_arg_234021;
                
                defunc_0_add_arg_234021 =
                    ((int64_t *) mem_217340.mem)[gtid_215004 * n_203490 +
                                                 i_234020];
                
                int64_t defunc_1_add_res_234022 = add64((int64_t) 1,
                                                        defunc_0_add_arg_234021);
                
                defunc_0_f_res_234019 = defunc_1_add_res_234022;
            }
            
            double defunc_0_f_res_234023;
            
            if (cond_234018) {
                defunc_0_f_res_234023 = 0.0;
            } else {
                int64_t i_234024 = add64(x_233918, i_234012);
                double defunc_0_add_arg_234025;
                
                defunc_0_add_arg_234025 = ((double *) mem_220207.mem)[i_234024];
                defunc_0_f_res_234023 = defunc_0_add_arg_234025;
            }
            
            int64_t binop_p_234026 = sub64(defunc_0_f_res_234019,
                                           defunc_0_g_res_233922);
            double defunc_0_f_res_234027 = sitofp_i64_f64(binop_p_234026);
            double abs_res_234028 = fabs(defunc_0_f_res_234027);
            double tmp1_234029 = abs_res_234028 / x_233919;
            double x_234030 = tmp1_234029 * tmp1_234029;
            double y_234031 = tmp1_234029 * x_234030;
            double tmp2_234032 = 1.0 - y_234031;
            double x_234033 = tmp2_234032 * tmp2_234032;
            double tmp3_234034 = tmp2_234032 * x_234033;
            double tmp4_234035 = defunc_0_f_res_234023 * tmp3_234034;
            double defunc_1_f_res_234036 = defunc_0_f_res_234027 * tmp4_234035;
            double defunc_1_f_res_234037 = defunc_0_f_res_234027 *
                   defunc_1_f_res_234036;
            double defunc_1_op_res_234038 = tmp4_234035 + redout_234013;
            double defunc_1_op_res_234039 = defunc_1_f_res_234036 +
                   redout_234014;
            double defunc_1_op_res_234040 = defunc_1_f_res_234037 +
                   redout_234015;
            
            ((double *) mem_233923)[i_234012] = defunc_1_f_res_234036;
            ((double *) mem_233925)[i_234012] = tmp4_234035;
            
            double redout_tmp_234064 = defunc_1_op_res_234038;
            double redout_tmp_234065 = defunc_1_op_res_234039;
            double redout_tmp_234066 = defunc_1_op_res_234040;
            
            redout_234013 = redout_tmp_234064;
            redout_234014 = redout_tmp_234065;
            redout_234015 = redout_tmp_234066;
        }
        defunc_2_reduce_res_233927 = redout_234013;
        defunc_2_reduce_res_233928 = redout_234014;
        defunc_2_reduce_res_233929 = redout_234015;
        
        double x_233963 = defunc_2_reduce_res_233927 *
               defunc_2_reduce_res_233929;
        double y_233964 = defunc_2_reduce_res_233928 *
               defunc_2_reduce_res_233928;
        double y_233965 = x_233963 - y_233964;
        double det1_233966 = 1.0 / y_233965;
        double a11_233967 = defunc_2_reduce_res_233929 * det1_233966;
        double x_233968 = 0.0 - defunc_2_reduce_res_233928;
        double b11_233969 = det1_233966 * x_233968;
        double c11_233970 = defunc_2_reduce_res_233927 * det1_233966;
        double defunc_2_reduce_res_233971;
        double defunc_2_reduce_res_233972;
        double redout_234044;
        double redout_234045;
        
        redout_234044 = 0.0;
        redout_234045 = 0.0;
        for (int64_t i_234043 = 0; i_234043 < q_t_203494; i_234043++) {
            double x_234046;
            
            x_234046 = ((double *) mem_233925)[i_234043];
            
            double x_234047;
            
            x_234047 = ((double *) mem_233923)[i_234043];
            
            bool cond_234048 = sle64(x_215009, i_234043);
            double defunc_0_f_res_234049;
            
            if (cond_234048) {
                defunc_0_f_res_234049 = 0.0;
            } else {
                int64_t i_234050 = add64(x_233918, i_234043);
                double defunc_0_add_arg_234051;
                
                defunc_0_add_arg_234051 = ((double *) mem_220210.mem)[i_234050];
                defunc_0_f_res_234049 = defunc_0_add_arg_234051;
            }
            
            double x_234052 = a11_233967 * x_234046;
            double y_234053 = b11_233969 * x_234047;
            double x_234054 = x_234052 + y_234053;
            double defunc_9_fit_fun_res_234055 = defunc_0_f_res_234049 *
                   x_234054;
            double x_234056 = b11_233969 * x_234046;
            double y_234057 = c11_233970 * x_234047;
            double x_234058 = x_234056 + y_234057;
            double defunc_9_slope_fun_res_234059 = defunc_0_f_res_234049 *
                   x_234058;
            double defunc_1_op_res_234060 = defunc_9_fit_fun_res_234055 +
                   redout_234044;
            double defunc_1_op_res_234061 = defunc_9_slope_fun_res_234059 +
                   redout_234045;
            double redout_tmp_234069 = defunc_1_op_res_234060;
            double redout_tmp_234070 = defunc_1_op_res_234061;
            
            redout_234044 = redout_tmp_234069;
            redout_234045 = redout_tmp_234070;
        }
        defunc_2_reduce_res_233971 = redout_234044;
        defunc_2_reduce_res_233972 = redout_234045;
        ((double *) mem_220249.mem)[gtid_233917] = defunc_2_reduce_res_233971;
        ((double *) mem_220252.mem)[gtid_233917] = defunc_2_reduce_res_233972;
    }
    
  cleanup:
    { }
    free(mem_233923);
    free(mem_233925);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236486_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236486_end -
                 futhark_mc_segmap_parloop_236486_start;
        
        ctx->futhark_mc_segmap_parloop_236486_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236486_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236486_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236484(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233916 = tid;
    int num_tasks_234010 = info.nsubtasks;
    struct futhark_mc_task_236483 *futhark_mc_task_236483 =
                                  (struct futhark_mc_task_236483 *) args;
    struct futhark_context *ctx = futhark_mc_task_236483->ctx;
    uint64_t futhark_mc_segmap_task_236484_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236484_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236483->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236483->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236483->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236483->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236483->free_i_203670;
    int64_t gtid_215004 = futhark_mc_task_236483->free_gtid_215004;
    int64_t x_215009 = futhark_mc_task_236483->free_x_215009;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236483->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236483->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236483->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_task_236483->free_mem_220207,
                                  .size =0, .references =NULL};
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_task_236483->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 = futhark_mc_task_236483->free_bytes_220212;
    struct memblock mem_220249 = {.desc ="mem_220249", .mem =
                                  futhark_mc_task_236483->free_mem_220249,
                                  .size =0, .references =NULL};
    struct memblock mem_220252 = {.desc ="mem_220252", .mem =
                                  futhark_mc_task_236483->free_mem_220252,
                                  .size =0, .references =NULL};
    int64_t iter_234011;
    struct futhark_mc_segmap_parloop_struct_236485
    futhark_mc_segmap_parloop_struct_236485;
    
    futhark_mc_segmap_parloop_struct_236485.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236485.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236485.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236485.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236485.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236485.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236485.free_gtid_215004 = gtid_215004;
    futhark_mc_segmap_parloop_struct_236485.free_x_215009 = x_215009;
    futhark_mc_segmap_parloop_struct_236485.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236485.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236485.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236485.free_mem_220207 = mem_220207.mem;
    futhark_mc_segmap_parloop_struct_236485.free_mem_220210 = mem_220210.mem;
    futhark_mc_segmap_parloop_struct_236485.free_bytes_220212 = bytes_220212;
    futhark_mc_segmap_parloop_struct_236485.free_mem_220249 = mem_220249.mem;
    futhark_mc_segmap_parloop_struct_236485.free_mem_220252 = mem_220252.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236486_task;
    
    futhark_mc_segmap_parloop_236486_task.name =
        "futhark_mc_segmap_parloop_236486";
    futhark_mc_segmap_parloop_236486_task.fn = futhark_mc_segmap_parloop_236486;
    futhark_mc_segmap_parloop_236486_task.args =
        &futhark_mc_segmap_parloop_struct_236485;
    futhark_mc_segmap_parloop_236486_task.iterations = iterations;
    futhark_mc_segmap_parloop_236486_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236486_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236486_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236486_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236486_task);
    
    if (futhark_mc_segmap_parloop_236486_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236486_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236486_total_end -
                 futhark_mc_segmap_parloop_236486_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236486_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236486_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236486_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236484_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236484_end -
                 futhark_mc_segmap_task_236484_start;
        
        ctx->futhark_mc_segmap_task_236484_runs[tid]++;
        ctx->futhark_mc_segmap_task_236484_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236484_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236490 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_215004;
    int64_t free_x_215009;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220207;
    unsigned char *free_mem_220210;
    int64_t free_bytes_220212;
    unsigned char *free_mem_220249;
    unsigned char *free_mem_220252;
};
struct futhark_mc_task_236494 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215004;
    int64_t free_x_215009;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220207;
    int64_t free_x_233841;
    double free_x_233842;
    int64_t free_defunc_0_g_res_233845;
    double *retval_defunc_2_reduce_res_233848;
    double *retval_defunc_2_reduce_res_233849;
    double *retval_defunc_2_reduce_res_233850;
    unsigned char *retval_mem_233846;
    unsigned char *retval_mem_233847;
};
struct futhark_mc_segred_stage_1_parloop_struct_236499 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215004;
    int64_t free_x_215009;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220207;
    int64_t free_x_233841;
    double free_x_233842;
    int64_t free_defunc_0_g_res_233845;
    unsigned char *free_mem_233846;
    unsigned char *free_mem_233847;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234128;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234130;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234132;
};
static int futhark_mc_segred_stage_1_parloop_236500(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234072,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236499
    *futhark_mc_segred_stage_1_parloop_struct_236499 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236499 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236499->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236500_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236500_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236499->free_n_203490;
    int64_t gtid_215004 =
            futhark_mc_segred_stage_1_parloop_struct_236499->free_gtid_215004;
    int64_t x_215009 =
            futhark_mc_segred_stage_1_parloop_struct_236499->free_x_215009;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236499->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236499->free_mem_220207,
                                  .size =0, .references =NULL};
    int64_t x_233841 =
            futhark_mc_segred_stage_1_parloop_struct_236499->free_x_233841;
    double x_233842 =
           futhark_mc_segred_stage_1_parloop_struct_236499->free_x_233842;
    int64_t defunc_0_g_res_233845 =
            futhark_mc_segred_stage_1_parloop_struct_236499->free_defunc_0_g_res_233845;
    struct memblock mem_233846 = {.desc ="mem_233846", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236499->free_mem_233846,
                                  .size =0, .references =NULL};
    struct memblock mem_233847 = {.desc ="mem_233847", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236499->free_mem_233847,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234128 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234128",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236499->free_reduce_stage_1_tid_res_arr_mem_234128,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234130 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234130",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236499->free_reduce_stage_1_tid_res_arr_mem_234130,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234132 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234132",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236499->free_reduce_stage_1_tid_res_arr_mem_234132,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234134 = start;
    double x_234074;
    double x_234075;
    double x_234077;
    double x_234078;
    double x_234080;
    double x_234081;
    double local_acc_234135 = 0.0;
    double local_acc_234136 = 0.0;
    double local_acc_234137 = 0.0;
    
    for (; iter_234134 < end; iter_234134++) {
        int64_t gtid_234073 = iter_234134;
        bool cond_234083 = sle64(x_215009, gtid_234073);
        int64_t defunc_0_f_res_234084;
        
        if (cond_234083) {
            defunc_0_f_res_234084 = (int64_t) 0;
        } else {
            int64_t i_234085 = add64(x_233841, gtid_234073);
            int64_t defunc_0_add_arg_234086;
            
            defunc_0_add_arg_234086 = ((int64_t *) mem_217340.mem)[gtid_215004 *
                                                                   n_203490 +
                                                                   i_234085];
            
            int64_t defunc_1_add_res_234087 = add64((int64_t) 1,
                                                    defunc_0_add_arg_234086);
            
            defunc_0_f_res_234084 = defunc_1_add_res_234087;
        }
        
        double defunc_0_f_res_234088;
        
        if (cond_234083) {
            defunc_0_f_res_234088 = 0.0;
        } else {
            int64_t i_234089 = add64(x_233841, gtid_234073);
            double defunc_0_add_arg_234090;
            
            defunc_0_add_arg_234090 = ((double *) mem_220207.mem)[i_234089];
            defunc_0_f_res_234088 = defunc_0_add_arg_234090;
        }
        
        int64_t binop_p_234091 = sub64(defunc_0_f_res_234084,
                                       defunc_0_g_res_233845);
        double defunc_0_f_res_234092 = sitofp_i64_f64(binop_p_234091);
        double abs_res_234093 = fabs(defunc_0_f_res_234092);
        double tmp1_234094 = abs_res_234093 / x_233842;
        double x_234095 = tmp1_234094 * tmp1_234094;
        double y_234096 = tmp1_234094 * x_234095;
        double tmp2_234097 = 1.0 - y_234096;
        double x_234098 = tmp2_234097 * tmp2_234097;
        double tmp3_234099 = tmp2_234097 * x_234098;
        double tmp4_234100 = defunc_0_f_res_234088 * tmp3_234099;
        double defunc_1_f_res_234101 = defunc_0_f_res_234092 * tmp4_234100;
        double defunc_1_f_res_234102 = defunc_0_f_res_234092 *
               defunc_1_f_res_234101;
        
        // save map-out results
        {
            ((double *) mem_233846.mem)[gtid_234073] = defunc_1_f_res_234101;
            ((double *) mem_233847.mem)[gtid_234073] = tmp4_234100;
        }
        // Load accum params
        {
            x_234074 = local_acc_234135;
        }
        // Load next params
        {
            x_234075 = tmp4_234100;
        }
        // Red body
        {
            double defunc_1_op_res_234076 = x_234074 + x_234075;
            
            local_acc_234135 = defunc_1_op_res_234076;
        }
        // Load accum params
        {
            x_234077 = local_acc_234136;
        }
        // Load next params
        {
            x_234078 = defunc_1_f_res_234101;
        }
        // Red body
        {
            double defunc_1_op_res_234079 = x_234077 + x_234078;
            
            local_acc_234136 = defunc_1_op_res_234079;
        }
        // Load accum params
        {
            x_234080 = local_acc_234137;
        }
        // Load next params
        {
            x_234081 = defunc_1_f_res_234102;
        }
        // Red body
        {
            double defunc_1_op_res_234082 = x_234080 + x_234081;
            
            local_acc_234137 = defunc_1_op_res_234082;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234128.mem)[flat_tid_234072] =
        local_acc_234135;
    ((double *) reduce_stage_1_tid_res_arr_mem_234130.mem)[flat_tid_234072] =
        local_acc_234136;
    ((double *) reduce_stage_1_tid_res_arr_mem_234132.mem)[flat_tid_234072] =
        local_acc_234137;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236500_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236500_end -
                 futhark_mc_segred_stage_1_parloop_236500_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236500_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236500_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236500_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236495(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234072 = tid;
    int num_tasks_234127 = info.nsubtasks;
    struct futhark_mc_task_236494 *futhark_mc_task_236494 =
                                  (struct futhark_mc_task_236494 *) args;
    struct futhark_context *ctx = futhark_mc_task_236494->ctx;
    uint64_t futhark_mc_segred_task_236495_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236495_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236494->free_n_203490;
    int64_t gtid_215004 = futhark_mc_task_236494->free_gtid_215004;
    int64_t x_215009 = futhark_mc_task_236494->free_x_215009;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236494->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_task_236494->free_mem_220207,
                                  .size =0, .references =NULL};
    int64_t x_233841 = futhark_mc_task_236494->free_x_233841;
    double x_233842 = futhark_mc_task_236494->free_x_233842;
    int64_t defunc_0_g_res_233845 =
            futhark_mc_task_236494->free_defunc_0_g_res_233845;
    double defunc_2_reduce_res_233848 =
           *futhark_mc_task_236494->retval_defunc_2_reduce_res_233848;
    double defunc_2_reduce_res_233849 =
           *futhark_mc_task_236494->retval_defunc_2_reduce_res_233849;
    double defunc_2_reduce_res_233850 =
           *futhark_mc_task_236494->retval_defunc_2_reduce_res_233850;
    struct memblock mem_233846 = {.desc ="mem_233846", .mem =
                                  futhark_mc_task_236494->retval_mem_233846,
                                  .size =0, .references =NULL};
    struct memblock mem_233847 = {.desc ="mem_233847", .mem =
                                  futhark_mc_task_236494->retval_mem_233847,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_234128_cached_sizze_236496 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234128 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234130_cached_sizze_236497 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234130 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234132_cached_sizze_236498 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234132 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234128_cached_sizze_236496 <
        (size_t) ((int64_t) 8 * num_tasks_234127)) {
        reduce_stage_1_tid_res_arr_mem_234128 =
            realloc(reduce_stage_1_tid_res_arr_mem_234128, (int64_t) 8 *
                    num_tasks_234127);
        reduce_stage_1_tid_res_arr_mem_234128_cached_sizze_236496 =
            (int64_t) 8 * num_tasks_234127;
    }
    if (reduce_stage_1_tid_res_arr_mem_234130_cached_sizze_236497 <
        (size_t) ((int64_t) 8 * num_tasks_234127)) {
        reduce_stage_1_tid_res_arr_mem_234130 =
            realloc(reduce_stage_1_tid_res_arr_mem_234130, (int64_t) 8 *
                    num_tasks_234127);
        reduce_stage_1_tid_res_arr_mem_234130_cached_sizze_236497 =
            (int64_t) 8 * num_tasks_234127;
    }
    if (reduce_stage_1_tid_res_arr_mem_234132_cached_sizze_236498 <
        (size_t) ((int64_t) 8 * num_tasks_234127)) {
        reduce_stage_1_tid_res_arr_mem_234132 =
            realloc(reduce_stage_1_tid_res_arr_mem_234132, (int64_t) 8 *
                    num_tasks_234127);
        reduce_stage_1_tid_res_arr_mem_234132_cached_sizze_236498 =
            (int64_t) 8 * num_tasks_234127;
    }
    
    int64_t iter_234134;
    struct futhark_mc_segred_stage_1_parloop_struct_236499
    futhark_mc_segred_stage_1_parloop_struct_236499;
    
    futhark_mc_segred_stage_1_parloop_struct_236499.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_gtid_215004 =
        gtid_215004;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_x_215009 = x_215009;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_mem_217340 =
        mem_217340.mem;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_mem_220207 =
        mem_220207.mem;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_x_233841 = x_233841;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_x_233842 = x_233842;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_defunc_0_g_res_233845 =
        defunc_0_g_res_233845;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_mem_233846 =
        mem_233846.mem;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_mem_233847 =
        mem_233847.mem;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_reduce_stage_1_tid_res_arr_mem_234128 =
        reduce_stage_1_tid_res_arr_mem_234128;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_reduce_stage_1_tid_res_arr_mem_234130 =
        reduce_stage_1_tid_res_arr_mem_234130;
    futhark_mc_segred_stage_1_parloop_struct_236499.free_reduce_stage_1_tid_res_arr_mem_234132 =
        reduce_stage_1_tid_res_arr_mem_234132;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236500_task;
    
    futhark_mc_segred_stage_1_parloop_236500_task.name =
        "futhark_mc_segred_stage_1_parloop_236500";
    futhark_mc_segred_stage_1_parloop_236500_task.fn =
        futhark_mc_segred_stage_1_parloop_236500;
    futhark_mc_segred_stage_1_parloop_236500_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236499;
    futhark_mc_segred_stage_1_parloop_236500_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236500_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236500_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236500_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236500_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236500_task);
    
    if (futhark_mc_segred_stage_1_parloop_236500_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236500_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236500_total_end -
                 futhark_mc_segred_stage_1_parloop_236500_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236500_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236500_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236500_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233848 = 0.0;
        defunc_2_reduce_res_233849 = 0.0;
        defunc_2_reduce_res_233850 = 0.0;
    }
    
    double x_234138;
    double x_234139;
    double x_234141;
    double x_234142;
    double x_234144;
    double x_234145;
    
    for (int32_t i_234147 = 0; i_234147 < num_tasks_234127; i_234147++) {
        flat_tid_234072 = i_234147;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234138 = defunc_2_reduce_res_233848;
            }
            // load next params
            {
                x_234139 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234128)[flat_tid_234072];
            }
            // red body
            {
                double defunc_1_op_res_234140 = x_234138 + x_234139;
                
                defunc_2_reduce_res_233848 = defunc_1_op_res_234140;
            }
            // load acc params
            {
                x_234141 = defunc_2_reduce_res_233849;
            }
            // load next params
            {
                x_234142 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234130)[flat_tid_234072];
            }
            // red body
            {
                double defunc_1_op_res_234143 = x_234141 + x_234142;
                
                defunc_2_reduce_res_233849 = defunc_1_op_res_234143;
            }
            // load acc params
            {
                x_234144 = defunc_2_reduce_res_233850;
            }
            // load next params
            {
                x_234145 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234132)[flat_tid_234072];
            }
            // red body
            {
                double defunc_1_op_res_234146 = x_234144 + x_234145;
                
                defunc_2_reduce_res_233850 = defunc_1_op_res_234146;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234128);
        free(reduce_stage_1_tid_res_arr_mem_234130);
        free(reduce_stage_1_tid_res_arr_mem_234132);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236495_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236495_end -
                 futhark_mc_segred_task_236495_start;
        
        ctx->futhark_mc_segred_task_236495_runs[tid]++;
        ctx->futhark_mc_segred_task_236495_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236495_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236494->retval_defunc_2_reduce_res_233848 =
            defunc_2_reduce_res_233848;
        *futhark_mc_task_236494->retval_defunc_2_reduce_res_233849 =
            defunc_2_reduce_res_233849;
        *futhark_mc_task_236494->retval_defunc_2_reduce_res_233850 =
            defunc_2_reduce_res_233850;
        futhark_mc_task_236494->retval_mem_233846 = mem_233846.mem;
        futhark_mc_task_236494->retval_mem_233847 = mem_233847.mem;
    }
    return err;
}
struct futhark_mc_task_236501 {
    struct futhark_context *ctx;
    int64_t free_x_215009;
    unsigned char *free_mem_220210;
    int64_t free_x_233841;
    unsigned char *free_mem_233846;
    unsigned char *free_mem_233847;
    double free_a11_233888;
    double free_b11_233890;
    double free_c11_233891;
    double *retval_defunc_2_reduce_res_233892;
    double *retval_defunc_2_reduce_res_233893;
};
struct futhark_mc_segred_stage_1_parloop_struct_236505 {
    struct futhark_context *ctx;
    int64_t free_x_215009;
    unsigned char *free_mem_220210;
    int64_t free_x_233841;
    unsigned char *free_mem_233846;
    unsigned char *free_mem_233847;
    double free_a11_233888;
    double free_b11_233890;
    double free_c11_233891;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234149;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234151;
};
static int futhark_mc_segred_stage_1_parloop_236506(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234103,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236505
    *futhark_mc_segred_stage_1_parloop_struct_236505 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236505 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236505->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236506_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236506_start = get_wall_time();
    
    int64_t x_215009 =
            futhark_mc_segred_stage_1_parloop_struct_236505->free_x_215009;
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236505->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t x_233841 =
            futhark_mc_segred_stage_1_parloop_struct_236505->free_x_233841;
    struct memblock mem_233846 = {.desc ="mem_233846", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236505->free_mem_233846,
                                  .size =0, .references =NULL};
    struct memblock mem_233847 = {.desc ="mem_233847", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236505->free_mem_233847,
                                  .size =0, .references =NULL};
    double a11_233888 =
           futhark_mc_segred_stage_1_parloop_struct_236505->free_a11_233888;
    double b11_233890 =
           futhark_mc_segred_stage_1_parloop_struct_236505->free_b11_233890;
    double c11_233891 =
           futhark_mc_segred_stage_1_parloop_struct_236505->free_c11_233891;
    struct memblock reduce_stage_1_tid_res_arr_mem_234149 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234149",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236505->free_reduce_stage_1_tid_res_arr_mem_234149,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234151 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234151",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236505->free_reduce_stage_1_tid_res_arr_mem_234151,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234153 = start;
    double x_234105;
    double x_234106;
    double x_234108;
    double x_234109;
    double local_acc_234154 = 0.0;
    double local_acc_234155 = 0.0;
    
    for (; iter_234153 < end; iter_234153++) {
        int64_t gtid_234104 = iter_234153;
        double x_234111;
        
        x_234111 = ((double *) mem_233847.mem)[gtid_234104];
        
        double x_234112;
        
        x_234112 = ((double *) mem_233846.mem)[gtid_234104];
        
        bool cond_234113 = sle64(x_215009, gtid_234104);
        double defunc_0_f_res_234114;
        
        if (cond_234113) {
            defunc_0_f_res_234114 = 0.0;
        } else {
            int64_t i_234115 = add64(x_233841, gtid_234104);
            double defunc_0_add_arg_234116;
            
            defunc_0_add_arg_234116 = ((double *) mem_220210.mem)[i_234115];
            defunc_0_f_res_234114 = defunc_0_add_arg_234116;
        }
        
        double x_234117 = a11_233888 * x_234111;
        double y_234118 = b11_233890 * x_234112;
        double x_234119 = x_234117 + y_234118;
        double defunc_9_fit_fun_res_234120 = defunc_0_f_res_234114 * x_234119;
        double x_234121 = b11_233890 * x_234111;
        double y_234122 = c11_233891 * x_234112;
        double x_234123 = x_234121 + y_234122;
        double defunc_9_slope_fun_res_234124 = defunc_0_f_res_234114 * x_234123;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_234105 = local_acc_234154;
        }
        // Load next params
        {
            x_234106 = defunc_9_fit_fun_res_234120;
        }
        // Red body
        {
            double defunc_1_op_res_234107 = x_234105 + x_234106;
            
            local_acc_234154 = defunc_1_op_res_234107;
        }
        // Load accum params
        {
            x_234108 = local_acc_234155;
        }
        // Load next params
        {
            x_234109 = defunc_9_slope_fun_res_234124;
        }
        // Red body
        {
            double defunc_1_op_res_234110 = x_234108 + x_234109;
            
            local_acc_234155 = defunc_1_op_res_234110;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234149.mem)[flat_tid_234103] =
        local_acc_234154;
    ((double *) reduce_stage_1_tid_res_arr_mem_234151.mem)[flat_tid_234103] =
        local_acc_234155;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236506_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236506_end -
                 futhark_mc_segred_stage_1_parloop_236506_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236506_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236506_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236506_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236502(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234103 = tid;
    int num_tasks_234148 = info.nsubtasks;
    struct futhark_mc_task_236501 *futhark_mc_task_236501 =
                                  (struct futhark_mc_task_236501 *) args;
    struct futhark_context *ctx = futhark_mc_task_236501->ctx;
    uint64_t futhark_mc_segred_task_236502_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236502_start = get_wall_time();
    
    int64_t x_215009 = futhark_mc_task_236501->free_x_215009;
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_task_236501->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t x_233841 = futhark_mc_task_236501->free_x_233841;
    struct memblock mem_233846 = {.desc ="mem_233846", .mem =
                                  futhark_mc_task_236501->free_mem_233846,
                                  .size =0, .references =NULL};
    struct memblock mem_233847 = {.desc ="mem_233847", .mem =
                                  futhark_mc_task_236501->free_mem_233847,
                                  .size =0, .references =NULL};
    double a11_233888 = futhark_mc_task_236501->free_a11_233888;
    double b11_233890 = futhark_mc_task_236501->free_b11_233890;
    double c11_233891 = futhark_mc_task_236501->free_c11_233891;
    double defunc_2_reduce_res_233892 =
           *futhark_mc_task_236501->retval_defunc_2_reduce_res_233892;
    double defunc_2_reduce_res_233893 =
           *futhark_mc_task_236501->retval_defunc_2_reduce_res_233893;
    size_t reduce_stage_1_tid_res_arr_mem_234149_cached_sizze_236503 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234149 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234151_cached_sizze_236504 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234151 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234149_cached_sizze_236503 <
        (size_t) ((int64_t) 8 * num_tasks_234148)) {
        reduce_stage_1_tid_res_arr_mem_234149 =
            realloc(reduce_stage_1_tid_res_arr_mem_234149, (int64_t) 8 *
                    num_tasks_234148);
        reduce_stage_1_tid_res_arr_mem_234149_cached_sizze_236503 =
            (int64_t) 8 * num_tasks_234148;
    }
    if (reduce_stage_1_tid_res_arr_mem_234151_cached_sizze_236504 <
        (size_t) ((int64_t) 8 * num_tasks_234148)) {
        reduce_stage_1_tid_res_arr_mem_234151 =
            realloc(reduce_stage_1_tid_res_arr_mem_234151, (int64_t) 8 *
                    num_tasks_234148);
        reduce_stage_1_tid_res_arr_mem_234151_cached_sizze_236504 =
            (int64_t) 8 * num_tasks_234148;
    }
    
    int64_t iter_234153;
    struct futhark_mc_segred_stage_1_parloop_struct_236505
    futhark_mc_segred_stage_1_parloop_struct_236505;
    
    futhark_mc_segred_stage_1_parloop_struct_236505.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_x_215009 = x_215009;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_mem_220210 =
        mem_220210.mem;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_x_233841 = x_233841;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_mem_233846 =
        mem_233846.mem;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_mem_233847 =
        mem_233847.mem;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_a11_233888 =
        a11_233888;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_b11_233890 =
        b11_233890;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_c11_233891 =
        c11_233891;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_reduce_stage_1_tid_res_arr_mem_234149 =
        reduce_stage_1_tid_res_arr_mem_234149;
    futhark_mc_segred_stage_1_parloop_struct_236505.free_reduce_stage_1_tid_res_arr_mem_234151 =
        reduce_stage_1_tid_res_arr_mem_234151;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236506_task;
    
    futhark_mc_segred_stage_1_parloop_236506_task.name =
        "futhark_mc_segred_stage_1_parloop_236506";
    futhark_mc_segred_stage_1_parloop_236506_task.fn =
        futhark_mc_segred_stage_1_parloop_236506;
    futhark_mc_segred_stage_1_parloop_236506_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236505;
    futhark_mc_segred_stage_1_parloop_236506_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236506_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236506_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236506_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236506_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236506_task);
    
    if (futhark_mc_segred_stage_1_parloop_236506_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236506_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236506_total_end -
                 futhark_mc_segred_stage_1_parloop_236506_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236506_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236506_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236506_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233892 = 0.0;
        defunc_2_reduce_res_233893 = 0.0;
    }
    
    double x_234156;
    double x_234157;
    double x_234159;
    double x_234160;
    
    for (int32_t i_234162 = 0; i_234162 < num_tasks_234148; i_234162++) {
        flat_tid_234103 = i_234162;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234156 = defunc_2_reduce_res_233892;
            }
            // load next params
            {
                x_234157 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234149)[flat_tid_234103];
            }
            // red body
            {
                double defunc_1_op_res_234158 = x_234156 + x_234157;
                
                defunc_2_reduce_res_233892 = defunc_1_op_res_234158;
            }
            // load acc params
            {
                x_234159 = defunc_2_reduce_res_233893;
            }
            // load next params
            {
                x_234160 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234151)[flat_tid_234103];
            }
            // red body
            {
                double defunc_1_op_res_234161 = x_234159 + x_234160;
                
                defunc_2_reduce_res_233893 = defunc_1_op_res_234161;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234149);
        free(reduce_stage_1_tid_res_arr_mem_234151);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236502_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236502_end -
                 futhark_mc_segred_task_236502_start;
        
        ctx->futhark_mc_segred_task_236502_runs[tid]++;
        ctx->futhark_mc_segred_task_236502_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236502_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236501->retval_defunc_2_reduce_res_233892 =
            defunc_2_reduce_res_233892;
        *futhark_mc_task_236501->retval_defunc_2_reduce_res_233893 =
            defunc_2_reduce_res_233893;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236491(void *args, int64_t start,
                                            int64_t end, int flat_tid_233839,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236490
    *futhark_mc_segmap_parloop_struct_236490 =
    (struct futhark_mc_segmap_parloop_struct_236490 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236490->ctx;
    uint64_t futhark_mc_segmap_parloop_236491_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236491_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236490->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236490->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236490->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236490->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236490->free_i_203670;
    int64_t gtid_215004 =
            futhark_mc_segmap_parloop_struct_236490->free_gtid_215004;
    int64_t x_215009 = futhark_mc_segmap_parloop_struct_236490->free_x_215009;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_220207,
                                  .size =0, .references =NULL};
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 =
            futhark_mc_segmap_parloop_struct_236490->free_bytes_220212;
    struct memblock mem_220249 = {.desc ="mem_220249", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_220249,
                                  .size =0, .references =NULL};
    struct memblock mem_220252 = {.desc ="mem_220252", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_220252,
                                  .size =0, .references =NULL};
    size_t mem_233846_cached_sizze_236492 = 0;
    unsigned char *mem_233846 = NULL;
    size_t mem_233847_cached_sizze_236493 = 0;
    unsigned char *mem_233847 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234071 = start;
    
    if (mem_233846_cached_sizze_236492 < (size_t) bytes_220212) {
        mem_233846 = realloc(mem_233846, bytes_220212);
        mem_233846_cached_sizze_236492 = bytes_220212;
    }
    if (mem_233847_cached_sizze_236493 < (size_t) bytes_220212) {
        mem_233847 = realloc(mem_233847, bytes_220212);
        mem_233847_cached_sizze_236493 = bytes_220212;
    }
    for (; iter_234071 < end; iter_234071++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234125 = t_n_m_203650;
        int64_t gtid_233840 = iter_234071;
        int64_t remnant_234126 = iter_234071 - gtid_233840;
        int64_t x_233841;
        
        x_233841 = ((int64_t *) mem_217835.mem)[gtid_215004 * t_n_m_203650 +
                                                gtid_233840];
        
        double x_233842;
        
        x_233842 = ((double *) mem_217839.mem)[gtid_215004 * t_n_m_203650 +
                                               gtid_233840];
        
        int64_t min_arg_233843 = mul64(jump_t_203500, gtid_233840);
        int64_t min_res_233844 = smin64(i_203670, min_arg_233843);
        int64_t defunc_0_g_res_233845 = add64((int64_t) 1, min_res_233844);
        double defunc_2_reduce_res_233848;
        double defunc_2_reduce_res_233849;
        double defunc_2_reduce_res_233850;
        int64_t flat_tid_234072 = (int64_t) 0;
        int32_t num_tasks_234127;
        
        defunc_2_reduce_res_233848 = 0.0;
        defunc_2_reduce_res_233849 = 0.0;
        defunc_2_reduce_res_233850 = 0.0;
        
        struct futhark_mc_task_236494 futhark_mc_task_236494;
        
        futhark_mc_task_236494.ctx = ctx;
        futhark_mc_task_236494.free_n_203490 = n_203490;
        futhark_mc_task_236494.free_gtid_215004 = gtid_215004;
        futhark_mc_task_236494.free_x_215009 = x_215009;
        futhark_mc_task_236494.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236494.free_mem_220207 = mem_220207.mem;
        futhark_mc_task_236494.free_x_233841 = x_233841;
        futhark_mc_task_236494.free_x_233842 = x_233842;
        futhark_mc_task_236494.free_defunc_0_g_res_233845 =
            defunc_0_g_res_233845;
        futhark_mc_task_236494.retval_defunc_2_reduce_res_233848 =
            &defunc_2_reduce_res_233848;
        futhark_mc_task_236494.retval_defunc_2_reduce_res_233849 =
            &defunc_2_reduce_res_233849;
        futhark_mc_task_236494.retval_defunc_2_reduce_res_233850 =
            &defunc_2_reduce_res_233850;
        futhark_mc_task_236494.retval_mem_233846 = mem_233846;
        futhark_mc_task_236494.retval_mem_233847 = mem_233847;
        
        struct scheduler_segop futhark_mc_task_236494_task;
        
        futhark_mc_task_236494_task.args = &futhark_mc_task_236494;
        futhark_mc_task_236494_task.top_level_fn =
            futhark_mc_segred_task_236495;
        futhark_mc_task_236494_task.name = "futhark_mc_segred_task_236495";
        futhark_mc_task_236494_task.iterations = q_t_203494;
        futhark_mc_task_236494_task.task_time =
            &ctx->futhark_mc_segred_task_236495_total_time;
        futhark_mc_task_236494_task.task_iter =
            &ctx->futhark_mc_segred_task_236495_total_iter;
        futhark_mc_task_236494_task.sched = STATIC;
        futhark_mc_task_236494_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236495_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236494_task);
        
        if (futhark_mc_segred_task_236495_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_233884 = defunc_2_reduce_res_233848 *
               defunc_2_reduce_res_233850;
        double y_233885 = defunc_2_reduce_res_233849 *
               defunc_2_reduce_res_233849;
        double y_233886 = x_233884 - y_233885;
        double det1_233887 = 1.0 / y_233886;
        double a11_233888 = defunc_2_reduce_res_233850 * det1_233887;
        double x_233889 = 0.0 - defunc_2_reduce_res_233849;
        double b11_233890 = det1_233887 * x_233889;
        double c11_233891 = defunc_2_reduce_res_233848 * det1_233887;
        double defunc_2_reduce_res_233892;
        double defunc_2_reduce_res_233893;
        int64_t flat_tid_234103 = (int64_t) 0;
        int32_t num_tasks_234148;
        
        defunc_2_reduce_res_233892 = 0.0;
        defunc_2_reduce_res_233893 = 0.0;
        
        struct futhark_mc_task_236501 futhark_mc_task_236501;
        
        futhark_mc_task_236501.ctx = ctx;
        futhark_mc_task_236501.free_x_215009 = x_215009;
        futhark_mc_task_236501.free_mem_220210 = mem_220210.mem;
        futhark_mc_task_236501.free_x_233841 = x_233841;
        futhark_mc_task_236501.free_mem_233846 = mem_233846;
        futhark_mc_task_236501.free_mem_233847 = mem_233847;
        futhark_mc_task_236501.free_a11_233888 = a11_233888;
        futhark_mc_task_236501.free_b11_233890 = b11_233890;
        futhark_mc_task_236501.free_c11_233891 = c11_233891;
        futhark_mc_task_236501.retval_defunc_2_reduce_res_233892 =
            &defunc_2_reduce_res_233892;
        futhark_mc_task_236501.retval_defunc_2_reduce_res_233893 =
            &defunc_2_reduce_res_233893;
        
        struct scheduler_segop futhark_mc_task_236501_task;
        
        futhark_mc_task_236501_task.args = &futhark_mc_task_236501;
        futhark_mc_task_236501_task.top_level_fn =
            futhark_mc_segred_task_236502;
        futhark_mc_task_236501_task.name = "futhark_mc_segred_task_236502";
        futhark_mc_task_236501_task.iterations = q_t_203494;
        futhark_mc_task_236501_task.task_time =
            &ctx->futhark_mc_segred_task_236502_total_time;
        futhark_mc_task_236501_task.task_iter =
            &ctx->futhark_mc_segred_task_236502_total_iter;
        futhark_mc_task_236501_task.sched = STATIC;
        futhark_mc_task_236501_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236502_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236501_task);
        
        if (futhark_mc_segred_task_236502_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220249.mem)[gtid_233840] = defunc_2_reduce_res_233892;
        ((double *) mem_220252.mem)[gtid_233840] = defunc_2_reduce_res_233893;
    }
    
  cleanup:
    { }
    free(mem_233846);
    free(mem_233847);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236491_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236491_end -
                 futhark_mc_segmap_parloop_236491_start;
        
        ctx->futhark_mc_segmap_parloop_236491_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236491_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236491_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236489(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233839 = tid;
    int num_tasks_234010 = info.nsubtasks;
    struct futhark_mc_task_236483 *futhark_mc_task_236483 =
                                  (struct futhark_mc_task_236483 *) args;
    struct futhark_context *ctx = futhark_mc_task_236483->ctx;
    uint64_t futhark_mc_segmap_nested_task_236489_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236489_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236483->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236483->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236483->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236483->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236483->free_i_203670;
    int64_t gtid_215004 = futhark_mc_task_236483->free_gtid_215004;
    int64_t x_215009 = futhark_mc_task_236483->free_x_215009;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236483->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236483->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236483->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220207 = {.desc ="mem_220207", .mem =
                                  futhark_mc_task_236483->free_mem_220207,
                                  .size =0, .references =NULL};
    struct memblock mem_220210 = {.desc ="mem_220210", .mem =
                                  futhark_mc_task_236483->free_mem_220210,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 = futhark_mc_task_236483->free_bytes_220212;
    struct memblock mem_220249 = {.desc ="mem_220249", .mem =
                                  futhark_mc_task_236483->free_mem_220249,
                                  .size =0, .references =NULL};
    struct memblock mem_220252 = {.desc ="mem_220252", .mem =
                                  futhark_mc_task_236483->free_mem_220252,
                                  .size =0, .references =NULL};
    int64_t iter_234071;
    struct futhark_mc_segmap_parloop_struct_236490
    futhark_mc_segmap_parloop_struct_236490;
    
    futhark_mc_segmap_parloop_struct_236490.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236490.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236490.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236490.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236490.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236490.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236490.free_gtid_215004 = gtid_215004;
    futhark_mc_segmap_parloop_struct_236490.free_x_215009 = x_215009;
    futhark_mc_segmap_parloop_struct_236490.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_220207 = mem_220207.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_220210 = mem_220210.mem;
    futhark_mc_segmap_parloop_struct_236490.free_bytes_220212 = bytes_220212;
    futhark_mc_segmap_parloop_struct_236490.free_mem_220249 = mem_220249.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_220252 = mem_220252.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236491_task;
    
    futhark_mc_segmap_parloop_236491_task.name =
        "futhark_mc_segmap_parloop_236491";
    futhark_mc_segmap_parloop_236491_task.fn = futhark_mc_segmap_parloop_236491;
    futhark_mc_segmap_parloop_236491_task.args =
        &futhark_mc_segmap_parloop_struct_236490;
    futhark_mc_segmap_parloop_236491_task.iterations = iterations;
    futhark_mc_segmap_parloop_236491_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236491_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236491_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236491_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236491_task);
    
    if (futhark_mc_segmap_parloop_236491_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236491_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236491_total_end -
                 futhark_mc_segmap_parloop_236491_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236491_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236491_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236491_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236489_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236489_end -
                 futhark_mc_segmap_nested_task_236489_start;
        
        ctx->futhark_mc_segmap_nested_task_236489_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236489_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236489_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236469(void *args, int64_t start,
                                            int64_t end, int flat_tid_215003,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236468
    *futhark_mc_segmap_parloop_struct_236468 =
    (struct futhark_mc_segmap_parloop_struct_236468 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236468->ctx;
    uint64_t futhark_mc_segmap_parloop_236469_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236469_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236468->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236468->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236468->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236468->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236468->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236468->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236468->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236468->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236468->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236468->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236468->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236468->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 =
            futhark_mc_segmap_parloop_struct_236468->free_bytes_220212;
    struct memblock mem_220361 = {.desc ="mem_220361", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_220361,
                                  .size =0, .references =NULL};
    struct memblock mem_220365 = {.desc ="mem_220365", .mem =
                                  futhark_mc_segmap_parloop_struct_236468->free_mem_220365,
                                  .size =0, .references =NULL};
    size_t mem_220204_cached_sizze_236470 = 0;
    unsigned char *mem_220204 = NULL;
    size_t mem_220207_cached_sizze_236471 = 0;
    unsigned char *mem_220207 = NULL;
    size_t mem_220210_cached_sizze_236472 = 0;
    unsigned char *mem_220210 = NULL;
    size_t mem_220249_cached_sizze_236473 = 0;
    unsigned char *mem_220249 = NULL;
    size_t mem_220252_cached_sizze_236474 = 0;
    unsigned char *mem_220252 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233819 = start;
    
    if (mem_220204_cached_sizze_236470 < (size_t) bytes_217302) {
        mem_220204 = realloc(mem_220204, bytes_217302);
        mem_220204_cached_sizze_236470 = bytes_217302;
    }
    if (mem_220207_cached_sizze_236471 < (size_t) bytes_217302) {
        mem_220207 = realloc(mem_220207, bytes_217302);
        mem_220207_cached_sizze_236471 = bytes_217302;
    }
    if (mem_220210_cached_sizze_236472 < (size_t) bytes_217302) {
        mem_220210 = realloc(mem_220210, bytes_217302);
        mem_220210_cached_sizze_236472 = bytes_217302;
    }
    if (mem_220249_cached_sizze_236473 < (size_t) bytes_217782) {
        mem_220249 = realloc(mem_220249, bytes_217782);
        mem_220249_cached_sizze_236473 = bytes_217782;
    }
    if (mem_220252_cached_sizze_236474 < (size_t) bytes_217782) {
        mem_220252 = realloc(mem_220252, bytes_217782);
        mem_220252_cached_sizze_236474 = bytes_217782;
    }
    for (; iter_233819 < end; iter_233819++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233992 = partition_sizze_203577;
        int64_t gtid_215004 = iter_233819;
        int64_t remnant_233993 = iter_233819 - gtid_215004;
        int64_t x_215009;
        
        x_215009 = ((int64_t *) mem_217343.mem)[gtid_215004];
        
        int64_t flat_tid_233820 = (int64_t) 0;
        int32_t num_tasks_233994;
        struct futhark_mc_task_236475 futhark_mc_task_236475;
        
        futhark_mc_task_236475.ctx = ctx;
        futhark_mc_task_236475.free_n_203490 = n_203490;
        futhark_mc_task_236475.free_gtid_215004 = gtid_215004;
        futhark_mc_task_236475.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236475.free_mem_219808 = mem_219808.mem;
        futhark_mc_task_236475.free_mem_220204 = mem_220204;
        
        struct scheduler_segop futhark_mc_task_236475_task;
        
        futhark_mc_task_236475_task.args = &futhark_mc_task_236475;
        futhark_mc_task_236475_task.top_level_fn =
            futhark_mc_segmap_task_236476;
        futhark_mc_task_236475_task.name = "futhark_mc_segmap_task_236476";
        futhark_mc_task_236475_task.iterations = n_203490;
        futhark_mc_task_236475_task.task_time =
            &ctx->futhark_mc_segmap_task_236476_total_time;
        futhark_mc_task_236475_task.task_iter =
            &ctx->futhark_mc_segmap_task_236476_total_iter;
        futhark_mc_task_236475_task.sched = STATIC;
        futhark_mc_task_236475_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236476_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236475_task);
        
        if (futhark_mc_segmap_task_236476_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233825 = (int64_t) 0;
        int32_t num_tasks_233998;
        struct futhark_mc_task_236479 futhark_mc_task_236479;
        
        futhark_mc_task_236479.ctx = ctx;
        futhark_mc_task_236479.free_n_203490 = n_203490;
        futhark_mc_task_236479.free_gtid_215004 = gtid_215004;
        futhark_mc_task_236479.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236479.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236479.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236479.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236479.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236479.free_mem_220204 = mem_220204;
        futhark_mc_task_236479.free_mem_220207 = mem_220207;
        futhark_mc_task_236479.free_mem_220210 = mem_220210;
        
        struct scheduler_segop futhark_mc_task_236479_task;
        
        futhark_mc_task_236479_task.args = &futhark_mc_task_236479;
        futhark_mc_task_236479_task.top_level_fn =
            futhark_mc_segmap_task_236480;
        futhark_mc_task_236479_task.name = "futhark_mc_segmap_task_236480";
        futhark_mc_task_236479_task.iterations = n_203490;
        futhark_mc_task_236479_task.task_time =
            &ctx->futhark_mc_segmap_task_236480_total_time;
        futhark_mc_task_236479_task.task_iter =
            &ctx->futhark_mc_segmap_task_236480_total_iter;
        futhark_mc_task_236479_task.sched = STATIC;
        futhark_mc_task_236479_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236480_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236479_task);
        
        if (futhark_mc_segmap_task_236480_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233916 = (int64_t) 0;
        int32_t num_tasks_234010;
        int64_t flat_tid_233839 = (int64_t) 0;
        struct futhark_mc_task_236483 futhark_mc_task_236483;
        
        futhark_mc_task_236483.ctx = ctx;
        futhark_mc_task_236483.free_n_203490 = n_203490;
        futhark_mc_task_236483.free_q_t_203494 = q_t_203494;
        futhark_mc_task_236483.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236483.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_236483.free_i_203670 = i_203670;
        futhark_mc_task_236483.free_gtid_215004 = gtid_215004;
        futhark_mc_task_236483.free_x_215009 = x_215009;
        futhark_mc_task_236483.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236483.free_mem_217835 = mem_217835.mem;
        futhark_mc_task_236483.free_mem_217839 = mem_217839.mem;
        futhark_mc_task_236483.free_mem_220207 = mem_220207;
        futhark_mc_task_236483.free_mem_220210 = mem_220210;
        futhark_mc_task_236483.free_bytes_220212 = bytes_220212;
        futhark_mc_task_236483.free_mem_220249 = mem_220249;
        futhark_mc_task_236483.free_mem_220252 = mem_220252;
        
        struct scheduler_segop futhark_mc_task_236483_task;
        
        futhark_mc_task_236483_task.args = &futhark_mc_task_236483;
        futhark_mc_task_236483_task.top_level_fn =
            futhark_mc_segmap_task_236484;
        futhark_mc_task_236483_task.name = "futhark_mc_segmap_task_236484";
        futhark_mc_task_236483_task.iterations = t_n_m_203650;
        futhark_mc_task_236483_task.task_time =
            &ctx->futhark_mc_segmap_task_236484_total_time;
        futhark_mc_task_236483_task.task_iter =
            &ctx->futhark_mc_segmap_task_236484_total_iter;
        futhark_mc_task_236483_task.sched = STATIC;
        futhark_mc_task_236483_task.nested_fn =
            futhark_mc_segmap_nested_task_236489;
        
        int futhark_mc_segmap_task_236484_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236483_task);
        
        if (futhark_mc_segmap_task_236484_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220361.mem + gtid_215004 * t_n_m_203650 * (int64_t) 8,
                    mem_220249 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220365.mem + gtid_215004 * t_n_m_203650 * (int64_t) 8,
                    mem_220252 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220204);
    free(mem_220207);
    free(mem_220210);
    free(mem_220249);
    free(mem_220252);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236469_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236469_end -
                 futhark_mc_segmap_parloop_236469_start;
        
        ctx->futhark_mc_segmap_parloop_236469_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236469_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236469_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236467(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215003 = tid;
    int num_tasks_233703 = info.nsubtasks;
    struct futhark_mc_task_236456 *futhark_mc_task_236456 =
                                  (struct futhark_mc_task_236456 *) args;
    struct futhark_context *ctx = futhark_mc_task_236456->ctx;
    uint64_t futhark_mc_segmap_nested_task_236467_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236467_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236456->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236456->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236456->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236456->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236456->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236456->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236456->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236456->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236456->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236456->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236456->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236456->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236456->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236456->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236456->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236456->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236456->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236456->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220212 = futhark_mc_task_236456->free_bytes_220212;
    struct memblock mem_220361 = {.desc ="mem_220361", .mem =
                                  futhark_mc_task_236456->free_mem_220361,
                                  .size =0, .references =NULL};
    struct memblock mem_220365 = {.desc ="mem_220365", .mem =
                                  futhark_mc_task_236456->free_mem_220365,
                                  .size =0, .references =NULL};
    int64_t iter_233819;
    struct futhark_mc_segmap_parloop_struct_236468
    futhark_mc_segmap_parloop_struct_236468;
    
    futhark_mc_segmap_parloop_struct_236468.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236468.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236468.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236468.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236468.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236468.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236468.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236468.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236468.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236468.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236468.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236468.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236468.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236468.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236468.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236468.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236468.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236468.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236468.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236468.free_bytes_220212 = bytes_220212;
    futhark_mc_segmap_parloop_struct_236468.free_mem_220361 = mem_220361.mem;
    futhark_mc_segmap_parloop_struct_236468.free_mem_220365 = mem_220365.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236469_task;
    
    futhark_mc_segmap_parloop_236469_task.name =
        "futhark_mc_segmap_parloop_236469";
    futhark_mc_segmap_parloop_236469_task.fn = futhark_mc_segmap_parloop_236469;
    futhark_mc_segmap_parloop_236469_task.args =
        &futhark_mc_segmap_parloop_struct_236468;
    futhark_mc_segmap_parloop_236469_task.iterations = iterations;
    futhark_mc_segmap_parloop_236469_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236469_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236469_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236469_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236469_task);
    
    if (futhark_mc_segmap_parloop_236469_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236469_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236469_total_end -
                 futhark_mc_segmap_parloop_236469_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236469_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236469_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236469_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236467_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236467_end -
                 futhark_mc_segmap_nested_task_236467_start;
        
        ctx->futhark_mc_segmap_nested_task_236467_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236467_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236467_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236507 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220376;
    unsigned char *free_mem_220591;
    unsigned char *free_mem_220595;
};
struct futhark_mc_segmap_parloop_struct_236509 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220376;
    unsigned char *free_mem_220591;
    unsigned char *free_mem_220595;
};
static int futhark_mc_segmap_parloop_236510(void *args, int64_t start,
                                            int64_t end, int flat_tid_215188,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236509
    *futhark_mc_segmap_parloop_struct_236509 =
    (struct futhark_mc_segmap_parloop_struct_236509 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236509->ctx;
    uint64_t futhark_mc_segmap_parloop_236510_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236510_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236509->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236509->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236509->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236509->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236509->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236509->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236509->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236509->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236509->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236509->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236509->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236509->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 =
            futhark_mc_segmap_parloop_struct_236509->free_bytes_220376;
    struct memblock mem_220591 = {.desc ="mem_220591", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_220591,
                                  .size =0, .references =NULL};
    struct memblock mem_220595 = {.desc ="mem_220595", .mem =
                                  futhark_mc_segmap_parloop_struct_236509->free_mem_220595,
                                  .size =0, .references =NULL};
    size_t mem_220455_cached_sizze_236511 = 0;
    unsigned char *mem_220455 = NULL;
    size_t mem_220470_cached_sizze_236512 = 0;
    unsigned char *mem_220470 = NULL;
    size_t mem_220473_cached_sizze_236513 = 0;
    unsigned char *mem_220473 = NULL;
    size_t mem_220500_cached_sizze_236514 = 0;
    unsigned char *mem_220500 = NULL;
    size_t mem_220503_cached_sizze_236515 = 0;
    unsigned char *mem_220503 = NULL;
    size_t mem_220520_cached_sizze_236516 = 0;
    unsigned char *mem_220520 = NULL;
    size_t mem_220523_cached_sizze_236517 = 0;
    unsigned char *mem_220523 = NULL;
    size_t mem_220550_cached_sizze_236518 = 0;
    unsigned char *mem_220550 = NULL;
    size_t mem_220553_cached_sizze_236519 = 0;
    unsigned char *mem_220553 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234164 = start;
    
    if (mem_220455_cached_sizze_236511 < (size_t) bytes_217302) {
        mem_220455 = realloc(mem_220455, bytes_217302);
        mem_220455_cached_sizze_236511 = bytes_217302;
    }
    if (mem_220470_cached_sizze_236512 < (size_t) bytes_217302) {
        mem_220470 = realloc(mem_220470, bytes_217302);
        mem_220470_cached_sizze_236512 = bytes_217302;
    }
    if (mem_220473_cached_sizze_236513 < (size_t) bytes_217302) {
        mem_220473 = realloc(mem_220473, bytes_217302);
        mem_220473_cached_sizze_236513 = bytes_217302;
    }
    if (mem_220500_cached_sizze_236514 < (size_t) bytes_217782) {
        mem_220500 = realloc(mem_220500, bytes_217782);
        mem_220500_cached_sizze_236514 = bytes_217782;
    }
    if (mem_220503_cached_sizze_236515 < (size_t) bytes_217782) {
        mem_220503 = realloc(mem_220503, bytes_217782);
        mem_220503_cached_sizze_236515 = bytes_217782;
    }
    if (mem_220520_cached_sizze_236516 < (size_t) bytes_220376) {
        mem_220520 = realloc(mem_220520, bytes_220376);
        mem_220520_cached_sizze_236516 = bytes_220376;
    }
    if (mem_220523_cached_sizze_236517 < (size_t) bytes_220376) {
        mem_220523 = realloc(mem_220523, bytes_220376);
        mem_220523_cached_sizze_236517 = bytes_220376;
    }
    if (mem_220550_cached_sizze_236518 < (size_t) bytes_220376) {
        mem_220550 = realloc(mem_220550, bytes_220376);
        mem_220550_cached_sizze_236518 = bytes_220376;
    }
    if (mem_220553_cached_sizze_236519 < (size_t) bytes_220376) {
        mem_220553 = realloc(mem_220553, bytes_220376);
        mem_220553_cached_sizze_236519 = bytes_220376;
    }
    for (; iter_234164 < end; iter_234164++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234306 = partition_sizze_203577;
        int64_t gtid_215189 = iter_234164;
        int64_t remnant_234307 = iter_234164 - gtid_215189;
        int64_t x_206433;
        
        x_206433 = ((int64_t *) mem_217343.mem)[gtid_215189];
        for (int64_t i_234165 = 0; i_234165 < n_203490; i_234165++) {
            double x_234167;
            
            x_234167 = ((double *) mem_217297.mem)[gtid_215189 * n_203490 +
                                                   i_234165];
            
            double x_234168;
            
            x_234168 = ((double *) mem_219808.mem)[gtid_215189 * n_203490 +
                                                   i_234165];
            
            double defunc_1_f_res_234169 = x_234167 - x_234168;
            
            ((double *) mem_220455)[i_234165] = defunc_1_f_res_234169;
        }
        for (int64_t i_234171 = 0; i_234171 < n_203490; i_234171++) {
            int64_t x_234174;
            
            x_234174 = ((int64_t *) mem_217340.mem)[gtid_215189 * n_203490 +
                                                    i_234171];
            
            bool cond_234175 = sle64((int64_t) 0, x_234174);
            double defunc_0_f_res_234176;
            
            if (cond_234175) {
                bool y_234177 = slt64(x_234174, n_203490);
                bool bounds_check_234178 = cond_234175 && y_234177;
                bool index_certs_234179;
                
                if (!bounds_check_234178) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_234174,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_234180;
                
                defunc_0_f_res_t_res_234180 = ((double *) mem_220455)[x_234174];
                defunc_0_f_res_234176 = defunc_0_f_res_t_res_234180;
            } else {
                defunc_0_f_res_234176 = 0.0;
            }
            
            double defunc_0_f_res_234181;
            
            if (cond_234175) {
                bool y_234182 = slt64(x_234174, n_203490);
                bool bounds_check_234183 = cond_234175 && y_234182;
                bool index_certs_234184;
                
                if (!bounds_check_234183) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_234174,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_234185;
                
                defunc_0_f_res_t_res_234185 =
                    ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                      (gtid_215189 *
                                                       ctx_param_ext_217867 +
                                                       x_234174 *
                                                       ctx_param_ext_217869)];
                defunc_0_f_res_234181 = defunc_0_f_res_t_res_234185;
            } else {
                defunc_0_f_res_234181 = 0.0;
            }
            ((double *) mem_220470)[i_234171] = defunc_0_f_res_234181;
            ((double *) mem_220473)[i_234171] = defunc_0_f_res_234176;
        }
        for (int64_t i_234188 = 0; i_234188 < t_n_m_203650; i_234188++) {
            int64_t x_234191;
            
            x_234191 = ((int64_t *) mem_217835.mem)[gtid_215189 * t_n_m_203650 +
                                                    i_234188];
            
            double x_234192;
            
            x_234192 = ((double *) mem_217839.mem)[gtid_215189 * t_n_m_203650 +
                                                   i_234188];
            
            int64_t min_arg_234193 = mul64(jump_t_203500, i_234188);
            int64_t min_res_234194 = smin64(i_203670, min_arg_234193);
            int64_t defunc_0_g_res_234195 = add64((int64_t) 1, min_res_234194);
            
            for (int64_t i_234200 = 0; i_234200 < q_t_203494; i_234200++) {
                bool cond_234203 = sle64(x_206433, i_234200);
                int64_t defunc_0_f_res_234204;
                
                if (cond_234203) {
                    defunc_0_f_res_234204 = (int64_t) 0;
                } else {
                    int64_t i_234205 = add64(x_234191, i_234200);
                    int64_t defunc_0_add_arg_234206;
                    
                    defunc_0_add_arg_234206 =
                        ((int64_t *) mem_217340.mem)[gtid_215189 * n_203490 +
                                                     i_234205];
                    
                    int64_t defunc_1_add_res_234207 = add64((int64_t) 1,
                                                            defunc_0_add_arg_234206);
                    
                    defunc_0_f_res_234204 = defunc_1_add_res_234207;
                }
                
                double defunc_0_f_res_234208;
                
                if (cond_234203) {
                    defunc_0_f_res_234208 = 0.0;
                } else {
                    int64_t i_234209 = add64(x_234191, i_234200);
                    double defunc_0_add_arg_234210;
                    
                    defunc_0_add_arg_234210 = ((double *) mem_220470)[i_234209];
                    defunc_0_f_res_234208 = defunc_0_add_arg_234210;
                }
                
                int64_t binop_p_234211 = sub64(defunc_0_f_res_234204,
                                               defunc_0_g_res_234195);
                double defunc_0_f_res_234212 = sitofp_i64_f64(binop_p_234211);
                double abs_res_234213 = fabs(defunc_0_f_res_234212);
                double tmp1_234214 = abs_res_234213 / x_234192;
                double x_234215 = tmp1_234214 * tmp1_234214;
                double y_234216 = tmp1_234214 * x_234215;
                double tmp2_234217 = 1.0 - y_234216;
                double x_234218 = tmp2_234217 * tmp2_234217;
                double tmp3_234219 = tmp2_234217 * x_234218;
                double tmp4_234220 = defunc_0_f_res_234208 * tmp3_234219;
                
                ((double *) mem_220520)[i_234200] = defunc_0_f_res_234212;
                ((double *) mem_220523)[i_234200] = tmp4_234220;
            }
            
            double defunc_2_reduce_res_234225;
            double defunc_2_reduce_res_234226;
            double defunc_2_reduce_res_234227;
            double defunc_2_reduce_res_234228;
            double defunc_2_reduce_res_234229;
            double redout_234233;
            double redout_234234;
            double redout_234235;
            double redout_234236;
            double redout_234237;
            
            redout_234233 = 0.0;
            redout_234234 = 0.0;
            redout_234235 = 0.0;
            redout_234236 = 0.0;
            redout_234237 = 0.0;
            for (int64_t i_234232 = 0; i_234232 < q_t_203494; i_234232++) {
                double x_234240;
                
                x_234240 = ((double *) mem_220520)[i_234232];
                
                double x_234241;
                
                x_234241 = ((double *) mem_220523)[i_234232];
                
                double defunc_1_f_res_234242 = x_234240 * x_234241;
                double defunc_1_f_res_234243 = x_234240 * defunc_1_f_res_234242;
                double defunc_1_f_res_234244 = x_234240 * defunc_1_f_res_234243;
                double defunc_1_f_res_234245 = x_234240 * defunc_1_f_res_234244;
                double defunc_1_op_res_234246 = x_234241 + redout_234233;
                double defunc_1_op_res_234247 = defunc_1_f_res_234242 +
                       redout_234234;
                double defunc_1_op_res_234248 = defunc_1_f_res_234243 +
                       redout_234235;
                double defunc_1_op_res_234249 = defunc_1_f_res_234244 +
                       redout_234236;
                double defunc_1_op_res_234250 = defunc_1_f_res_234245 +
                       redout_234237;
                
                ((double *) mem_220550)[i_234232] = defunc_1_f_res_234243;
                ((double *) mem_220553)[i_234232] = defunc_1_f_res_234242;
                
                double redout_tmp_234315 = defunc_1_op_res_234246;
                double redout_tmp_234316 = defunc_1_op_res_234247;
                double redout_tmp_234317 = defunc_1_op_res_234248;
                double redout_tmp_234318 = defunc_1_op_res_234249;
                double redout_tmp_234319 = defunc_1_op_res_234250;
                
                redout_234233 = redout_tmp_234315;
                redout_234234 = redout_tmp_234316;
                redout_234235 = redout_tmp_234317;
                redout_234236 = redout_tmp_234318;
                redout_234237 = redout_tmp_234319;
            }
            defunc_2_reduce_res_234225 = redout_234233;
            defunc_2_reduce_res_234226 = redout_234234;
            defunc_2_reduce_res_234227 = redout_234235;
            defunc_2_reduce_res_234228 = redout_234236;
            defunc_2_reduce_res_234229 = redout_234237;
            
            double x_234253 = defunc_2_reduce_res_234227 *
                   defunc_2_reduce_res_234229;
            double y_234254 = defunc_2_reduce_res_234228 *
                   defunc_2_reduce_res_234228;
            double a12_234255 = x_234253 - y_234254;
            double x_234256 = defunc_2_reduce_res_234227 *
                   defunc_2_reduce_res_234228;
            double y_234257 = defunc_2_reduce_res_234226 *
                   defunc_2_reduce_res_234229;
            double b12_234258 = x_234256 - y_234257;
            double x_234259 = defunc_2_reduce_res_234226 *
                   defunc_2_reduce_res_234228;
            double y_234260 = defunc_2_reduce_res_234227 *
                   defunc_2_reduce_res_234227;
            double c12_234261 = x_234259 - y_234260;
            double x_234262 = defunc_2_reduce_res_234225 *
                   defunc_2_reduce_res_234229;
            double b2_234263 = x_234262 - y_234260;
            double x_234264 = defunc_2_reduce_res_234226 *
                   defunc_2_reduce_res_234227;
            double y_234265 = defunc_2_reduce_res_234225 *
                   defunc_2_reduce_res_234228;
            double c2_234266 = x_234264 - y_234265;
            double x_234267 = defunc_2_reduce_res_234225 * a12_234255;
            double y_234268 = defunc_2_reduce_res_234226 * b12_234258;
            double x_234269 = x_234267 + y_234268;
            double y_234270 = defunc_2_reduce_res_234227 * c12_234261;
            double y_234271 = x_234269 + y_234270;
            double det_234272 = 1.0 / y_234271;
            double a12_234273 = a12_234255 * det_234272;
            double b12_234274 = b12_234258 * det_234272;
            double c12_234275 = c12_234261 * det_234272;
            double b2_234276 = b2_234263 * det_234272;
            double c2_234277 = c2_234266 * det_234272;
            double defunc_2_reduce_res_234278;
            double defunc_2_reduce_res_234279;
            double redout_234281;
            double redout_234282;
            
            redout_234281 = 0.0;
            redout_234282 = 0.0;
            for (int64_t i_234280 = 0; i_234280 < q_t_203494; i_234280++) {
                double x_234283;
                
                x_234283 = ((double *) mem_220523)[i_234280];
                
                double x_234284;
                
                x_234284 = ((double *) mem_220553)[i_234280];
                
                double x_234285;
                
                x_234285 = ((double *) mem_220550)[i_234280];
                
                bool cond_234286 = sle64(x_206433, i_234280);
                double defunc_0_f_res_234287;
                
                if (cond_234286) {
                    defunc_0_f_res_234287 = 0.0;
                } else {
                    int64_t i_234288 = add64(x_234191, i_234280);
                    double defunc_0_add_arg_234289;
                    
                    defunc_0_add_arg_234289 = ((double *) mem_220473)[i_234288];
                    defunc_0_f_res_234287 = defunc_0_add_arg_234289;
                }
                
                double x_234290 = a12_234273 * x_234283;
                double y_234291 = b12_234274 * x_234284;
                double x_234292 = x_234290 + y_234291;
                double y_234293 = c12_234275 * x_234285;
                double x_234294 = x_234292 + y_234293;
                double defunc_9_fit_fun_res_234295 = defunc_0_f_res_234287 *
                       x_234294;
                double x_234296 = b12_234274 * x_234283;
                double y_234297 = b2_234276 * x_234284;
                double x_234298 = x_234296 + y_234297;
                double y_234299 = c2_234277 * x_234285;
                double x_234300 = x_234298 + y_234299;
                double defunc_9_slope_fun_res_234301 = defunc_0_f_res_234287 *
                       x_234300;
                double defunc_1_op_res_234302 = defunc_9_fit_fun_res_234295 +
                       redout_234281;
                double defunc_1_op_res_234303 = defunc_9_slope_fun_res_234301 +
                       redout_234282;
                double redout_tmp_234322 = defunc_1_op_res_234302;
                double redout_tmp_234323 = defunc_1_op_res_234303;
                
                redout_234281 = redout_tmp_234322;
                redout_234282 = redout_tmp_234323;
            }
            defunc_2_reduce_res_234278 = redout_234281;
            defunc_2_reduce_res_234279 = redout_234282;
            ((double *) mem_220500)[i_234188] = defunc_2_reduce_res_234278;
            ((double *) mem_220503)[i_234188] = defunc_2_reduce_res_234279;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220591.mem + gtid_215189 * t_n_m_203650 * (int64_t) 8,
                    mem_220500 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220595.mem + gtid_215189 * t_n_m_203650 * (int64_t) 8,
                    mem_220503 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220455);
    free(mem_220470);
    free(mem_220473);
    free(mem_220500);
    free(mem_220503);
    free(mem_220520);
    free(mem_220523);
    free(mem_220550);
    free(mem_220553);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236510_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236510_end -
                 futhark_mc_segmap_parloop_236510_start;
        
        ctx->futhark_mc_segmap_parloop_236510_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236510_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236510_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236508(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215188 = tid;
    int num_tasks_234163 = info.nsubtasks;
    struct futhark_mc_task_236507 *futhark_mc_task_236507 =
                                  (struct futhark_mc_task_236507 *) args;
    struct futhark_context *ctx = futhark_mc_task_236507->ctx;
    uint64_t futhark_mc_segmap_task_236508_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236508_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236507->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236507->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236507->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236507->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236507->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236507->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236507->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236507->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236507->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236507->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236507->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236507->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236507->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236507->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236507->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236507->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236507->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236507->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 = futhark_mc_task_236507->free_bytes_220376;
    struct memblock mem_220591 = {.desc ="mem_220591", .mem =
                                  futhark_mc_task_236507->free_mem_220591,
                                  .size =0, .references =NULL};
    struct memblock mem_220595 = {.desc ="mem_220595", .mem =
                                  futhark_mc_task_236507->free_mem_220595,
                                  .size =0, .references =NULL};
    int64_t iter_234164;
    struct futhark_mc_segmap_parloop_struct_236509
    futhark_mc_segmap_parloop_struct_236509;
    
    futhark_mc_segmap_parloop_struct_236509.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236509.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236509.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236509.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236509.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236509.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236509.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236509.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236509.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236509.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236509.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236509.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236509.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236509.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236509.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236509.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236509.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236509.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236509.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236509.free_bytes_220376 = bytes_220376;
    futhark_mc_segmap_parloop_struct_236509.free_mem_220591 = mem_220591.mem;
    futhark_mc_segmap_parloop_struct_236509.free_mem_220595 = mem_220595.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236510_task;
    
    futhark_mc_segmap_parloop_236510_task.name =
        "futhark_mc_segmap_parloop_236510";
    futhark_mc_segmap_parloop_236510_task.fn = futhark_mc_segmap_parloop_236510;
    futhark_mc_segmap_parloop_236510_task.args =
        &futhark_mc_segmap_parloop_struct_236509;
    futhark_mc_segmap_parloop_236510_task.iterations = iterations;
    futhark_mc_segmap_parloop_236510_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236510_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236510_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236510_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236510_task);
    
    if (futhark_mc_segmap_parloop_236510_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236510_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236510_total_end -
                 futhark_mc_segmap_parloop_236510_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236510_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236510_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236510_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236508_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236508_end -
                 futhark_mc_segmap_task_236508_start;
        
        ctx->futhark_mc_segmap_task_236508_runs[tid]++;
        ctx->futhark_mc_segmap_task_236508_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236508_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236521 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217343;
    int64_t free_bytes_217782;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_219808;
    int64_t free_bytes_220376;
    unsigned char *free_mem_220591;
    unsigned char *free_mem_220595;
};
struct futhark_mc_task_236528 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215323;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220368;
};
struct futhark_mc_segmap_parloop_struct_236530 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215323;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_219808;
    unsigned char *free_mem_220368;
};
static int futhark_mc_segmap_parloop_236531(void *args, int64_t start,
                                            int64_t end, int flat_tid_234325,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236530
    *futhark_mc_segmap_parloop_struct_236530 =
    (struct futhark_mc_segmap_parloop_struct_236530 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236530->ctx;
    uint64_t futhark_mc_segmap_parloop_236531_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236531_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236530->free_n_203490;
    int64_t gtid_215323 =
            futhark_mc_segmap_parloop_struct_236530->free_gtid_215323;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236530->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236530->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220368 = {.desc ="mem_220368", .mem =
                                  futhark_mc_segmap_parloop_struct_236530->free_mem_220368,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234583 = start;
    
    for (; iter_234583 < end; iter_234583++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234584 = n_203490;
        int64_t gtid_234326 = iter_234583;
        int64_t remnant_234585 = iter_234583 - gtid_234326;
        double x_234327;
        
        x_234327 = ((double *) mem_217297.mem)[gtid_215323 * n_203490 +
                                               gtid_234326];
        
        double x_234328;
        
        x_234328 = ((double *) mem_219808.mem)[gtid_215323 * n_203490 +
                                               gtid_234326];
        
        double defunc_1_f_res_234329 = x_234327 - x_234328;
        
        ((double *) mem_220368.mem)[gtid_234326] = defunc_1_f_res_234329;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236531_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236531_end -
                 futhark_mc_segmap_parloop_236531_start;
        
        ctx->futhark_mc_segmap_parloop_236531_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236531_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236531_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236529(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234325 = tid;
    int num_tasks_234582 = info.nsubtasks;
    struct futhark_mc_task_236528 *futhark_mc_task_236528 =
                                  (struct futhark_mc_task_236528 *) args;
    struct futhark_context *ctx = futhark_mc_task_236528->ctx;
    uint64_t futhark_mc_segmap_task_236529_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236529_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236528->free_n_203490;
    int64_t gtid_215323 = futhark_mc_task_236528->free_gtid_215323;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236528->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236528->free_mem_219808,
                                  .size =0, .references =NULL};
    struct memblock mem_220368 = {.desc ="mem_220368", .mem =
                                  futhark_mc_task_236528->free_mem_220368,
                                  .size =0, .references =NULL};
    int64_t iter_234583;
    struct futhark_mc_segmap_parloop_struct_236530
    futhark_mc_segmap_parloop_struct_236530;
    
    futhark_mc_segmap_parloop_struct_236530.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236530.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236530.free_gtid_215323 = gtid_215323;
    futhark_mc_segmap_parloop_struct_236530.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236530.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236530.free_mem_220368 = mem_220368.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236531_task;
    
    futhark_mc_segmap_parloop_236531_task.name =
        "futhark_mc_segmap_parloop_236531";
    futhark_mc_segmap_parloop_236531_task.fn = futhark_mc_segmap_parloop_236531;
    futhark_mc_segmap_parloop_236531_task.args =
        &futhark_mc_segmap_parloop_struct_236530;
    futhark_mc_segmap_parloop_236531_task.iterations = iterations;
    futhark_mc_segmap_parloop_236531_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236531_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236531_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236531_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236531_task);
    
    if (futhark_mc_segmap_parloop_236531_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236531_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236531_total_end -
                 futhark_mc_segmap_parloop_236531_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236531_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236531_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236531_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236529_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236529_end -
                 futhark_mc_segmap_task_236529_start;
        
        ctx->futhark_mc_segmap_task_236529_runs[tid]++;
        ctx->futhark_mc_segmap_task_236529_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236529_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236532 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215323;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_220368;
    unsigned char *free_mem_220371;
    unsigned char *free_mem_220374;
};
struct futhark_mc_segmap_parloop_struct_236534 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215323;
    unsigned char *free_mem_217340;
    int64_t free_ctx_param_ext_217866;
    int64_t free_ctx_param_ext_217867;
    int64_t free_ctx_param_ext_217869;
    unsigned char *free_mem_param_217871;
    unsigned char *free_mem_220368;
    unsigned char *free_mem_220371;
    unsigned char *free_mem_220374;
};
static int futhark_mc_segmap_parloop_236535(void *args, int64_t start,
                                            int64_t end, int flat_tid_234330,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236534
    *futhark_mc_segmap_parloop_struct_236534 =
    (struct futhark_mc_segmap_parloop_struct_236534 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236534->ctx;
    uint64_t futhark_mc_segmap_parloop_236535_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236535_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236534->free_n_203490;
    int64_t gtid_215323 =
            futhark_mc_segmap_parloop_struct_236534->free_gtid_215323;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236534->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236534->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236534->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236534->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236534->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_220368 = {.desc ="mem_220368", .mem =
                                  futhark_mc_segmap_parloop_struct_236534->free_mem_220368,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_segmap_parloop_struct_236534->free_mem_220371,
                                  .size =0, .references =NULL};
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_segmap_parloop_struct_236534->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234587 = start;
    
    for (; iter_234587 < end; iter_234587++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234596 = n_203490;
        int64_t gtid_234331 = iter_234587;
        int64_t remnant_234597 = iter_234587 - gtid_234331;
        int64_t x_234332;
        
        x_234332 = ((int64_t *) mem_217340.mem)[gtid_215323 * n_203490 +
                                                gtid_234331];
        
        bool cond_234333 = sle64((int64_t) 0, x_234332);
        double defunc_0_f_res_234334;
        
        if (cond_234333) {
            bool y_234588 = slt64(x_234332, n_203490);
            bool bounds_check_234589 = cond_234333 && y_234588;
            bool index_certs_234590;
            
            if (!bounds_check_234589) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_234332,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:281:33-58\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_234591;
            
            defunc_0_f_res_t_res_234591 = ((double *) mem_220368.mem)[x_234332];
            defunc_0_f_res_234334 = defunc_0_f_res_t_res_234591;
        } else {
            defunc_0_f_res_234334 = 0.0;
        }
        
        double defunc_0_f_res_234339;
        
        if (cond_234333) {
            bool y_234592 = slt64(x_234332, n_203490);
            bool bounds_check_234593 = cond_234333 && y_234592;
            bool index_certs_234594;
            
            if (!bounds_check_234593) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_234332,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:42:43-70\n   #3  stl.fut:282:33-64\n   #4  /prelude/soacs.fut:75:22-28\n   #5  /prelude/soacs.fut:75:3-45\n   #6  stl.fut:279:13-284:41\n   #7  stl.fut:415:61-429:75\n   #8  stl.fut:455:3-469:34\n   #9  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_234595;
            
            defunc_0_f_res_t_res_234595 =
                ((double *) mem_param_217871.mem)[ctx_param_ext_217866 +
                                                  (gtid_215323 *
                                                   ctx_param_ext_217867 +
                                                   x_234332 *
                                                   ctx_param_ext_217869)];
            defunc_0_f_res_234339 = defunc_0_f_res_t_res_234595;
        } else {
            defunc_0_f_res_234339 = 0.0;
        }
        ((double *) mem_220371.mem)[gtid_234331] = defunc_0_f_res_234339;
        ((double *) mem_220374.mem)[gtid_234331] = defunc_0_f_res_234334;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236535_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236535_end -
                 futhark_mc_segmap_parloop_236535_start;
        
        ctx->futhark_mc_segmap_parloop_236535_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236535_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236535_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236533(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234330 = tid;
    int num_tasks_234586 = info.nsubtasks;
    struct futhark_mc_task_236532 *futhark_mc_task_236532 =
                                  (struct futhark_mc_task_236532 *) args;
    struct futhark_context *ctx = futhark_mc_task_236532->ctx;
    uint64_t futhark_mc_segmap_task_236533_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236533_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236532->free_n_203490;
    int64_t gtid_215323 = futhark_mc_task_236532->free_gtid_215323;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236532->free_mem_217340,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236532->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236532->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236532->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236532->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_220368 = {.desc ="mem_220368", .mem =
                                  futhark_mc_task_236532->free_mem_220368,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_task_236532->free_mem_220371,
                                  .size =0, .references =NULL};
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_task_236532->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t iter_234587;
    struct futhark_mc_segmap_parloop_struct_236534
    futhark_mc_segmap_parloop_struct_236534;
    
    futhark_mc_segmap_parloop_struct_236534.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236534.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236534.free_gtid_215323 = gtid_215323;
    futhark_mc_segmap_parloop_struct_236534.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236534.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236534.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236534.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236534.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236534.free_mem_220368 = mem_220368.mem;
    futhark_mc_segmap_parloop_struct_236534.free_mem_220371 = mem_220371.mem;
    futhark_mc_segmap_parloop_struct_236534.free_mem_220374 = mem_220374.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236535_task;
    
    futhark_mc_segmap_parloop_236535_task.name =
        "futhark_mc_segmap_parloop_236535";
    futhark_mc_segmap_parloop_236535_task.fn = futhark_mc_segmap_parloop_236535;
    futhark_mc_segmap_parloop_236535_task.args =
        &futhark_mc_segmap_parloop_struct_236534;
    futhark_mc_segmap_parloop_236535_task.iterations = iterations;
    futhark_mc_segmap_parloop_236535_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236535_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236535_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236535_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236535_task);
    
    if (futhark_mc_segmap_parloop_236535_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236535_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236535_total_end -
                 futhark_mc_segmap_parloop_236535_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236535_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236535_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236535_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236533_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236533_end -
                 futhark_mc_segmap_task_236533_start;
        
        ctx->futhark_mc_segmap_task_236533_runs[tid]++;
        ctx->futhark_mc_segmap_task_236533_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236533_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236536 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_215323;
    int64_t free_x_215328;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220371;
    unsigned char *free_mem_220374;
    int64_t free_bytes_220376;
    unsigned char *free_mem_220449;
    unsigned char *free_mem_220452;
};
struct futhark_mc_segmap_parloop_struct_236538 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_215323;
    int64_t free_x_215328;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220371;
    unsigned char *free_mem_220374;
    int64_t free_bytes_220376;
    unsigned char *free_mem_220449;
    unsigned char *free_mem_220452;
};
static int futhark_mc_segmap_parloop_236539(void *args, int64_t start,
                                            int64_t end, int flat_tid_234461,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236538
    *futhark_mc_segmap_parloop_struct_236538 =
    (struct futhark_mc_segmap_parloop_struct_236538 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236538->ctx;
    uint64_t futhark_mc_segmap_parloop_236539_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236539_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236538->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236538->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236538->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236538->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236538->free_i_203670;
    int64_t gtid_215323 =
            futhark_mc_segmap_parloop_struct_236538->free_gtid_215323;
    int64_t x_215328 = futhark_mc_segmap_parloop_struct_236538->free_x_215328;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236538->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236538->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236538->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_segmap_parloop_struct_236538->free_mem_220371,
                                  .size =0, .references =NULL};
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_segmap_parloop_struct_236538->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 =
            futhark_mc_segmap_parloop_struct_236538->free_bytes_220376;
    struct memblock mem_220449 = {.desc ="mem_220449", .mem =
                                  futhark_mc_segmap_parloop_struct_236538->free_mem_220449,
                                  .size =0, .references =NULL};
    struct memblock mem_220452 = {.desc ="mem_220452", .mem =
                                  futhark_mc_segmap_parloop_struct_236538->free_mem_220452,
                                  .size =0, .references =NULL};
    size_t mem_234468_cached_sizze_236540 = 0;
    unsigned char *mem_234468 = NULL;
    size_t mem_234470_cached_sizze_236541 = 0;
    unsigned char *mem_234470 = NULL;
    size_t mem_234497_cached_sizze_236542 = 0;
    unsigned char *mem_234497 = NULL;
    size_t mem_234499_cached_sizze_236543 = 0;
    unsigned char *mem_234499 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234599 = start;
    
    if (mem_234468_cached_sizze_236540 < (size_t) bytes_220376) {
        mem_234468 = realloc(mem_234468, bytes_220376);
        mem_234468_cached_sizze_236540 = bytes_220376;
    }
    if (mem_234470_cached_sizze_236541 < (size_t) bytes_220376) {
        mem_234470 = realloc(mem_234470, bytes_220376);
        mem_234470_cached_sizze_236541 = bytes_220376;
    }
    if (mem_234497_cached_sizze_236542 < (size_t) bytes_220376) {
        mem_234497 = realloc(mem_234497, bytes_220376);
        mem_234497_cached_sizze_236542 = bytes_220376;
    }
    if (mem_234499_cached_sizze_236543 < (size_t) bytes_220376) {
        mem_234499 = realloc(mem_234499, bytes_220376);
        mem_234499_cached_sizze_236543 = bytes_220376;
    }
    for (; iter_234599 < end; iter_234599++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234668 = t_n_m_203650;
        int64_t gtid_234462 = iter_234599;
        int64_t remnant_234669 = iter_234599 - gtid_234462;
        int64_t x_234463;
        
        x_234463 = ((int64_t *) mem_217835.mem)[gtid_215323 * t_n_m_203650 +
                                                gtid_234462];
        
        double x_234464;
        
        x_234464 = ((double *) mem_217839.mem)[gtid_215323 * t_n_m_203650 +
                                               gtid_234462];
        
        int64_t min_arg_234465 = mul64(jump_t_203500, gtid_234462);
        int64_t min_res_234466 = smin64(i_203670, min_arg_234465);
        int64_t defunc_0_g_res_234467 = add64((int64_t) 1, min_res_234466);
        
        for (int64_t i_234600 = 0; i_234600 < q_t_203494; i_234600++) {
            bool cond_234603 = sle64(x_215328, i_234600);
            int64_t defunc_0_f_res_234604;
            
            if (cond_234603) {
                defunc_0_f_res_234604 = (int64_t) 0;
            } else {
                int64_t i_234605 = add64(x_234463, i_234600);
                int64_t defunc_0_add_arg_234606;
                
                defunc_0_add_arg_234606 =
                    ((int64_t *) mem_217340.mem)[gtid_215323 * n_203490 +
                                                 i_234605];
                
                int64_t defunc_1_add_res_234607 = add64((int64_t) 1,
                                                        defunc_0_add_arg_234606);
                
                defunc_0_f_res_234604 = defunc_1_add_res_234607;
            }
            
            double defunc_0_f_res_234608;
            
            if (cond_234603) {
                defunc_0_f_res_234608 = 0.0;
            } else {
                int64_t i_234609 = add64(x_234463, i_234600);
                double defunc_0_add_arg_234610;
                
                defunc_0_add_arg_234610 = ((double *) mem_220371.mem)[i_234609];
                defunc_0_f_res_234608 = defunc_0_add_arg_234610;
            }
            
            int64_t binop_p_234611 = sub64(defunc_0_f_res_234604,
                                           defunc_0_g_res_234467);
            double defunc_0_f_res_234612 = sitofp_i64_f64(binop_p_234611);
            double abs_res_234613 = fabs(defunc_0_f_res_234612);
            double tmp1_234614 = abs_res_234613 / x_234464;
            double x_234615 = tmp1_234614 * tmp1_234614;
            double y_234616 = tmp1_234614 * x_234615;
            double tmp2_234617 = 1.0 - y_234616;
            double x_234618 = tmp2_234617 * tmp2_234617;
            double tmp3_234619 = tmp2_234617 * x_234618;
            double tmp4_234620 = defunc_0_f_res_234608 * tmp3_234619;
            
            ((double *) mem_234468)[i_234600] = defunc_0_f_res_234612;
            ((double *) mem_234470)[i_234600] = tmp4_234620;
        }
        
        double defunc_2_reduce_res_234501;
        double defunc_2_reduce_res_234502;
        double defunc_2_reduce_res_234503;
        double defunc_2_reduce_res_234504;
        double defunc_2_reduce_res_234505;
        double redout_234624;
        double redout_234625;
        double redout_234626;
        double redout_234627;
        double redout_234628;
        
        redout_234624 = 0.0;
        redout_234625 = 0.0;
        redout_234626 = 0.0;
        redout_234627 = 0.0;
        redout_234628 = 0.0;
        for (int64_t i_234623 = 0; i_234623 < q_t_203494; i_234623++) {
            double x_234631;
            
            x_234631 = ((double *) mem_234468)[i_234623];
            
            double x_234632;
            
            x_234632 = ((double *) mem_234470)[i_234623];
            
            double defunc_1_f_res_234633 = x_234631 * x_234632;
            double defunc_1_f_res_234634 = x_234631 * defunc_1_f_res_234633;
            double defunc_1_f_res_234635 = x_234631 * defunc_1_f_res_234634;
            double defunc_1_f_res_234636 = x_234631 * defunc_1_f_res_234635;
            double defunc_1_op_res_234637 = x_234632 + redout_234624;
            double defunc_1_op_res_234638 = defunc_1_f_res_234633 +
                   redout_234625;
            double defunc_1_op_res_234639 = defunc_1_f_res_234634 +
                   redout_234626;
            double defunc_1_op_res_234640 = defunc_1_f_res_234635 +
                   redout_234627;
            double defunc_1_op_res_234641 = defunc_1_f_res_234636 +
                   redout_234628;
            
            ((double *) mem_234497)[i_234623] = defunc_1_f_res_234634;
            ((double *) mem_234499)[i_234623] = defunc_1_f_res_234633;
            
            double redout_tmp_234672 = defunc_1_op_res_234637;
            double redout_tmp_234673 = defunc_1_op_res_234638;
            double redout_tmp_234674 = defunc_1_op_res_234639;
            double redout_tmp_234675 = defunc_1_op_res_234640;
            double redout_tmp_234676 = defunc_1_op_res_234641;
            
            redout_234624 = redout_tmp_234672;
            redout_234625 = redout_tmp_234673;
            redout_234626 = redout_tmp_234674;
            redout_234627 = redout_tmp_234675;
            redout_234628 = redout_tmp_234676;
        }
        defunc_2_reduce_res_234501 = redout_234624;
        defunc_2_reduce_res_234502 = redout_234625;
        defunc_2_reduce_res_234503 = redout_234626;
        defunc_2_reduce_res_234504 = redout_234627;
        defunc_2_reduce_res_234505 = redout_234628;
        
        double x_234529 = defunc_2_reduce_res_234503 *
               defunc_2_reduce_res_234505;
        double y_234530 = defunc_2_reduce_res_234504 *
               defunc_2_reduce_res_234504;
        double a12_234531 = x_234529 - y_234530;
        double x_234532 = defunc_2_reduce_res_234503 *
               defunc_2_reduce_res_234504;
        double y_234533 = defunc_2_reduce_res_234502 *
               defunc_2_reduce_res_234505;
        double b12_234534 = x_234532 - y_234533;
        double x_234535 = defunc_2_reduce_res_234502 *
               defunc_2_reduce_res_234504;
        double y_234536 = defunc_2_reduce_res_234503 *
               defunc_2_reduce_res_234503;
        double c12_234537 = x_234535 - y_234536;
        double x_234538 = defunc_2_reduce_res_234501 *
               defunc_2_reduce_res_234505;
        double b2_234539 = x_234538 - y_234536;
        double x_234540 = defunc_2_reduce_res_234502 *
               defunc_2_reduce_res_234503;
        double y_234541 = defunc_2_reduce_res_234501 *
               defunc_2_reduce_res_234504;
        double c2_234542 = x_234540 - y_234541;
        double x_234543 = defunc_2_reduce_res_234501 * a12_234531;
        double y_234544 = defunc_2_reduce_res_234502 * b12_234534;
        double x_234545 = x_234543 + y_234544;
        double y_234546 = defunc_2_reduce_res_234503 * c12_234537;
        double y_234547 = x_234545 + y_234546;
        double det_234548 = 1.0 / y_234547;
        double a12_234549 = a12_234531 * det_234548;
        double b12_234550 = b12_234534 * det_234548;
        double c12_234551 = c12_234537 * det_234548;
        double b2_234552 = b2_234539 * det_234548;
        double c2_234553 = c2_234542 * det_234548;
        double defunc_2_reduce_res_234554;
        double defunc_2_reduce_res_234555;
        double redout_234645;
        double redout_234646;
        
        redout_234645 = 0.0;
        redout_234646 = 0.0;
        for (int64_t i_234644 = 0; i_234644 < q_t_203494; i_234644++) {
            double x_234647;
            
            x_234647 = ((double *) mem_234470)[i_234644];
            
            double x_234648;
            
            x_234648 = ((double *) mem_234499)[i_234644];
            
            double x_234649;
            
            x_234649 = ((double *) mem_234497)[i_234644];
            
            bool cond_234650 = sle64(x_215328, i_234644);
            double defunc_0_f_res_234651;
            
            if (cond_234650) {
                defunc_0_f_res_234651 = 0.0;
            } else {
                int64_t i_234652 = add64(x_234463, i_234644);
                double defunc_0_add_arg_234653;
                
                defunc_0_add_arg_234653 = ((double *) mem_220374.mem)[i_234652];
                defunc_0_f_res_234651 = defunc_0_add_arg_234653;
            }
            
            double x_234654 = a12_234549 * x_234647;
            double y_234655 = b12_234550 * x_234648;
            double x_234656 = x_234654 + y_234655;
            double y_234657 = c12_234551 * x_234649;
            double x_234658 = x_234656 + y_234657;
            double defunc_9_fit_fun_res_234659 = defunc_0_f_res_234651 *
                   x_234658;
            double x_234660 = b12_234550 * x_234647;
            double y_234661 = b2_234552 * x_234648;
            double x_234662 = x_234660 + y_234661;
            double y_234663 = c2_234553 * x_234649;
            double x_234664 = x_234662 + y_234663;
            double defunc_9_slope_fun_res_234665 = defunc_0_f_res_234651 *
                   x_234664;
            double defunc_1_op_res_234666 = defunc_9_fit_fun_res_234659 +
                   redout_234645;
            double defunc_1_op_res_234667 = defunc_9_slope_fun_res_234665 +
                   redout_234646;
            double redout_tmp_234679 = defunc_1_op_res_234666;
            double redout_tmp_234680 = defunc_1_op_res_234667;
            
            redout_234645 = redout_tmp_234679;
            redout_234646 = redout_tmp_234680;
        }
        defunc_2_reduce_res_234554 = redout_234645;
        defunc_2_reduce_res_234555 = redout_234646;
        ((double *) mem_220449.mem)[gtid_234462] = defunc_2_reduce_res_234554;
        ((double *) mem_220452.mem)[gtid_234462] = defunc_2_reduce_res_234555;
    }
    
  cleanup:
    { }
    free(mem_234468);
    free(mem_234470);
    free(mem_234497);
    free(mem_234499);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236539_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236539_end -
                 futhark_mc_segmap_parloop_236539_start;
        
        ctx->futhark_mc_segmap_parloop_236539_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236539_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236539_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236537(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234461 = tid;
    int num_tasks_234598 = info.nsubtasks;
    struct futhark_mc_task_236536 *futhark_mc_task_236536 =
                                  (struct futhark_mc_task_236536 *) args;
    struct futhark_context *ctx = futhark_mc_task_236536->ctx;
    uint64_t futhark_mc_segmap_task_236537_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236537_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236536->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236536->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236536->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236536->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236536->free_i_203670;
    int64_t gtid_215323 = futhark_mc_task_236536->free_gtid_215323;
    int64_t x_215328 = futhark_mc_task_236536->free_x_215328;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236536->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236536->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236536->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_task_236536->free_mem_220371,
                                  .size =0, .references =NULL};
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_task_236536->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 = futhark_mc_task_236536->free_bytes_220376;
    struct memblock mem_220449 = {.desc ="mem_220449", .mem =
                                  futhark_mc_task_236536->free_mem_220449,
                                  .size =0, .references =NULL};
    struct memblock mem_220452 = {.desc ="mem_220452", .mem =
                                  futhark_mc_task_236536->free_mem_220452,
                                  .size =0, .references =NULL};
    int64_t iter_234599;
    struct futhark_mc_segmap_parloop_struct_236538
    futhark_mc_segmap_parloop_struct_236538;
    
    futhark_mc_segmap_parloop_struct_236538.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236538.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236538.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236538.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236538.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236538.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236538.free_gtid_215323 = gtid_215323;
    futhark_mc_segmap_parloop_struct_236538.free_x_215328 = x_215328;
    futhark_mc_segmap_parloop_struct_236538.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236538.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236538.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236538.free_mem_220371 = mem_220371.mem;
    futhark_mc_segmap_parloop_struct_236538.free_mem_220374 = mem_220374.mem;
    futhark_mc_segmap_parloop_struct_236538.free_bytes_220376 = bytes_220376;
    futhark_mc_segmap_parloop_struct_236538.free_mem_220449 = mem_220449.mem;
    futhark_mc_segmap_parloop_struct_236538.free_mem_220452 = mem_220452.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236539_task;
    
    futhark_mc_segmap_parloop_236539_task.name =
        "futhark_mc_segmap_parloop_236539";
    futhark_mc_segmap_parloop_236539_task.fn = futhark_mc_segmap_parloop_236539;
    futhark_mc_segmap_parloop_236539_task.args =
        &futhark_mc_segmap_parloop_struct_236538;
    futhark_mc_segmap_parloop_236539_task.iterations = iterations;
    futhark_mc_segmap_parloop_236539_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236539_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236539_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236539_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236539_task);
    
    if (futhark_mc_segmap_parloop_236539_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236539_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236539_total_end -
                 futhark_mc_segmap_parloop_236539_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236539_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236539_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236539_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236537_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236537_end -
                 futhark_mc_segmap_task_236537_start;
        
        ctx->futhark_mc_segmap_task_236537_runs[tid]++;
        ctx->futhark_mc_segmap_task_236537_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236537_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236545 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_gtid_215323;
    int64_t free_x_215328;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_217835;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_220371;
    unsigned char *free_mem_220374;
    int64_t free_bytes_220376;
    unsigned char *free_mem_220449;
    unsigned char *free_mem_220452;
};
struct futhark_mc_task_236551 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_gtid_215323;
    int64_t free_x_215328;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220371;
    int64_t free_x_234346;
    double free_x_234347;
    int64_t free_defunc_0_g_res_234350;
    unsigned char *free_mem_234351;
    unsigned char *free_mem_234352;
};
struct futhark_mc_segmap_parloop_struct_236553 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_q_t_203494;
    int64_t free_gtid_215323;
    int64_t free_x_215328;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220371;
    int64_t free_x_234346;
    double free_x_234347;
    int64_t free_defunc_0_g_res_234350;
    unsigned char *free_mem_234351;
    unsigned char *free_mem_234352;
};
static int futhark_mc_segmap_parloop_236554(void *args, int64_t start,
                                            int64_t end, int flat_tid_234682,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236553
    *futhark_mc_segmap_parloop_struct_236553 =
    (struct futhark_mc_segmap_parloop_struct_236553 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236553->ctx;
    uint64_t futhark_mc_segmap_parloop_236554_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236554_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236553->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236553->free_q_t_203494;
    int64_t gtid_215323 =
            futhark_mc_segmap_parloop_struct_236553->free_gtid_215323;
    int64_t x_215328 = futhark_mc_segmap_parloop_struct_236553->free_x_215328;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236553->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_segmap_parloop_struct_236553->free_mem_220371,
                                  .size =0, .references =NULL};
    int64_t x_234346 = futhark_mc_segmap_parloop_struct_236553->free_x_234346;
    double x_234347 = futhark_mc_segmap_parloop_struct_236553->free_x_234347;
    int64_t defunc_0_g_res_234350 =
            futhark_mc_segmap_parloop_struct_236553->free_defunc_0_g_res_234350;
    struct memblock mem_234351 = {.desc ="mem_234351", .mem =
                                  futhark_mc_segmap_parloop_struct_236553->free_mem_234351,
                                  .size =0, .references =NULL};
    struct memblock mem_234352 = {.desc ="mem_234352", .mem =
                                  futhark_mc_segmap_parloop_struct_236553->free_mem_234352,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234755 = start;
    
    for (; iter_234755 < end; iter_234755++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234761 = q_t_203494;
        int64_t gtid_234683 = iter_234755;
        int64_t remnant_234762 = iter_234755 - gtid_234683;
        bool cond_234684 = sle64(x_215328, gtid_234683);
        int64_t defunc_0_f_res_234685;
        
        if (cond_234684) {
            defunc_0_f_res_234685 = (int64_t) 0;
        } else {
            int64_t i_234756 = add64(x_234346, gtid_234683);
            int64_t defunc_0_add_arg_234757;
            
            defunc_0_add_arg_234757 = ((int64_t *) mem_217340.mem)[gtid_215323 *
                                                                   n_203490 +
                                                                   i_234756];
            
            int64_t defunc_1_add_res_234758 = add64((int64_t) 1,
                                                    defunc_0_add_arg_234757);
            
            defunc_0_f_res_234685 = defunc_1_add_res_234758;
        }
        
        double defunc_0_f_res_234689;
        
        if (cond_234684) {
            defunc_0_f_res_234689 = 0.0;
        } else {
            int64_t i_234759 = add64(x_234346, gtid_234683);
            double defunc_0_add_arg_234760;
            
            defunc_0_add_arg_234760 = ((double *) mem_220371.mem)[i_234759];
            defunc_0_f_res_234689 = defunc_0_add_arg_234760;
        }
        
        int64_t binop_p_234692 = sub64(defunc_0_f_res_234685,
                                       defunc_0_g_res_234350);
        double defunc_0_f_res_234693 = sitofp_i64_f64(binop_p_234692);
        double abs_res_234694 = fabs(defunc_0_f_res_234693);
        double tmp1_234695 = abs_res_234694 / x_234347;
        double x_234696 = tmp1_234695 * tmp1_234695;
        double y_234697 = tmp1_234695 * x_234696;
        double tmp2_234698 = 1.0 - y_234697;
        double x_234699 = tmp2_234698 * tmp2_234698;
        double tmp3_234700 = tmp2_234698 * x_234699;
        double tmp4_234701 = defunc_0_f_res_234689 * tmp3_234700;
        
        ((double *) mem_234351.mem)[gtid_234683] = defunc_0_f_res_234693;
        ((double *) mem_234352.mem)[gtid_234683] = tmp4_234701;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236554_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236554_end -
                 futhark_mc_segmap_parloop_236554_start;
        
        ctx->futhark_mc_segmap_parloop_236554_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236554_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236554_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236552(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234682 = tid;
    int num_tasks_234754 = info.nsubtasks;
    struct futhark_mc_task_236551 *futhark_mc_task_236551 =
                                  (struct futhark_mc_task_236551 *) args;
    struct futhark_context *ctx = futhark_mc_task_236551->ctx;
    uint64_t futhark_mc_segmap_task_236552_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236552_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236551->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236551->free_q_t_203494;
    int64_t gtid_215323 = futhark_mc_task_236551->free_gtid_215323;
    int64_t x_215328 = futhark_mc_task_236551->free_x_215328;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236551->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_task_236551->free_mem_220371,
                                  .size =0, .references =NULL};
    int64_t x_234346 = futhark_mc_task_236551->free_x_234346;
    double x_234347 = futhark_mc_task_236551->free_x_234347;
    int64_t defunc_0_g_res_234350 =
            futhark_mc_task_236551->free_defunc_0_g_res_234350;
    struct memblock mem_234351 = {.desc ="mem_234351", .mem =
                                  futhark_mc_task_236551->free_mem_234351,
                                  .size =0, .references =NULL};
    struct memblock mem_234352 = {.desc ="mem_234352", .mem =
                                  futhark_mc_task_236551->free_mem_234352,
                                  .size =0, .references =NULL};
    int64_t iter_234755;
    struct futhark_mc_segmap_parloop_struct_236553
    futhark_mc_segmap_parloop_struct_236553;
    
    futhark_mc_segmap_parloop_struct_236553.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236553.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236553.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236553.free_gtid_215323 = gtid_215323;
    futhark_mc_segmap_parloop_struct_236553.free_x_215328 = x_215328;
    futhark_mc_segmap_parloop_struct_236553.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236553.free_mem_220371 = mem_220371.mem;
    futhark_mc_segmap_parloop_struct_236553.free_x_234346 = x_234346;
    futhark_mc_segmap_parloop_struct_236553.free_x_234347 = x_234347;
    futhark_mc_segmap_parloop_struct_236553.free_defunc_0_g_res_234350 =
        defunc_0_g_res_234350;
    futhark_mc_segmap_parloop_struct_236553.free_mem_234351 = mem_234351.mem;
    futhark_mc_segmap_parloop_struct_236553.free_mem_234352 = mem_234352.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236554_task;
    
    futhark_mc_segmap_parloop_236554_task.name =
        "futhark_mc_segmap_parloop_236554";
    futhark_mc_segmap_parloop_236554_task.fn = futhark_mc_segmap_parloop_236554;
    futhark_mc_segmap_parloop_236554_task.args =
        &futhark_mc_segmap_parloop_struct_236553;
    futhark_mc_segmap_parloop_236554_task.iterations = iterations;
    futhark_mc_segmap_parloop_236554_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236554_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236554_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236554_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236554_task);
    
    if (futhark_mc_segmap_parloop_236554_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236554_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236554_total_end -
                 futhark_mc_segmap_parloop_236554_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236554_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236554_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236554_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236552_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236552_end -
                 futhark_mc_segmap_task_236552_start;
        
        ctx->futhark_mc_segmap_task_236552_runs[tid]++;
        ctx->futhark_mc_segmap_task_236552_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236552_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236555 {
    struct futhark_context *ctx;
    unsigned char *free_mem_234351;
    unsigned char *free_mem_234352;
    double *retval_defunc_2_reduce_res_234377;
    double *retval_defunc_2_reduce_res_234378;
    double *retval_defunc_2_reduce_res_234379;
    double *retval_defunc_2_reduce_res_234380;
    double *retval_defunc_2_reduce_res_234381;
    unsigned char *retval_mem_234375;
    unsigned char *retval_mem_234376;
};
struct futhark_mc_segred_stage_1_parloop_struct_236562 {
    struct futhark_context *ctx;
    unsigned char *free_mem_234351;
    unsigned char *free_mem_234352;
    unsigned char *free_mem_234375;
    unsigned char *free_mem_234376;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234764;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234766;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234768;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234770;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234772;
};
static int futhark_mc_segred_stage_1_parloop_236563(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234702,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236562
    *futhark_mc_segred_stage_1_parloop_struct_236562 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236562 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236562->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236563_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236563_start = get_wall_time();
    
    struct memblock mem_234351 = {.desc ="mem_234351", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236562->free_mem_234351,
                                  .size =0, .references =NULL};
    struct memblock mem_234352 = {.desc ="mem_234352", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236562->free_mem_234352,
                                  .size =0, .references =NULL};
    struct memblock mem_234375 = {.desc ="mem_234375", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236562->free_mem_234375,
                                  .size =0, .references =NULL};
    struct memblock mem_234376 = {.desc ="mem_234376", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236562->free_mem_234376,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234764 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234764",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236562->free_reduce_stage_1_tid_res_arr_mem_234764,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234766 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234766",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236562->free_reduce_stage_1_tid_res_arr_mem_234766,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234768 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234768",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236562->free_reduce_stage_1_tid_res_arr_mem_234768,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234770 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234770",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236562->free_reduce_stage_1_tid_res_arr_mem_234770,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234772 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234772",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236562->free_reduce_stage_1_tid_res_arr_mem_234772,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234774 = start;
    double x_234704;
    double x_234705;
    double x_234707;
    double x_234708;
    double x_234710;
    double x_234711;
    double x_234713;
    double x_234714;
    double x_234716;
    double x_234717;
    double local_acc_234775 = 0.0;
    double local_acc_234776 = 0.0;
    double local_acc_234777 = 0.0;
    double local_acc_234778 = 0.0;
    double local_acc_234779 = 0.0;
    
    for (; iter_234774 < end; iter_234774++) {
        int64_t gtid_234703 = iter_234774;
        double x_234719;
        
        x_234719 = ((double *) mem_234351.mem)[gtid_234703];
        
        double x_234720;
        
        x_234720 = ((double *) mem_234352.mem)[gtid_234703];
        
        double defunc_1_f_res_234721 = x_234719 * x_234720;
        double defunc_1_f_res_234722 = x_234719 * defunc_1_f_res_234721;
        double defunc_1_f_res_234723 = x_234719 * defunc_1_f_res_234722;
        double defunc_1_f_res_234724 = x_234719 * defunc_1_f_res_234723;
        
        // save map-out results
        {
            ((double *) mem_234375.mem)[gtid_234703] = defunc_1_f_res_234722;
            ((double *) mem_234376.mem)[gtid_234703] = defunc_1_f_res_234721;
        }
        // Load accum params
        {
            x_234704 = local_acc_234775;
        }
        // Load next params
        {
            x_234705 = x_234720;
        }
        // Red body
        {
            double defunc_1_op_res_234706 = x_234704 + x_234705;
            
            local_acc_234775 = defunc_1_op_res_234706;
        }
        // Load accum params
        {
            x_234707 = local_acc_234776;
        }
        // Load next params
        {
            x_234708 = defunc_1_f_res_234721;
        }
        // Red body
        {
            double defunc_1_op_res_234709 = x_234707 + x_234708;
            
            local_acc_234776 = defunc_1_op_res_234709;
        }
        // Load accum params
        {
            x_234710 = local_acc_234777;
        }
        // Load next params
        {
            x_234711 = defunc_1_f_res_234722;
        }
        // Red body
        {
            double defunc_1_op_res_234712 = x_234710 + x_234711;
            
            local_acc_234777 = defunc_1_op_res_234712;
        }
        // Load accum params
        {
            x_234713 = local_acc_234778;
        }
        // Load next params
        {
            x_234714 = defunc_1_f_res_234723;
        }
        // Red body
        {
            double defunc_1_op_res_234715 = x_234713 + x_234714;
            
            local_acc_234778 = defunc_1_op_res_234715;
        }
        // Load accum params
        {
            x_234716 = local_acc_234779;
        }
        // Load next params
        {
            x_234717 = defunc_1_f_res_234724;
        }
        // Red body
        {
            double defunc_1_op_res_234718 = x_234716 + x_234717;
            
            local_acc_234779 = defunc_1_op_res_234718;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234764.mem)[flat_tid_234702] =
        local_acc_234775;
    ((double *) reduce_stage_1_tid_res_arr_mem_234766.mem)[flat_tid_234702] =
        local_acc_234776;
    ((double *) reduce_stage_1_tid_res_arr_mem_234768.mem)[flat_tid_234702] =
        local_acc_234777;
    ((double *) reduce_stage_1_tid_res_arr_mem_234770.mem)[flat_tid_234702] =
        local_acc_234778;
    ((double *) reduce_stage_1_tid_res_arr_mem_234772.mem)[flat_tid_234702] =
        local_acc_234779;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236563_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236563_end -
                 futhark_mc_segred_stage_1_parloop_236563_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236563_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236563_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236563_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236556(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234702 = tid;
    int num_tasks_234763 = info.nsubtasks;
    struct futhark_mc_task_236555 *futhark_mc_task_236555 =
                                  (struct futhark_mc_task_236555 *) args;
    struct futhark_context *ctx = futhark_mc_task_236555->ctx;
    uint64_t futhark_mc_segred_task_236556_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236556_start = get_wall_time();
    
    struct memblock mem_234351 = {.desc ="mem_234351", .mem =
                                  futhark_mc_task_236555->free_mem_234351,
                                  .size =0, .references =NULL};
    struct memblock mem_234352 = {.desc ="mem_234352", .mem =
                                  futhark_mc_task_236555->free_mem_234352,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_234377 =
           *futhark_mc_task_236555->retval_defunc_2_reduce_res_234377;
    double defunc_2_reduce_res_234378 =
           *futhark_mc_task_236555->retval_defunc_2_reduce_res_234378;
    double defunc_2_reduce_res_234379 =
           *futhark_mc_task_236555->retval_defunc_2_reduce_res_234379;
    double defunc_2_reduce_res_234380 =
           *futhark_mc_task_236555->retval_defunc_2_reduce_res_234380;
    double defunc_2_reduce_res_234381 =
           *futhark_mc_task_236555->retval_defunc_2_reduce_res_234381;
    struct memblock mem_234375 = {.desc ="mem_234375", .mem =
                                  futhark_mc_task_236555->retval_mem_234375,
                                  .size =0, .references =NULL};
    struct memblock mem_234376 = {.desc ="mem_234376", .mem =
                                  futhark_mc_task_236555->retval_mem_234376,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_234764_cached_sizze_236557 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234764 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234766_cached_sizze_236558 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234766 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234768_cached_sizze_236559 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234768 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234770_cached_sizze_236560 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234770 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234772_cached_sizze_236561 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234772 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234764_cached_sizze_236557 <
        (size_t) ((int64_t) 8 * num_tasks_234763)) {
        reduce_stage_1_tid_res_arr_mem_234764 =
            realloc(reduce_stage_1_tid_res_arr_mem_234764, (int64_t) 8 *
                    num_tasks_234763);
        reduce_stage_1_tid_res_arr_mem_234764_cached_sizze_236557 =
            (int64_t) 8 * num_tasks_234763;
    }
    if (reduce_stage_1_tid_res_arr_mem_234766_cached_sizze_236558 <
        (size_t) ((int64_t) 8 * num_tasks_234763)) {
        reduce_stage_1_tid_res_arr_mem_234766 =
            realloc(reduce_stage_1_tid_res_arr_mem_234766, (int64_t) 8 *
                    num_tasks_234763);
        reduce_stage_1_tid_res_arr_mem_234766_cached_sizze_236558 =
            (int64_t) 8 * num_tasks_234763;
    }
    if (reduce_stage_1_tid_res_arr_mem_234768_cached_sizze_236559 <
        (size_t) ((int64_t) 8 * num_tasks_234763)) {
        reduce_stage_1_tid_res_arr_mem_234768 =
            realloc(reduce_stage_1_tid_res_arr_mem_234768, (int64_t) 8 *
                    num_tasks_234763);
        reduce_stage_1_tid_res_arr_mem_234768_cached_sizze_236559 =
            (int64_t) 8 * num_tasks_234763;
    }
    if (reduce_stage_1_tid_res_arr_mem_234770_cached_sizze_236560 <
        (size_t) ((int64_t) 8 * num_tasks_234763)) {
        reduce_stage_1_tid_res_arr_mem_234770 =
            realloc(reduce_stage_1_tid_res_arr_mem_234770, (int64_t) 8 *
                    num_tasks_234763);
        reduce_stage_1_tid_res_arr_mem_234770_cached_sizze_236560 =
            (int64_t) 8 * num_tasks_234763;
    }
    if (reduce_stage_1_tid_res_arr_mem_234772_cached_sizze_236561 <
        (size_t) ((int64_t) 8 * num_tasks_234763)) {
        reduce_stage_1_tid_res_arr_mem_234772 =
            realloc(reduce_stage_1_tid_res_arr_mem_234772, (int64_t) 8 *
                    num_tasks_234763);
        reduce_stage_1_tid_res_arr_mem_234772_cached_sizze_236561 =
            (int64_t) 8 * num_tasks_234763;
    }
    
    int64_t iter_234774;
    struct futhark_mc_segred_stage_1_parloop_struct_236562
    futhark_mc_segred_stage_1_parloop_struct_236562;
    
    futhark_mc_segred_stage_1_parloop_struct_236562.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_mem_234351 =
        mem_234351.mem;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_mem_234352 =
        mem_234352.mem;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_mem_234375 =
        mem_234375.mem;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_mem_234376 =
        mem_234376.mem;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_reduce_stage_1_tid_res_arr_mem_234764 =
        reduce_stage_1_tid_res_arr_mem_234764;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_reduce_stage_1_tid_res_arr_mem_234766 =
        reduce_stage_1_tid_res_arr_mem_234766;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_reduce_stage_1_tid_res_arr_mem_234768 =
        reduce_stage_1_tid_res_arr_mem_234768;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_reduce_stage_1_tid_res_arr_mem_234770 =
        reduce_stage_1_tid_res_arr_mem_234770;
    futhark_mc_segred_stage_1_parloop_struct_236562.free_reduce_stage_1_tid_res_arr_mem_234772 =
        reduce_stage_1_tid_res_arr_mem_234772;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236563_task;
    
    futhark_mc_segred_stage_1_parloop_236563_task.name =
        "futhark_mc_segred_stage_1_parloop_236563";
    futhark_mc_segred_stage_1_parloop_236563_task.fn =
        futhark_mc_segred_stage_1_parloop_236563;
    futhark_mc_segred_stage_1_parloop_236563_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236562;
    futhark_mc_segred_stage_1_parloop_236563_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236563_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236563_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236563_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236563_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236563_task);
    
    if (futhark_mc_segred_stage_1_parloop_236563_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236563_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236563_total_end -
                 futhark_mc_segred_stage_1_parloop_236563_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236563_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236563_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236563_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_234377 = 0.0;
        defunc_2_reduce_res_234378 = 0.0;
        defunc_2_reduce_res_234379 = 0.0;
        defunc_2_reduce_res_234380 = 0.0;
        defunc_2_reduce_res_234381 = 0.0;
    }
    
    double x_234780;
    double x_234781;
    double x_234783;
    double x_234784;
    double x_234786;
    double x_234787;
    double x_234789;
    double x_234790;
    double x_234792;
    double x_234793;
    
    for (int32_t i_234795 = 0; i_234795 < num_tasks_234763; i_234795++) {
        flat_tid_234702 = i_234795;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234780 = defunc_2_reduce_res_234377;
            }
            // load next params
            {
                x_234781 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234764)[flat_tid_234702];
            }
            // red body
            {
                double defunc_1_op_res_234782 = x_234780 + x_234781;
                
                defunc_2_reduce_res_234377 = defunc_1_op_res_234782;
            }
            // load acc params
            {
                x_234783 = defunc_2_reduce_res_234378;
            }
            // load next params
            {
                x_234784 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234766)[flat_tid_234702];
            }
            // red body
            {
                double defunc_1_op_res_234785 = x_234783 + x_234784;
                
                defunc_2_reduce_res_234378 = defunc_1_op_res_234785;
            }
            // load acc params
            {
                x_234786 = defunc_2_reduce_res_234379;
            }
            // load next params
            {
                x_234787 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234768)[flat_tid_234702];
            }
            // red body
            {
                double defunc_1_op_res_234788 = x_234786 + x_234787;
                
                defunc_2_reduce_res_234379 = defunc_1_op_res_234788;
            }
            // load acc params
            {
                x_234789 = defunc_2_reduce_res_234380;
            }
            // load next params
            {
                x_234790 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234770)[flat_tid_234702];
            }
            // red body
            {
                double defunc_1_op_res_234791 = x_234789 + x_234790;
                
                defunc_2_reduce_res_234380 = defunc_1_op_res_234791;
            }
            // load acc params
            {
                x_234792 = defunc_2_reduce_res_234381;
            }
            // load next params
            {
                x_234793 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234772)[flat_tid_234702];
            }
            // red body
            {
                double defunc_1_op_res_234794 = x_234792 + x_234793;
                
                defunc_2_reduce_res_234381 = defunc_1_op_res_234794;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234764);
        free(reduce_stage_1_tid_res_arr_mem_234766);
        free(reduce_stage_1_tid_res_arr_mem_234768);
        free(reduce_stage_1_tid_res_arr_mem_234770);
        free(reduce_stage_1_tid_res_arr_mem_234772);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236556_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236556_end -
                 futhark_mc_segred_task_236556_start;
        
        ctx->futhark_mc_segred_task_236556_runs[tid]++;
        ctx->futhark_mc_segred_task_236556_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236556_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236555->retval_defunc_2_reduce_res_234377 =
            defunc_2_reduce_res_234377;
        *futhark_mc_task_236555->retval_defunc_2_reduce_res_234378 =
            defunc_2_reduce_res_234378;
        *futhark_mc_task_236555->retval_defunc_2_reduce_res_234379 =
            defunc_2_reduce_res_234379;
        *futhark_mc_task_236555->retval_defunc_2_reduce_res_234380 =
            defunc_2_reduce_res_234380;
        *futhark_mc_task_236555->retval_defunc_2_reduce_res_234381 =
            defunc_2_reduce_res_234381;
        futhark_mc_task_236555->retval_mem_234375 = mem_234375.mem;
        futhark_mc_task_236555->retval_mem_234376 = mem_234376.mem;
    }
    return err;
}
struct futhark_mc_task_236564 {
    struct futhark_context *ctx;
    int64_t free_x_215328;
    unsigned char *free_mem_220374;
    int64_t free_x_234346;
    unsigned char *free_mem_234352;
    unsigned char *free_mem_234375;
    unsigned char *free_mem_234376;
    double free_a12_234427;
    double free_b12_234428;
    double free_c12_234429;
    double free_b2_234430;
    double free_c2_234431;
    double *retval_defunc_2_reduce_res_234432;
    double *retval_defunc_2_reduce_res_234433;
};
struct futhark_mc_segred_stage_1_parloop_struct_236568 {
    struct futhark_context *ctx;
    int64_t free_x_215328;
    unsigned char *free_mem_220374;
    int64_t free_x_234346;
    unsigned char *free_mem_234352;
    unsigned char *free_mem_234375;
    unsigned char *free_mem_234376;
    double free_a12_234427;
    double free_b12_234428;
    double free_c12_234429;
    double free_b2_234430;
    double free_c2_234431;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234797;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234799;
};
static int futhark_mc_segred_stage_1_parloop_236569(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234725,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236568
    *futhark_mc_segred_stage_1_parloop_struct_236568 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236568 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236568->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236569_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236569_start = get_wall_time();
    
    int64_t x_215328 =
            futhark_mc_segred_stage_1_parloop_struct_236568->free_x_215328;
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236568->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t x_234346 =
            futhark_mc_segred_stage_1_parloop_struct_236568->free_x_234346;
    struct memblock mem_234352 = {.desc ="mem_234352", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236568->free_mem_234352,
                                  .size =0, .references =NULL};
    struct memblock mem_234375 = {.desc ="mem_234375", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236568->free_mem_234375,
                                  .size =0, .references =NULL};
    struct memblock mem_234376 = {.desc ="mem_234376", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236568->free_mem_234376,
                                  .size =0, .references =NULL};
    double a12_234427 =
           futhark_mc_segred_stage_1_parloop_struct_236568->free_a12_234427;
    double b12_234428 =
           futhark_mc_segred_stage_1_parloop_struct_236568->free_b12_234428;
    double c12_234429 =
           futhark_mc_segred_stage_1_parloop_struct_236568->free_c12_234429;
    double b2_234430 =
           futhark_mc_segred_stage_1_parloop_struct_236568->free_b2_234430;
    double c2_234431 =
           futhark_mc_segred_stage_1_parloop_struct_236568->free_c2_234431;
    struct memblock reduce_stage_1_tid_res_arr_mem_234797 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234797",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236568->free_reduce_stage_1_tid_res_arr_mem_234797,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234799 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234799",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236568->free_reduce_stage_1_tid_res_arr_mem_234799,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234801 = start;
    double x_234727;
    double x_234728;
    double x_234730;
    double x_234731;
    double local_acc_234802 = 0.0;
    double local_acc_234803 = 0.0;
    
    for (; iter_234801 < end; iter_234801++) {
        int64_t gtid_234726 = iter_234801;
        double x_234733;
        
        x_234733 = ((double *) mem_234352.mem)[gtid_234726];
        
        double x_234734;
        
        x_234734 = ((double *) mem_234376.mem)[gtid_234726];
        
        double x_234735;
        
        x_234735 = ((double *) mem_234375.mem)[gtid_234726];
        
        bool cond_234736 = sle64(x_215328, gtid_234726);
        double defunc_0_f_res_234737;
        
        if (cond_234736) {
            defunc_0_f_res_234737 = 0.0;
        } else {
            int64_t i_234738 = add64(x_234346, gtid_234726);
            double defunc_0_add_arg_234739;
            
            defunc_0_add_arg_234739 = ((double *) mem_220374.mem)[i_234738];
            defunc_0_f_res_234737 = defunc_0_add_arg_234739;
        }
        
        double x_234740 = a12_234427 * x_234733;
        double y_234741 = b12_234428 * x_234734;
        double x_234742 = x_234740 + y_234741;
        double y_234743 = c12_234429 * x_234735;
        double x_234744 = x_234742 + y_234743;
        double defunc_9_fit_fun_res_234745 = defunc_0_f_res_234737 * x_234744;
        double x_234746 = b12_234428 * x_234733;
        double y_234747 = b2_234430 * x_234734;
        double x_234748 = x_234746 + y_234747;
        double y_234749 = c2_234431 * x_234735;
        double x_234750 = x_234748 + y_234749;
        double defunc_9_slope_fun_res_234751 = defunc_0_f_res_234737 * x_234750;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_234727 = local_acc_234802;
        }
        // Load next params
        {
            x_234728 = defunc_9_fit_fun_res_234745;
        }
        // Red body
        {
            double defunc_1_op_res_234729 = x_234727 + x_234728;
            
            local_acc_234802 = defunc_1_op_res_234729;
        }
        // Load accum params
        {
            x_234730 = local_acc_234803;
        }
        // Load next params
        {
            x_234731 = defunc_9_slope_fun_res_234751;
        }
        // Red body
        {
            double defunc_1_op_res_234732 = x_234730 + x_234731;
            
            local_acc_234803 = defunc_1_op_res_234732;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234797.mem)[flat_tid_234725] =
        local_acc_234802;
    ((double *) reduce_stage_1_tid_res_arr_mem_234799.mem)[flat_tid_234725] =
        local_acc_234803;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236569_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236569_end -
                 futhark_mc_segred_stage_1_parloop_236569_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236569_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236569_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236569_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236565(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234725 = tid;
    int num_tasks_234796 = info.nsubtasks;
    struct futhark_mc_task_236564 *futhark_mc_task_236564 =
                                  (struct futhark_mc_task_236564 *) args;
    struct futhark_context *ctx = futhark_mc_task_236564->ctx;
    uint64_t futhark_mc_segred_task_236565_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236565_start = get_wall_time();
    
    int64_t x_215328 = futhark_mc_task_236564->free_x_215328;
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_task_236564->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t x_234346 = futhark_mc_task_236564->free_x_234346;
    struct memblock mem_234352 = {.desc ="mem_234352", .mem =
                                  futhark_mc_task_236564->free_mem_234352,
                                  .size =0, .references =NULL};
    struct memblock mem_234375 = {.desc ="mem_234375", .mem =
                                  futhark_mc_task_236564->free_mem_234375,
                                  .size =0, .references =NULL};
    struct memblock mem_234376 = {.desc ="mem_234376", .mem =
                                  futhark_mc_task_236564->free_mem_234376,
                                  .size =0, .references =NULL};
    double a12_234427 = futhark_mc_task_236564->free_a12_234427;
    double b12_234428 = futhark_mc_task_236564->free_b12_234428;
    double c12_234429 = futhark_mc_task_236564->free_c12_234429;
    double b2_234430 = futhark_mc_task_236564->free_b2_234430;
    double c2_234431 = futhark_mc_task_236564->free_c2_234431;
    double defunc_2_reduce_res_234432 =
           *futhark_mc_task_236564->retval_defunc_2_reduce_res_234432;
    double defunc_2_reduce_res_234433 =
           *futhark_mc_task_236564->retval_defunc_2_reduce_res_234433;
    size_t reduce_stage_1_tid_res_arr_mem_234797_cached_sizze_236566 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234797 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234799_cached_sizze_236567 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234799 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234797_cached_sizze_236566 <
        (size_t) ((int64_t) 8 * num_tasks_234796)) {
        reduce_stage_1_tid_res_arr_mem_234797 =
            realloc(reduce_stage_1_tid_res_arr_mem_234797, (int64_t) 8 *
                    num_tasks_234796);
        reduce_stage_1_tid_res_arr_mem_234797_cached_sizze_236566 =
            (int64_t) 8 * num_tasks_234796;
    }
    if (reduce_stage_1_tid_res_arr_mem_234799_cached_sizze_236567 <
        (size_t) ((int64_t) 8 * num_tasks_234796)) {
        reduce_stage_1_tid_res_arr_mem_234799 =
            realloc(reduce_stage_1_tid_res_arr_mem_234799, (int64_t) 8 *
                    num_tasks_234796);
        reduce_stage_1_tid_res_arr_mem_234799_cached_sizze_236567 =
            (int64_t) 8 * num_tasks_234796;
    }
    
    int64_t iter_234801;
    struct futhark_mc_segred_stage_1_parloop_struct_236568
    futhark_mc_segred_stage_1_parloop_struct_236568;
    
    futhark_mc_segred_stage_1_parloop_struct_236568.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_x_215328 = x_215328;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_mem_220374 =
        mem_220374.mem;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_x_234346 = x_234346;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_mem_234352 =
        mem_234352.mem;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_mem_234375 =
        mem_234375.mem;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_mem_234376 =
        mem_234376.mem;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_a12_234427 =
        a12_234427;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_b12_234428 =
        b12_234428;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_c12_234429 =
        c12_234429;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_b2_234430 = b2_234430;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_c2_234431 = c2_234431;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_reduce_stage_1_tid_res_arr_mem_234797 =
        reduce_stage_1_tid_res_arr_mem_234797;
    futhark_mc_segred_stage_1_parloop_struct_236568.free_reduce_stage_1_tid_res_arr_mem_234799 =
        reduce_stage_1_tid_res_arr_mem_234799;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236569_task;
    
    futhark_mc_segred_stage_1_parloop_236569_task.name =
        "futhark_mc_segred_stage_1_parloop_236569";
    futhark_mc_segred_stage_1_parloop_236569_task.fn =
        futhark_mc_segred_stage_1_parloop_236569;
    futhark_mc_segred_stage_1_parloop_236569_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236568;
    futhark_mc_segred_stage_1_parloop_236569_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236569_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236569_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236569_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236569_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236569_task);
    
    if (futhark_mc_segred_stage_1_parloop_236569_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236569_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236569_total_end -
                 futhark_mc_segred_stage_1_parloop_236569_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236569_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236569_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236569_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_234432 = 0.0;
        defunc_2_reduce_res_234433 = 0.0;
    }
    
    double x_234804;
    double x_234805;
    double x_234807;
    double x_234808;
    
    for (int32_t i_234810 = 0; i_234810 < num_tasks_234796; i_234810++) {
        flat_tid_234725 = i_234810;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234804 = defunc_2_reduce_res_234432;
            }
            // load next params
            {
                x_234805 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234797)[flat_tid_234725];
            }
            // red body
            {
                double defunc_1_op_res_234806 = x_234804 + x_234805;
                
                defunc_2_reduce_res_234432 = defunc_1_op_res_234806;
            }
            // load acc params
            {
                x_234807 = defunc_2_reduce_res_234433;
            }
            // load next params
            {
                x_234808 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234799)[flat_tid_234725];
            }
            // red body
            {
                double defunc_1_op_res_234809 = x_234807 + x_234808;
                
                defunc_2_reduce_res_234433 = defunc_1_op_res_234809;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234797);
        free(reduce_stage_1_tid_res_arr_mem_234799);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236565_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236565_end -
                 futhark_mc_segred_task_236565_start;
        
        ctx->futhark_mc_segred_task_236565_runs[tid]++;
        ctx->futhark_mc_segred_task_236565_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236565_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236564->retval_defunc_2_reduce_res_234432 =
            defunc_2_reduce_res_234432;
        *futhark_mc_task_236564->retval_defunc_2_reduce_res_234433 =
            defunc_2_reduce_res_234433;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236546(void *args, int64_t start,
                                            int64_t end, int flat_tid_234344,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236545
    *futhark_mc_segmap_parloop_struct_236545 =
    (struct futhark_mc_segmap_parloop_struct_236545 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236545->ctx;
    uint64_t futhark_mc_segmap_parloop_236546_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236546_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236545->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236545->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236545->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236545->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236545->free_i_203670;
    int64_t gtid_215323 =
            futhark_mc_segmap_parloop_struct_236545->free_gtid_215323;
    int64_t x_215328 = futhark_mc_segmap_parloop_struct_236545->free_x_215328;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236545->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236545->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236545->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_segmap_parloop_struct_236545->free_mem_220371,
                                  .size =0, .references =NULL};
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_segmap_parloop_struct_236545->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 =
            futhark_mc_segmap_parloop_struct_236545->free_bytes_220376;
    struct memblock mem_220449 = {.desc ="mem_220449", .mem =
                                  futhark_mc_segmap_parloop_struct_236545->free_mem_220449,
                                  .size =0, .references =NULL};
    struct memblock mem_220452 = {.desc ="mem_220452", .mem =
                                  futhark_mc_segmap_parloop_struct_236545->free_mem_220452,
                                  .size =0, .references =NULL};
    size_t mem_234351_cached_sizze_236547 = 0;
    unsigned char *mem_234351 = NULL;
    size_t mem_234352_cached_sizze_236548 = 0;
    unsigned char *mem_234352 = NULL;
    size_t mem_234375_cached_sizze_236549 = 0;
    unsigned char *mem_234375 = NULL;
    size_t mem_234376_cached_sizze_236550 = 0;
    unsigned char *mem_234376 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234681 = start;
    
    if (mem_234351_cached_sizze_236547 < (size_t) bytes_220376) {
        mem_234351 = realloc(mem_234351, bytes_220376);
        mem_234351_cached_sizze_236547 = bytes_220376;
    }
    if (mem_234352_cached_sizze_236548 < (size_t) bytes_220376) {
        mem_234352 = realloc(mem_234352, bytes_220376);
        mem_234352_cached_sizze_236548 = bytes_220376;
    }
    if (mem_234375_cached_sizze_236549 < (size_t) bytes_220376) {
        mem_234375 = realloc(mem_234375, bytes_220376);
        mem_234375_cached_sizze_236549 = bytes_220376;
    }
    if (mem_234376_cached_sizze_236550 < (size_t) bytes_220376) {
        mem_234376 = realloc(mem_234376, bytes_220376);
        mem_234376_cached_sizze_236550 = bytes_220376;
    }
    for (; iter_234681 < end; iter_234681++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234752 = t_n_m_203650;
        int64_t gtid_234345 = iter_234681;
        int64_t remnant_234753 = iter_234681 - gtid_234345;
        int64_t x_234346;
        
        x_234346 = ((int64_t *) mem_217835.mem)[gtid_215323 * t_n_m_203650 +
                                                gtid_234345];
        
        double x_234347;
        
        x_234347 = ((double *) mem_217839.mem)[gtid_215323 * t_n_m_203650 +
                                               gtid_234345];
        
        int64_t min_arg_234348 = mul64(jump_t_203500, gtid_234345);
        int64_t min_res_234349 = smin64(i_203670, min_arg_234348);
        int64_t defunc_0_g_res_234350 = add64((int64_t) 1, min_res_234349);
        int64_t flat_tid_234682 = (int64_t) 0;
        int32_t num_tasks_234754;
        struct futhark_mc_task_236551 futhark_mc_task_236551;
        
        futhark_mc_task_236551.ctx = ctx;
        futhark_mc_task_236551.free_n_203490 = n_203490;
        futhark_mc_task_236551.free_q_t_203494 = q_t_203494;
        futhark_mc_task_236551.free_gtid_215323 = gtid_215323;
        futhark_mc_task_236551.free_x_215328 = x_215328;
        futhark_mc_task_236551.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236551.free_mem_220371 = mem_220371.mem;
        futhark_mc_task_236551.free_x_234346 = x_234346;
        futhark_mc_task_236551.free_x_234347 = x_234347;
        futhark_mc_task_236551.free_defunc_0_g_res_234350 =
            defunc_0_g_res_234350;
        futhark_mc_task_236551.free_mem_234351 = mem_234351;
        futhark_mc_task_236551.free_mem_234352 = mem_234352;
        
        struct scheduler_segop futhark_mc_task_236551_task;
        
        futhark_mc_task_236551_task.args = &futhark_mc_task_236551;
        futhark_mc_task_236551_task.top_level_fn =
            futhark_mc_segmap_task_236552;
        futhark_mc_task_236551_task.name = "futhark_mc_segmap_task_236552";
        futhark_mc_task_236551_task.iterations = q_t_203494;
        futhark_mc_task_236551_task.task_time =
            &ctx->futhark_mc_segmap_task_236552_total_time;
        futhark_mc_task_236551_task.task_iter =
            &ctx->futhark_mc_segmap_task_236552_total_iter;
        futhark_mc_task_236551_task.sched = STATIC;
        futhark_mc_task_236551_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236552_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236551_task);
        
        if (futhark_mc_segmap_task_236552_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double defunc_2_reduce_res_234377;
        double defunc_2_reduce_res_234378;
        double defunc_2_reduce_res_234379;
        double defunc_2_reduce_res_234380;
        double defunc_2_reduce_res_234381;
        int64_t flat_tid_234702 = (int64_t) 0;
        int32_t num_tasks_234763;
        
        defunc_2_reduce_res_234377 = 0.0;
        defunc_2_reduce_res_234378 = 0.0;
        defunc_2_reduce_res_234379 = 0.0;
        defunc_2_reduce_res_234380 = 0.0;
        defunc_2_reduce_res_234381 = 0.0;
        
        struct futhark_mc_task_236555 futhark_mc_task_236555;
        
        futhark_mc_task_236555.ctx = ctx;
        futhark_mc_task_236555.free_mem_234351 = mem_234351;
        futhark_mc_task_236555.free_mem_234352 = mem_234352;
        futhark_mc_task_236555.retval_defunc_2_reduce_res_234377 =
            &defunc_2_reduce_res_234377;
        futhark_mc_task_236555.retval_defunc_2_reduce_res_234378 =
            &defunc_2_reduce_res_234378;
        futhark_mc_task_236555.retval_defunc_2_reduce_res_234379 =
            &defunc_2_reduce_res_234379;
        futhark_mc_task_236555.retval_defunc_2_reduce_res_234380 =
            &defunc_2_reduce_res_234380;
        futhark_mc_task_236555.retval_defunc_2_reduce_res_234381 =
            &defunc_2_reduce_res_234381;
        futhark_mc_task_236555.retval_mem_234375 = mem_234375;
        futhark_mc_task_236555.retval_mem_234376 = mem_234376;
        
        struct scheduler_segop futhark_mc_task_236555_task;
        
        futhark_mc_task_236555_task.args = &futhark_mc_task_236555;
        futhark_mc_task_236555_task.top_level_fn =
            futhark_mc_segred_task_236556;
        futhark_mc_task_236555_task.name = "futhark_mc_segred_task_236556";
        futhark_mc_task_236555_task.iterations = q_t_203494;
        futhark_mc_task_236555_task.task_time =
            &ctx->futhark_mc_segred_task_236556_total_time;
        futhark_mc_task_236555_task.task_iter =
            &ctx->futhark_mc_segred_task_236556_total_iter;
        futhark_mc_task_236555_task.sched = STATIC;
        futhark_mc_task_236555_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236556_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236555_task);
        
        if (futhark_mc_segred_task_236556_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_234407 = defunc_2_reduce_res_234379 *
               defunc_2_reduce_res_234381;
        double y_234408 = defunc_2_reduce_res_234380 *
               defunc_2_reduce_res_234380;
        double a12_234409 = x_234407 - y_234408;
        double x_234410 = defunc_2_reduce_res_234379 *
               defunc_2_reduce_res_234380;
        double y_234411 = defunc_2_reduce_res_234378 *
               defunc_2_reduce_res_234381;
        double b12_234412 = x_234410 - y_234411;
        double x_234413 = defunc_2_reduce_res_234378 *
               defunc_2_reduce_res_234380;
        double y_234414 = defunc_2_reduce_res_234379 *
               defunc_2_reduce_res_234379;
        double c12_234415 = x_234413 - y_234414;
        double x_234416 = defunc_2_reduce_res_234377 *
               defunc_2_reduce_res_234381;
        double b2_234417 = x_234416 - y_234414;
        double x_234418 = defunc_2_reduce_res_234378 *
               defunc_2_reduce_res_234379;
        double y_234419 = defunc_2_reduce_res_234377 *
               defunc_2_reduce_res_234380;
        double c2_234420 = x_234418 - y_234419;
        double x_234421 = defunc_2_reduce_res_234377 * a12_234409;
        double y_234422 = defunc_2_reduce_res_234378 * b12_234412;
        double x_234423 = x_234421 + y_234422;
        double y_234424 = defunc_2_reduce_res_234379 * c12_234415;
        double y_234425 = x_234423 + y_234424;
        double det_234426 = 1.0 / y_234425;
        double a12_234427 = a12_234409 * det_234426;
        double b12_234428 = b12_234412 * det_234426;
        double c12_234429 = c12_234415 * det_234426;
        double b2_234430 = b2_234417 * det_234426;
        double c2_234431 = c2_234420 * det_234426;
        double defunc_2_reduce_res_234432;
        double defunc_2_reduce_res_234433;
        int64_t flat_tid_234725 = (int64_t) 0;
        int32_t num_tasks_234796;
        
        defunc_2_reduce_res_234432 = 0.0;
        defunc_2_reduce_res_234433 = 0.0;
        
        struct futhark_mc_task_236564 futhark_mc_task_236564;
        
        futhark_mc_task_236564.ctx = ctx;
        futhark_mc_task_236564.free_x_215328 = x_215328;
        futhark_mc_task_236564.free_mem_220374 = mem_220374.mem;
        futhark_mc_task_236564.free_x_234346 = x_234346;
        futhark_mc_task_236564.free_mem_234352 = mem_234352;
        futhark_mc_task_236564.free_mem_234375 = mem_234375;
        futhark_mc_task_236564.free_mem_234376 = mem_234376;
        futhark_mc_task_236564.free_a12_234427 = a12_234427;
        futhark_mc_task_236564.free_b12_234428 = b12_234428;
        futhark_mc_task_236564.free_c12_234429 = c12_234429;
        futhark_mc_task_236564.free_b2_234430 = b2_234430;
        futhark_mc_task_236564.free_c2_234431 = c2_234431;
        futhark_mc_task_236564.retval_defunc_2_reduce_res_234432 =
            &defunc_2_reduce_res_234432;
        futhark_mc_task_236564.retval_defunc_2_reduce_res_234433 =
            &defunc_2_reduce_res_234433;
        
        struct scheduler_segop futhark_mc_task_236564_task;
        
        futhark_mc_task_236564_task.args = &futhark_mc_task_236564;
        futhark_mc_task_236564_task.top_level_fn =
            futhark_mc_segred_task_236565;
        futhark_mc_task_236564_task.name = "futhark_mc_segred_task_236565";
        futhark_mc_task_236564_task.iterations = q_t_203494;
        futhark_mc_task_236564_task.task_time =
            &ctx->futhark_mc_segred_task_236565_total_time;
        futhark_mc_task_236564_task.task_iter =
            &ctx->futhark_mc_segred_task_236565_total_iter;
        futhark_mc_task_236564_task.sched = STATIC;
        futhark_mc_task_236564_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236565_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236564_task);
        
        if (futhark_mc_segred_task_236565_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220449.mem)[gtid_234345] = defunc_2_reduce_res_234432;
        ((double *) mem_220452.mem)[gtid_234345] = defunc_2_reduce_res_234433;
    }
    
  cleanup:
    { }
    free(mem_234351);
    free(mem_234352);
    free(mem_234375);
    free(mem_234376);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236546_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236546_end -
                 futhark_mc_segmap_parloop_236546_start;
        
        ctx->futhark_mc_segmap_parloop_236546_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236546_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236546_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236544(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234344 = tid;
    int num_tasks_234598 = info.nsubtasks;
    struct futhark_mc_task_236536 *futhark_mc_task_236536 =
                                  (struct futhark_mc_task_236536 *) args;
    struct futhark_context *ctx = futhark_mc_task_236536->ctx;
    uint64_t futhark_mc_segmap_nested_task_236544_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236544_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236536->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236536->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236536->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236536->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236536->free_i_203670;
    int64_t gtid_215323 = futhark_mc_task_236536->free_gtid_215323;
    int64_t x_215328 = futhark_mc_task_236536->free_x_215328;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236536->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236536->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236536->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_220371 = {.desc ="mem_220371", .mem =
                                  futhark_mc_task_236536->free_mem_220371,
                                  .size =0, .references =NULL};
    struct memblock mem_220374 = {.desc ="mem_220374", .mem =
                                  futhark_mc_task_236536->free_mem_220374,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 = futhark_mc_task_236536->free_bytes_220376;
    struct memblock mem_220449 = {.desc ="mem_220449", .mem =
                                  futhark_mc_task_236536->free_mem_220449,
                                  .size =0, .references =NULL};
    struct memblock mem_220452 = {.desc ="mem_220452", .mem =
                                  futhark_mc_task_236536->free_mem_220452,
                                  .size =0, .references =NULL};
    int64_t iter_234681;
    struct futhark_mc_segmap_parloop_struct_236545
    futhark_mc_segmap_parloop_struct_236545;
    
    futhark_mc_segmap_parloop_struct_236545.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236545.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236545.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236545.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236545.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236545.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236545.free_gtid_215323 = gtid_215323;
    futhark_mc_segmap_parloop_struct_236545.free_x_215328 = x_215328;
    futhark_mc_segmap_parloop_struct_236545.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236545.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236545.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236545.free_mem_220371 = mem_220371.mem;
    futhark_mc_segmap_parloop_struct_236545.free_mem_220374 = mem_220374.mem;
    futhark_mc_segmap_parloop_struct_236545.free_bytes_220376 = bytes_220376;
    futhark_mc_segmap_parloop_struct_236545.free_mem_220449 = mem_220449.mem;
    futhark_mc_segmap_parloop_struct_236545.free_mem_220452 = mem_220452.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236546_task;
    
    futhark_mc_segmap_parloop_236546_task.name =
        "futhark_mc_segmap_parloop_236546";
    futhark_mc_segmap_parloop_236546_task.fn = futhark_mc_segmap_parloop_236546;
    futhark_mc_segmap_parloop_236546_task.args =
        &futhark_mc_segmap_parloop_struct_236545;
    futhark_mc_segmap_parloop_236546_task.iterations = iterations;
    futhark_mc_segmap_parloop_236546_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236546_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236546_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236546_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236546_task);
    
    if (futhark_mc_segmap_parloop_236546_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236546_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236546_total_end -
                 futhark_mc_segmap_parloop_236546_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236546_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236546_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236546_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236544_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236544_end -
                 futhark_mc_segmap_nested_task_236544_start;
        
        ctx->futhark_mc_segmap_nested_task_236544_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236544_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236544_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236522(void *args, int64_t start,
                                            int64_t end, int flat_tid_215322,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236521
    *futhark_mc_segmap_parloop_struct_236521 =
    (struct futhark_mc_segmap_parloop_struct_236521 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236521->ctx;
    uint64_t futhark_mc_segmap_parloop_236522_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236522_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236521->free_n_203490;
    int64_t q_t_203494 =
            futhark_mc_segmap_parloop_struct_236521->free_q_t_203494;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236521->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236521->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236521->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236521->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236521->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 =
            futhark_mc_segmap_parloop_struct_236521->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_segmap_parloop_struct_236521->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_segmap_parloop_struct_236521->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_segmap_parloop_struct_236521->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_segmap_parloop_struct_236521->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 =
            futhark_mc_segmap_parloop_struct_236521->free_bytes_220376;
    struct memblock mem_220591 = {.desc ="mem_220591", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_220591,
                                  .size =0, .references =NULL};
    struct memblock mem_220595 = {.desc ="mem_220595", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_220595,
                                  .size =0, .references =NULL};
    size_t mem_220368_cached_sizze_236523 = 0;
    unsigned char *mem_220368 = NULL;
    size_t mem_220371_cached_sizze_236524 = 0;
    unsigned char *mem_220371 = NULL;
    size_t mem_220374_cached_sizze_236525 = 0;
    unsigned char *mem_220374 = NULL;
    size_t mem_220449_cached_sizze_236526 = 0;
    unsigned char *mem_220449 = NULL;
    size_t mem_220452_cached_sizze_236527 = 0;
    unsigned char *mem_220452 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234324 = start;
    
    if (mem_220368_cached_sizze_236523 < (size_t) bytes_217302) {
        mem_220368 = realloc(mem_220368, bytes_217302);
        mem_220368_cached_sizze_236523 = bytes_217302;
    }
    if (mem_220371_cached_sizze_236524 < (size_t) bytes_217302) {
        mem_220371 = realloc(mem_220371, bytes_217302);
        mem_220371_cached_sizze_236524 = bytes_217302;
    }
    if (mem_220374_cached_sizze_236525 < (size_t) bytes_217302) {
        mem_220374 = realloc(mem_220374, bytes_217302);
        mem_220374_cached_sizze_236525 = bytes_217302;
    }
    if (mem_220449_cached_sizze_236526 < (size_t) bytes_217782) {
        mem_220449 = realloc(mem_220449, bytes_217782);
        mem_220449_cached_sizze_236526 = bytes_217782;
    }
    if (mem_220452_cached_sizze_236527 < (size_t) bytes_217782) {
        mem_220452 = realloc(mem_220452, bytes_217782);
        mem_220452_cached_sizze_236527 = bytes_217782;
    }
    for (; iter_234324 < end; iter_234324++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234580 = partition_sizze_203577;
        int64_t gtid_215323 = iter_234324;
        int64_t remnant_234581 = iter_234324 - gtid_215323;
        int64_t x_215328;
        
        x_215328 = ((int64_t *) mem_217343.mem)[gtid_215323];
        
        int64_t flat_tid_234325 = (int64_t) 0;
        int32_t num_tasks_234582;
        struct futhark_mc_task_236528 futhark_mc_task_236528;
        
        futhark_mc_task_236528.ctx = ctx;
        futhark_mc_task_236528.free_n_203490 = n_203490;
        futhark_mc_task_236528.free_gtid_215323 = gtid_215323;
        futhark_mc_task_236528.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236528.free_mem_219808 = mem_219808.mem;
        futhark_mc_task_236528.free_mem_220368 = mem_220368;
        
        struct scheduler_segop futhark_mc_task_236528_task;
        
        futhark_mc_task_236528_task.args = &futhark_mc_task_236528;
        futhark_mc_task_236528_task.top_level_fn =
            futhark_mc_segmap_task_236529;
        futhark_mc_task_236528_task.name = "futhark_mc_segmap_task_236529";
        futhark_mc_task_236528_task.iterations = n_203490;
        futhark_mc_task_236528_task.task_time =
            &ctx->futhark_mc_segmap_task_236529_total_time;
        futhark_mc_task_236528_task.task_iter =
            &ctx->futhark_mc_segmap_task_236529_total_iter;
        futhark_mc_task_236528_task.sched = STATIC;
        futhark_mc_task_236528_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236529_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236528_task);
        
        if (futhark_mc_segmap_task_236529_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_234330 = (int64_t) 0;
        int32_t num_tasks_234586;
        struct futhark_mc_task_236532 futhark_mc_task_236532;
        
        futhark_mc_task_236532.ctx = ctx;
        futhark_mc_task_236532.free_n_203490 = n_203490;
        futhark_mc_task_236532.free_gtid_215323 = gtid_215323;
        futhark_mc_task_236532.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236532.free_ctx_param_ext_217866 = ctx_param_ext_217866;
        futhark_mc_task_236532.free_ctx_param_ext_217867 = ctx_param_ext_217867;
        futhark_mc_task_236532.free_ctx_param_ext_217869 = ctx_param_ext_217869;
        futhark_mc_task_236532.free_mem_param_217871 = mem_param_217871.mem;
        futhark_mc_task_236532.free_mem_220368 = mem_220368;
        futhark_mc_task_236532.free_mem_220371 = mem_220371;
        futhark_mc_task_236532.free_mem_220374 = mem_220374;
        
        struct scheduler_segop futhark_mc_task_236532_task;
        
        futhark_mc_task_236532_task.args = &futhark_mc_task_236532;
        futhark_mc_task_236532_task.top_level_fn =
            futhark_mc_segmap_task_236533;
        futhark_mc_task_236532_task.name = "futhark_mc_segmap_task_236533";
        futhark_mc_task_236532_task.iterations = n_203490;
        futhark_mc_task_236532_task.task_time =
            &ctx->futhark_mc_segmap_task_236533_total_time;
        futhark_mc_task_236532_task.task_iter =
            &ctx->futhark_mc_segmap_task_236533_total_iter;
        futhark_mc_task_236532_task.sched = STATIC;
        futhark_mc_task_236532_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236533_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236532_task);
        
        if (futhark_mc_segmap_task_236533_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_234461 = (int64_t) 0;
        int32_t num_tasks_234598;
        int64_t flat_tid_234344 = (int64_t) 0;
        struct futhark_mc_task_236536 futhark_mc_task_236536;
        
        futhark_mc_task_236536.ctx = ctx;
        futhark_mc_task_236536.free_n_203490 = n_203490;
        futhark_mc_task_236536.free_q_t_203494 = q_t_203494;
        futhark_mc_task_236536.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236536.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_236536.free_i_203670 = i_203670;
        futhark_mc_task_236536.free_gtid_215323 = gtid_215323;
        futhark_mc_task_236536.free_x_215328 = x_215328;
        futhark_mc_task_236536.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236536.free_mem_217835 = mem_217835.mem;
        futhark_mc_task_236536.free_mem_217839 = mem_217839.mem;
        futhark_mc_task_236536.free_mem_220371 = mem_220371;
        futhark_mc_task_236536.free_mem_220374 = mem_220374;
        futhark_mc_task_236536.free_bytes_220376 = bytes_220376;
        futhark_mc_task_236536.free_mem_220449 = mem_220449;
        futhark_mc_task_236536.free_mem_220452 = mem_220452;
        
        struct scheduler_segop futhark_mc_task_236536_task;
        
        futhark_mc_task_236536_task.args = &futhark_mc_task_236536;
        futhark_mc_task_236536_task.top_level_fn =
            futhark_mc_segmap_task_236537;
        futhark_mc_task_236536_task.name = "futhark_mc_segmap_task_236537";
        futhark_mc_task_236536_task.iterations = t_n_m_203650;
        futhark_mc_task_236536_task.task_time =
            &ctx->futhark_mc_segmap_task_236537_total_time;
        futhark_mc_task_236536_task.task_iter =
            &ctx->futhark_mc_segmap_task_236537_total_iter;
        futhark_mc_task_236536_task.sched = STATIC;
        futhark_mc_task_236536_task.nested_fn =
            futhark_mc_segmap_nested_task_236544;
        
        int futhark_mc_segmap_task_236537_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236536_task);
        
        if (futhark_mc_segmap_task_236537_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220591.mem + gtid_215323 * t_n_m_203650 * (int64_t) 8,
                    mem_220449 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
        if (t_n_m_203650 * (int64_t) 8 > 0)
            memmove(mem_220595.mem + gtid_215323 * t_n_m_203650 * (int64_t) 8,
                    mem_220452 + (int64_t) 0, t_n_m_203650 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220368);
    free(mem_220371);
    free(mem_220374);
    free(mem_220449);
    free(mem_220452);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236522_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236522_end -
                 futhark_mc_segmap_parloop_236522_start;
        
        ctx->futhark_mc_segmap_parloop_236522_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236522_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236522_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236520(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215322 = tid;
    int num_tasks_234163 = info.nsubtasks;
    struct futhark_mc_task_236507 *futhark_mc_task_236507 =
                                  (struct futhark_mc_task_236507 *) args;
    struct futhark_context *ctx = futhark_mc_task_236507->ctx;
    uint64_t futhark_mc_segmap_nested_task_236520_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236520_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236507->free_n_203490;
    int64_t q_t_203494 = futhark_mc_task_236507->free_q_t_203494;
    int64_t jump_t_203500 = futhark_mc_task_236507->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236507->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236507->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236507->free_i_203670;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236507->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236507->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236507->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_217343 = {.desc ="mem_217343", .mem =
                                  futhark_mc_task_236507->free_mem_217343,
                                  .size =0, .references =NULL};
    int64_t bytes_217782 = futhark_mc_task_236507->free_bytes_217782;
    struct memblock mem_217835 = {.desc ="mem_217835", .mem =
                                  futhark_mc_task_236507->free_mem_217835,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_236507->free_mem_217839,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217866 =
            futhark_mc_task_236507->free_ctx_param_ext_217866;
    int64_t ctx_param_ext_217867 =
            futhark_mc_task_236507->free_ctx_param_ext_217867;
    int64_t ctx_param_ext_217869 =
            futhark_mc_task_236507->free_ctx_param_ext_217869;
    struct memblock mem_param_217871 = {.desc ="mem_param_217871", .mem =
                                        futhark_mc_task_236507->free_mem_param_217871,
                                        .size =0, .references =NULL};
    struct memblock mem_219808 = {.desc ="mem_219808", .mem =
                                  futhark_mc_task_236507->free_mem_219808,
                                  .size =0, .references =NULL};
    int64_t bytes_220376 = futhark_mc_task_236507->free_bytes_220376;
    struct memblock mem_220591 = {.desc ="mem_220591", .mem =
                                  futhark_mc_task_236507->free_mem_220591,
                                  .size =0, .references =NULL};
    struct memblock mem_220595 = {.desc ="mem_220595", .mem =
                                  futhark_mc_task_236507->free_mem_220595,
                                  .size =0, .references =NULL};
    int64_t iter_234324;
    struct futhark_mc_segmap_parloop_struct_236521
    futhark_mc_segmap_parloop_struct_236521;
    
    futhark_mc_segmap_parloop_struct_236521.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236521.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236521.free_q_t_203494 = q_t_203494;
    futhark_mc_segmap_parloop_struct_236521.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236521.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236521.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236521.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236521.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236521.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236521.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236521.free_mem_217343 = mem_217343.mem;
    futhark_mc_segmap_parloop_struct_236521.free_bytes_217782 = bytes_217782;
    futhark_mc_segmap_parloop_struct_236521.free_mem_217835 = mem_217835.mem;
    futhark_mc_segmap_parloop_struct_236521.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_236521.free_ctx_param_ext_217866 =
        ctx_param_ext_217866;
    futhark_mc_segmap_parloop_struct_236521.free_ctx_param_ext_217867 =
        ctx_param_ext_217867;
    futhark_mc_segmap_parloop_struct_236521.free_ctx_param_ext_217869 =
        ctx_param_ext_217869;
    futhark_mc_segmap_parloop_struct_236521.free_mem_param_217871 =
        mem_param_217871.mem;
    futhark_mc_segmap_parloop_struct_236521.free_mem_219808 = mem_219808.mem;
    futhark_mc_segmap_parloop_struct_236521.free_bytes_220376 = bytes_220376;
    futhark_mc_segmap_parloop_struct_236521.free_mem_220591 = mem_220591.mem;
    futhark_mc_segmap_parloop_struct_236521.free_mem_220595 = mem_220595.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236522_task;
    
    futhark_mc_segmap_parloop_236522_task.name =
        "futhark_mc_segmap_parloop_236522";
    futhark_mc_segmap_parloop_236522_task.fn = futhark_mc_segmap_parloop_236522;
    futhark_mc_segmap_parloop_236522_task.args =
        &futhark_mc_segmap_parloop_struct_236521;
    futhark_mc_segmap_parloop_236522_task.iterations = iterations;
    futhark_mc_segmap_parloop_236522_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236522_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236522_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236522_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236522_task);
    
    if (futhark_mc_segmap_parloop_236522_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236522_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236522_total_end -
                 futhark_mc_segmap_parloop_236522_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236522_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236522_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236522_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236520_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236520_end -
                 futhark_mc_segmap_nested_task_236520_start;
        
        ctx->futhark_mc_segmap_nested_task_236520_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236520_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236520_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236570 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_y_206583;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_220600;
    unsigned char *free_ext_mem_220601;
    unsigned char *free_mem_220623;
};
struct futhark_mc_segmap_parloop_struct_236572 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_y_206583;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_220600;
    unsigned char *free_ext_mem_220601;
    unsigned char *free_mem_220623;
};
static int futhark_mc_segmap_parloop_236573(void *args, int64_t start,
                                            int64_t end, int flat_tid_215581,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236572
    *futhark_mc_segmap_parloop_struct_236572 =
    (struct futhark_mc_segmap_parloop_struct_236572 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236572->ctx;
    uint64_t futhark_mc_segmap_parloop_236573_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236573_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236572->free_n_203490;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236572->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236572->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236572->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236572->free_i_203670;
    int64_t y_206583 = futhark_mc_segmap_parloop_struct_236572->free_y_206583;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236572->free_bytes_217302;
    struct memblock ext_mem_220600 = {.desc ="ext_mem_220600", .mem =
                                      futhark_mc_segmap_parloop_struct_236572->free_ext_mem_220600,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220601 = {.desc ="ext_mem_220601", .mem =
                                      futhark_mc_segmap_parloop_struct_236572->free_ext_mem_220601,
                                      .size =0, .references =NULL};
    struct memblock mem_220623 = {.desc ="mem_220623", .mem =
                                  futhark_mc_segmap_parloop_struct_236572->free_mem_220623,
                                  .size =0, .references =NULL};
    size_t mem_220607_cached_sizze_236574 = 0;
    unsigned char *mem_220607 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234812 = start;
    
    if (mem_220607_cached_sizze_236574 < (size_t) bytes_217302) {
        mem_220607 = realloc(mem_220607, bytes_217302);
        mem_220607_cached_sizze_236574 = bytes_217302;
    }
    for (; iter_234812 < end; iter_234812++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234862 = partition_sizze_203577;
        int64_t gtid_215582 = iter_234812;
        int64_t remnant_234863 = iter_234812 - gtid_215582;
        
        for (int64_t i_234813 = 0; i_234813 < n_203490; i_234813++) {
            int64_t m_v_234815 = sdiv64(i_234813, jump_t_203500);
            bool cond_234816 = m_v_234815 == y_206583;
            int64_t j_234817;
            
            if (cond_234816) {
                int64_t j_t_res_234818 = sub64(m_v_234815, (int64_t) 1);
                
                j_234817 = j_t_res_234818;
            } else {
                j_234817 = m_v_234815;
            }
            
            int64_t min_arg_234819 = mul64(jump_t_203500, j_234817);
            int64_t min_res_234820 = smin64(i_203670, min_arg_234819);
            int64_t defunc_0_m_fun_arg_234821 = add64((int64_t) 1, j_234817);
            int64_t min_arg_234822 = mul64(jump_t_203500,
                                           defunc_0_m_fun_arg_234821);
            int64_t min_res_234823 = smin64(i_203670, min_arg_234822);
            int64_t i64_arg_234824 = sub64(min_res_234823, min_res_234820);
            double i64_res_234825 = sitofp_i64_f64(i64_arg_234824);
            int64_t i64_arg_234826 = sub64(i_234813, min_res_234820);
            double i64_res_234827 = sitofp_i64_f64(i64_arg_234826);
            double u_234828 = i64_res_234827 / i64_res_234825;
            double u2_234829 = u_234828 * u_234828;
            double u3_234830 = u_234828 * u2_234829;
            double x_234831 = 2.0 * u3_234830;
            double y_234832 = 3.0 * u2_234829;
            double x_234833 = x_234831 - y_234832;
            double x_234834 = 1.0 + x_234833;
            bool x_234835 = sle64((int64_t) 0, j_234817);
            bool y_234836 = slt64(j_234817, t_n_m_203650);
            bool bounds_check_234837 = x_234835 && y_234836;
            bool index_certs_234838;
            
            if (!bounds_check_234837) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) j_234817,
                              "] out of bounds for array of shape [",
                              (long long) t_n_m_203650, "].",
                              "-> #0  loess.fut:536:27-33\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:304:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:303:15-305:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double y_234839;
            
            y_234839 = ((double *) ext_mem_220601.mem)[gtid_215582 *
                                                       t_n_m_203650 + j_234817];
            
            double x_234840 = x_234834 * y_234839;
            double x_234841 = y_234832 - x_234831;
            bool x_234842 = sle64((int64_t) 0, defunc_0_m_fun_arg_234821);
            bool y_234843 = slt64(defunc_0_m_fun_arg_234821, t_n_m_203650);
            bool bounds_check_234844 = x_234842 && y_234843;
            bool index_certs_234845;
            
            if (!bounds_check_234844) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) defunc_0_m_fun_arg_234821,
                              "] out of bounds for array of shape [",
                              (long long) t_n_m_203650, "].",
                              "-> #0  loess.fut:537:27-37\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:304:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:303:15-305:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double y_234846;
            
            y_234846 = ((double *) ext_mem_220601.mem)[gtid_215582 *
                                                       t_n_m_203650 +
                                                       defunc_0_m_fun_arg_234821];
            
            double y_234847 = x_234841 * y_234846;
            double x_234848 = x_234840 + y_234847;
            double y_234849 = 2.0 * u2_234829;
            double x_234850 = u3_234830 - y_234849;
            double x_234851 = u_234828 + x_234850;
            double y_234852;
            
            y_234852 = ((double *) ext_mem_220600.mem)[gtid_215582 *
                                                       t_n_m_203650 + j_234817];
            
            double x_234853 = x_234851 * y_234852;
            double y_234854 = i64_res_234825 * x_234853;
            double x_234855 = x_234848 + y_234854;
            double x_234856 = u3_234830 - u2_234829;
            double y_234857;
            
            y_234857 = ((double *) ext_mem_220600.mem)[gtid_215582 *
                                                       t_n_m_203650 +
                                                       defunc_0_m_fun_arg_234821];
            
            double x_234858 = x_234856 * y_234857;
            double y_234859 = i64_res_234825 * x_234858;
            double defunc_4_interpolate_proc_res_234860 = x_234855 + y_234859;
            
            ((double *) mem_220607)[i_234813] =
                defunc_4_interpolate_proc_res_234860;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220623.mem + gtid_215582 * n_203490 * (int64_t) 8,
                    mem_220607 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220607);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236573_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236573_end -
                 futhark_mc_segmap_parloop_236573_start;
        
        ctx->futhark_mc_segmap_parloop_236573_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236573_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236573_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236571(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215581 = tid;
    int num_tasks_234811 = info.nsubtasks;
    struct futhark_mc_task_236570 *futhark_mc_task_236570 =
                                  (struct futhark_mc_task_236570 *) args;
    struct futhark_context *ctx = futhark_mc_task_236570->ctx;
    uint64_t futhark_mc_segmap_task_236571_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236571_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236570->free_n_203490;
    int64_t jump_t_203500 = futhark_mc_task_236570->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236570->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236570->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236570->free_i_203670;
    int64_t y_206583 = futhark_mc_task_236570->free_y_206583;
    int64_t bytes_217302 = futhark_mc_task_236570->free_bytes_217302;
    struct memblock ext_mem_220600 = {.desc ="ext_mem_220600", .mem =
                                      futhark_mc_task_236570->free_ext_mem_220600,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220601 = {.desc ="ext_mem_220601", .mem =
                                      futhark_mc_task_236570->free_ext_mem_220601,
                                      .size =0, .references =NULL};
    struct memblock mem_220623 = {.desc ="mem_220623", .mem =
                                  futhark_mc_task_236570->free_mem_220623,
                                  .size =0, .references =NULL};
    int64_t iter_234812;
    struct futhark_mc_segmap_parloop_struct_236572
    futhark_mc_segmap_parloop_struct_236572;
    
    futhark_mc_segmap_parloop_struct_236572.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236572.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236572.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236572.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236572.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236572.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236572.free_y_206583 = y_206583;
    futhark_mc_segmap_parloop_struct_236572.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236572.free_ext_mem_220600 =
        ext_mem_220600.mem;
    futhark_mc_segmap_parloop_struct_236572.free_ext_mem_220601 =
        ext_mem_220601.mem;
    futhark_mc_segmap_parloop_struct_236572.free_mem_220623 = mem_220623.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236573_task;
    
    futhark_mc_segmap_parloop_236573_task.name =
        "futhark_mc_segmap_parloop_236573";
    futhark_mc_segmap_parloop_236573_task.fn = futhark_mc_segmap_parloop_236573;
    futhark_mc_segmap_parloop_236573_task.args =
        &futhark_mc_segmap_parloop_struct_236572;
    futhark_mc_segmap_parloop_236573_task.iterations = iterations;
    futhark_mc_segmap_parloop_236573_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236573_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236573_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236573_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236573_task);
    
    if (futhark_mc_segmap_parloop_236573_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236573_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236573_total_end -
                 futhark_mc_segmap_parloop_236573_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236573_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236573_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236573_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236571_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236571_end -
                 futhark_mc_segmap_task_236571_start;
        
        ctx->futhark_mc_segmap_task_236571_runs[tid]++;
        ctx->futhark_mc_segmap_task_236571_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236571_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236576 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_t_203500;
    int64_t free_partition_sizze_203577;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_y_206583;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_220600;
    unsigned char *free_ext_mem_220601;
    unsigned char *free_mem_220623;
};
struct futhark_mc_task_236579 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_y_206583;
    int64_t free_gtid_215588;
    unsigned char *free_ext_mem_220600;
    unsigned char *free_ext_mem_220601;
    unsigned char *free_mem_220604;
};
struct futhark_mc_segmap_parloop_struct_236581 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_jump_t_203500;
    int64_t free_t_n_m_203650;
    int64_t free_i_203670;
    int64_t free_y_206583;
    int64_t free_gtid_215588;
    unsigned char *free_ext_mem_220600;
    unsigned char *free_ext_mem_220601;
    unsigned char *free_mem_220604;
};
static int futhark_mc_segmap_parloop_236582(void *args, int64_t start,
                                            int64_t end, int flat_tid_234866,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236581
    *futhark_mc_segmap_parloop_struct_236581 =
    (struct futhark_mc_segmap_parloop_struct_236581 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236581->ctx;
    uint64_t futhark_mc_segmap_parloop_236582_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236582_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236581->free_n_203490;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236581->free_jump_t_203500;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236581->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236581->free_i_203670;
    int64_t y_206583 = futhark_mc_segmap_parloop_struct_236581->free_y_206583;
    int64_t gtid_215588 =
            futhark_mc_segmap_parloop_struct_236581->free_gtid_215588;
    struct memblock ext_mem_220600 = {.desc ="ext_mem_220600", .mem =
                                      futhark_mc_segmap_parloop_struct_236581->free_ext_mem_220600,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220601 = {.desc ="ext_mem_220601", .mem =
                                      futhark_mc_segmap_parloop_struct_236581->free_ext_mem_220601,
                                      .size =0, .references =NULL};
    struct memblock mem_220604 = {.desc ="mem_220604", .mem =
                                  futhark_mc_segmap_parloop_struct_236581->free_mem_220604,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234917 = start;
    
    for (; iter_234917 < end; iter_234917++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234919 = n_203490;
        int64_t gtid_234867 = iter_234917;
        int64_t remnant_234920 = iter_234917 - gtid_234867;
        int64_t m_v_234868 = sdiv64(gtid_234867, jump_t_203500);
        bool cond_234869 = m_v_234868 == y_206583;
        int64_t j_234870;
        
        if (cond_234869) {
            int64_t j_t_res_234918 = sub64(m_v_234868, (int64_t) 1);
            
            j_234870 = j_t_res_234918;
        } else {
            j_234870 = m_v_234868;
        }
        
        int64_t min_arg_234872 = mul64(jump_t_203500, j_234870);
        int64_t min_res_234873 = smin64(i_203670, min_arg_234872);
        int64_t defunc_0_m_fun_arg_234874 = add64((int64_t) 1, j_234870);
        int64_t min_arg_234875 = mul64(jump_t_203500,
                                       defunc_0_m_fun_arg_234874);
        int64_t min_res_234876 = smin64(i_203670, min_arg_234875);
        int64_t i64_arg_234877 = sub64(min_res_234876, min_res_234873);
        double i64_res_234878 = sitofp_i64_f64(i64_arg_234877);
        int64_t i64_arg_234879 = sub64(gtid_234867, min_res_234873);
        double i64_res_234880 = sitofp_i64_f64(i64_arg_234879);
        double u_234881 = i64_res_234880 / i64_res_234878;
        double u2_234882 = u_234881 * u_234881;
        double u3_234883 = u_234881 * u2_234882;
        double x_234884 = 2.0 * u3_234883;
        double y_234885 = 3.0 * u2_234882;
        double x_234886 = x_234884 - y_234885;
        double x_234887 = 1.0 + x_234886;
        bool x_234888 = sle64((int64_t) 0, j_234870);
        bool y_234889 = slt64(j_234870, t_n_m_203650);
        bool bounds_check_234890 = x_234888 && y_234889;
        bool index_certs_234891;
        
        if (!bounds_check_234890) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) j_234870,
                                   "] out of bounds for array of shape [",
                                   (long long) t_n_m_203650, "].",
                                   "-> #0  loess.fut:536:27-33\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:304:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:303:15-305:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        double y_234892;
        
        y_234892 = ((double *) ext_mem_220601.mem)[gtid_215588 * t_n_m_203650 +
                                                   j_234870];
        
        double x_234893 = x_234887 * y_234892;
        double x_234894 = y_234885 - x_234884;
        bool x_234895 = sle64((int64_t) 0, defunc_0_m_fun_arg_234874);
        bool y_234896 = slt64(defunc_0_m_fun_arg_234874, t_n_m_203650);
        bool bounds_check_234897 = x_234895 && y_234896;
        bool index_certs_234898;
        
        if (!bounds_check_234897) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [",
                                   (long long) defunc_0_m_fun_arg_234874,
                                   "] out of bounds for array of shape [",
                                   (long long) t_n_m_203650, "].",
                                   "-> #0  loess.fut:537:27-37\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  stl.fut:304:23-75\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  stl.fut:303:15-305:43\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
            err = 1;
            goto cleanup;
        }
        
        double y_234899;
        
        y_234899 = ((double *) ext_mem_220601.mem)[gtid_215588 * t_n_m_203650 +
                                                   defunc_0_m_fun_arg_234874];
        
        double y_234900 = x_234894 * y_234899;
        double x_234901 = x_234893 + y_234900;
        double y_234902 = 2.0 * u2_234882;
        double x_234903 = u3_234883 - y_234902;
        double x_234904 = u_234881 + x_234903;
        double y_234905;
        
        y_234905 = ((double *) ext_mem_220600.mem)[gtid_215588 * t_n_m_203650 +
                                                   j_234870];
        
        double x_234906 = x_234904 * y_234905;
        double y_234907 = i64_res_234878 * x_234906;
        double x_234908 = x_234901 + y_234907;
        double x_234909 = u3_234883 - u2_234882;
        double y_234910;
        
        y_234910 = ((double *) ext_mem_220600.mem)[gtid_215588 * t_n_m_203650 +
                                                   defunc_0_m_fun_arg_234874];
        
        double x_234911 = x_234909 * y_234910;
        double y_234912 = i64_res_234878 * x_234911;
        double defunc_4_interpolate_proc_res_234913 = x_234908 + y_234912;
        
        ((double *) mem_220604.mem)[gtid_234867] =
            defunc_4_interpolate_proc_res_234913;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236582_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236582_end -
                 futhark_mc_segmap_parloop_236582_start;
        
        ctx->futhark_mc_segmap_parloop_236582_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236582_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236582_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236580(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234866 = tid;
    int num_tasks_234916 = info.nsubtasks;
    struct futhark_mc_task_236579 *futhark_mc_task_236579 =
                                  (struct futhark_mc_task_236579 *) args;
    struct futhark_context *ctx = futhark_mc_task_236579->ctx;
    uint64_t futhark_mc_segmap_task_236580_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236580_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236579->free_n_203490;
    int64_t jump_t_203500 = futhark_mc_task_236579->free_jump_t_203500;
    int64_t t_n_m_203650 = futhark_mc_task_236579->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236579->free_i_203670;
    int64_t y_206583 = futhark_mc_task_236579->free_y_206583;
    int64_t gtid_215588 = futhark_mc_task_236579->free_gtid_215588;
    struct memblock ext_mem_220600 = {.desc ="ext_mem_220600", .mem =
                                      futhark_mc_task_236579->free_ext_mem_220600,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220601 = {.desc ="ext_mem_220601", .mem =
                                      futhark_mc_task_236579->free_ext_mem_220601,
                                      .size =0, .references =NULL};
    struct memblock mem_220604 = {.desc ="mem_220604", .mem =
                                  futhark_mc_task_236579->free_mem_220604,
                                  .size =0, .references =NULL};
    int64_t iter_234917;
    struct futhark_mc_segmap_parloop_struct_236581
    futhark_mc_segmap_parloop_struct_236581;
    
    futhark_mc_segmap_parloop_struct_236581.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236581.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236581.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236581.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236581.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236581.free_y_206583 = y_206583;
    futhark_mc_segmap_parloop_struct_236581.free_gtid_215588 = gtid_215588;
    futhark_mc_segmap_parloop_struct_236581.free_ext_mem_220600 =
        ext_mem_220600.mem;
    futhark_mc_segmap_parloop_struct_236581.free_ext_mem_220601 =
        ext_mem_220601.mem;
    futhark_mc_segmap_parloop_struct_236581.free_mem_220604 = mem_220604.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236582_task;
    
    futhark_mc_segmap_parloop_236582_task.name =
        "futhark_mc_segmap_parloop_236582";
    futhark_mc_segmap_parloop_236582_task.fn = futhark_mc_segmap_parloop_236582;
    futhark_mc_segmap_parloop_236582_task.args =
        &futhark_mc_segmap_parloop_struct_236581;
    futhark_mc_segmap_parloop_236582_task.iterations = iterations;
    futhark_mc_segmap_parloop_236582_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236582_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236582_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236582_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236582_task);
    
    if (futhark_mc_segmap_parloop_236582_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236582_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236582_total_end -
                 futhark_mc_segmap_parloop_236582_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236582_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236582_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236582_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236580_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236580_end -
                 futhark_mc_segmap_task_236580_start;
        
        ctx->futhark_mc_segmap_task_236580_runs[tid]++;
        ctx->futhark_mc_segmap_task_236580_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236580_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236577(void *args, int64_t start,
                                            int64_t end, int flat_tid_215587,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236576
    *futhark_mc_segmap_parloop_struct_236576 =
    (struct futhark_mc_segmap_parloop_struct_236576 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236576->ctx;
    uint64_t futhark_mc_segmap_parloop_236577_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236577_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236576->free_n_203490;
    int64_t jump_t_203500 =
            futhark_mc_segmap_parloop_struct_236576->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236576->free_partition_sizze_203577;
    int64_t t_n_m_203650 =
            futhark_mc_segmap_parloop_struct_236576->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236576->free_i_203670;
    int64_t y_206583 = futhark_mc_segmap_parloop_struct_236576->free_y_206583;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236576->free_bytes_217302;
    struct memblock ext_mem_220600 = {.desc ="ext_mem_220600", .mem =
                                      futhark_mc_segmap_parloop_struct_236576->free_ext_mem_220600,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220601 = {.desc ="ext_mem_220601", .mem =
                                      futhark_mc_segmap_parloop_struct_236576->free_ext_mem_220601,
                                      .size =0, .references =NULL};
    struct memblock mem_220623 = {.desc ="mem_220623", .mem =
                                  futhark_mc_segmap_parloop_struct_236576->free_mem_220623,
                                  .size =0, .references =NULL};
    size_t mem_220604_cached_sizze_236578 = 0;
    unsigned char *mem_220604 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234865 = start;
    
    if (mem_220604_cached_sizze_236578 < (size_t) bytes_217302) {
        mem_220604 = realloc(mem_220604, bytes_217302);
        mem_220604_cached_sizze_236578 = bytes_217302;
    }
    for (; iter_234865 < end; iter_234865++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234914 = partition_sizze_203577;
        int64_t gtid_215588 = iter_234865;
        int64_t remnant_234915 = iter_234865 - gtid_215588;
        int64_t flat_tid_234866 = (int64_t) 0;
        int32_t num_tasks_234916;
        struct futhark_mc_task_236579 futhark_mc_task_236579;
        
        futhark_mc_task_236579.ctx = ctx;
        futhark_mc_task_236579.free_n_203490 = n_203490;
        futhark_mc_task_236579.free_jump_t_203500 = jump_t_203500;
        futhark_mc_task_236579.free_t_n_m_203650 = t_n_m_203650;
        futhark_mc_task_236579.free_i_203670 = i_203670;
        futhark_mc_task_236579.free_y_206583 = y_206583;
        futhark_mc_task_236579.free_gtid_215588 = gtid_215588;
        futhark_mc_task_236579.free_ext_mem_220600 = ext_mem_220600.mem;
        futhark_mc_task_236579.free_ext_mem_220601 = ext_mem_220601.mem;
        futhark_mc_task_236579.free_mem_220604 = mem_220604;
        
        struct scheduler_segop futhark_mc_task_236579_task;
        
        futhark_mc_task_236579_task.args = &futhark_mc_task_236579;
        futhark_mc_task_236579_task.top_level_fn =
            futhark_mc_segmap_task_236580;
        futhark_mc_task_236579_task.name = "futhark_mc_segmap_task_236580";
        futhark_mc_task_236579_task.iterations = n_203490;
        futhark_mc_task_236579_task.task_time =
            &ctx->futhark_mc_segmap_task_236580_total_time;
        futhark_mc_task_236579_task.task_iter =
            &ctx->futhark_mc_segmap_task_236580_total_iter;
        futhark_mc_task_236579_task.sched = STATIC;
        futhark_mc_task_236579_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236580_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236579_task);
        
        if (futhark_mc_segmap_task_236580_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220623.mem + gtid_215588 * n_203490 * (int64_t) 8,
                    mem_220604 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220604);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236577_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236577_end -
                 futhark_mc_segmap_parloop_236577_start;
        
        ctx->futhark_mc_segmap_parloop_236577_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236577_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236577_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236575(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215587 = tid;
    int num_tasks_234811 = info.nsubtasks;
    struct futhark_mc_task_236570 *futhark_mc_task_236570 =
                                  (struct futhark_mc_task_236570 *) args;
    struct futhark_context *ctx = futhark_mc_task_236570->ctx;
    uint64_t futhark_mc_segmap_nested_task_236575_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236575_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236570->free_n_203490;
    int64_t jump_t_203500 = futhark_mc_task_236570->free_jump_t_203500;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236570->free_partition_sizze_203577;
    int64_t t_n_m_203650 = futhark_mc_task_236570->free_t_n_m_203650;
    int64_t i_203670 = futhark_mc_task_236570->free_i_203670;
    int64_t y_206583 = futhark_mc_task_236570->free_y_206583;
    int64_t bytes_217302 = futhark_mc_task_236570->free_bytes_217302;
    struct memblock ext_mem_220600 = {.desc ="ext_mem_220600", .mem =
                                      futhark_mc_task_236570->free_ext_mem_220600,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220601 = {.desc ="ext_mem_220601", .mem =
                                      futhark_mc_task_236570->free_ext_mem_220601,
                                      .size =0, .references =NULL};
    struct memblock mem_220623 = {.desc ="mem_220623", .mem =
                                  futhark_mc_task_236570->free_mem_220623,
                                  .size =0, .references =NULL};
    int64_t iter_234865;
    struct futhark_mc_segmap_parloop_struct_236576
    futhark_mc_segmap_parloop_struct_236576;
    
    futhark_mc_segmap_parloop_struct_236576.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236576.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236576.free_jump_t_203500 = jump_t_203500;
    futhark_mc_segmap_parloop_struct_236576.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236576.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_segmap_parloop_struct_236576.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236576.free_y_206583 = y_206583;
    futhark_mc_segmap_parloop_struct_236576.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236576.free_ext_mem_220600 =
        ext_mem_220600.mem;
    futhark_mc_segmap_parloop_struct_236576.free_ext_mem_220601 =
        ext_mem_220601.mem;
    futhark_mc_segmap_parloop_struct_236576.free_mem_220623 = mem_220623.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236577_task;
    
    futhark_mc_segmap_parloop_236577_task.name =
        "futhark_mc_segmap_parloop_236577";
    futhark_mc_segmap_parloop_236577_task.fn = futhark_mc_segmap_parloop_236577;
    futhark_mc_segmap_parloop_236577_task.args =
        &futhark_mc_segmap_parloop_struct_236576;
    futhark_mc_segmap_parloop_236577_task.iterations = iterations;
    futhark_mc_segmap_parloop_236577_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236577_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236577_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236577_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236577_task);
    
    if (futhark_mc_segmap_parloop_236577_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236577_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236577_total_end -
                 futhark_mc_segmap_parloop_236577_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236577_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236577_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236577_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236575_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236575_end -
                 futhark_mc_segmap_nested_task_236575_start;
        
        ctx->futhark_mc_segmap_nested_task_236575_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236575_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236575_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236583 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_ext_mem_220630;
    unsigned char *free_ext_mem_220631;
    int64_t free_ext_220635;
    unsigned char *free_mem_220685;
    unsigned char *free_mem_220689;
};
struct futhark_mc_segmap_parloop_struct_236585 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_ext_mem_220630;
    unsigned char *free_ext_mem_220631;
    int64_t free_ext_220635;
    unsigned char *free_mem_220685;
    unsigned char *free_mem_220689;
};
static int futhark_mc_segmap_parloop_236586(void *args, int64_t start,
                                            int64_t end, int flat_tid_215641,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236585
    *futhark_mc_segmap_parloop_struct_236585 =
    (struct futhark_mc_segmap_parloop_struct_236585 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236585->ctx;
    uint64_t futhark_mc_segmap_parloop_236586_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236586_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236585->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236585->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236585->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236585->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236585->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220630 = {.desc ="ext_mem_220630", .mem =
                                      futhark_mc_segmap_parloop_struct_236585->free_ext_mem_220630,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220631 = {.desc ="ext_mem_220631", .mem =
                                      futhark_mc_segmap_parloop_struct_236585->free_ext_mem_220631,
                                      .size =0, .references =NULL};
    int64_t ext_220635 =
            futhark_mc_segmap_parloop_struct_236585->free_ext_220635;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_segmap_parloop_struct_236585->free_mem_220685,
                                  .size =0, .references =NULL};
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_segmap_parloop_struct_236585->free_mem_220689,
                                  .size =0, .references =NULL};
    size_t mem_220654_cached_sizze_236587 = 0;
    unsigned char *mem_220654 = NULL;
    size_t mem_220669_cached_sizze_236588 = 0;
    unsigned char *mem_220669 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234922 = start;
    
    if (mem_220654_cached_sizze_236587 < (size_t) bytes_217302) {
        mem_220654 = realloc(mem_220654, bytes_217302);
        mem_220654_cached_sizze_236587 = bytes_217302;
    }
    if (mem_220669_cached_sizze_236588 < (size_t) bytes_217302) {
        mem_220669 = realloc(mem_220669, bytes_217302);
        mem_220669_cached_sizze_236588 = bytes_217302;
    }
    for (; iter_234922 < end; iter_234922++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234944 = partition_sizze_203577;
        int64_t gtid_215642 = iter_234922;
        int64_t remnant_234945 = iter_234922 - gtid_215642;
        
        for (int64_t i_234923 = 0; i_234923 < n_203490; i_234923++) {
            double x_234925;
            
            x_234925 = ((double *) mem_217297.mem)[gtid_215642 * n_203490 +
                                                   i_234923];
            
            double x_234926;
            
            x_234926 = ((double *) ext_mem_220631.mem)[gtid_215642 * n_203490 +
                                                       i_234923];
            
            double x_234927;
            
            x_234927 = ((double *) ext_mem_220630.mem)[gtid_215642 *
                                                       ext_220635 + i_234923];
            
            double x_234928 = x_234925 - x_234926;
            double defunc_2_f_res_234929 = x_234928 - x_234927;
            bool isnan_res_234930;
            
            isnan_res_234930 = futrts_isnan64(defunc_2_f_res_234929);
            
            double defunc_0_f_res_234931;
            
            if (isnan_res_234930) {
                defunc_0_f_res_234931 = defunc_2_f_res_234929;
            } else {
                double abs_res_234932 = fabs(defunc_2_f_res_234929);
                
                defunc_0_f_res_234931 = abs_res_234932;
            }
            ((double *) mem_220654)[i_234923] = defunc_0_f_res_234931;
        }
        for (int64_t i_234934 = 0; i_234934 < n_203490; i_234934++) {
            int64_t x_234936;
            
            x_234936 = ((int64_t *) mem_217340.mem)[gtid_215642 * n_203490 +
                                                    i_234934];
            
            bool cond_234937 = sle64((int64_t) 0, x_234936);
            double defunc_0_f_res_234938;
            
            if (cond_234937) {
                bool y_234939 = slt64(x_234936, n_203490);
                bool bounds_check_234940 = cond_234937 && y_234939;
                bool index_certs_234941;
                
                if (!bounds_check_234940) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_234936,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203490, "].",
                                  "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:334:21-49\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:332:13-335:35\n   #6  stl.fut:415:61-429:75\n   #7  stl.fut:455:3-469:34\n   #8  stl.fut:439:1-469:34\n");
                    err = 1;
                    goto cleanup;
                }
                
                double defunc_0_f_res_t_res_234942;
                
                defunc_0_f_res_t_res_234942 = ((double *) mem_220654)[x_234936];
                defunc_0_f_res_234938 = defunc_0_f_res_t_res_234942;
            } else {
                defunc_0_f_res_234938 = INFINITY;
            }
            ((double *) mem_220669)[i_234934] = defunc_0_f_res_234938;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220685.mem + gtid_215642 * n_203490 * (int64_t) 8,
                    mem_220669 + (int64_t) 0, n_203490 * (int64_t) 8);
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220689.mem + gtid_215642 * n_203490 * (int64_t) 8,
                    mem_220654 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220654);
    free(mem_220669);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236586_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236586_end -
                 futhark_mc_segmap_parloop_236586_start;
        
        ctx->futhark_mc_segmap_parloop_236586_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236586_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236586_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236584(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215641 = tid;
    int num_tasks_234921 = info.nsubtasks;
    struct futhark_mc_task_236583 *futhark_mc_task_236583 =
                                  (struct futhark_mc_task_236583 *) args;
    struct futhark_context *ctx = futhark_mc_task_236583->ctx;
    uint64_t futhark_mc_segmap_task_236584_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236584_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236583->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236583->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236583->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236583->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236583->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220630 = {.desc ="ext_mem_220630", .mem =
                                      futhark_mc_task_236583->free_ext_mem_220630,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220631 = {.desc ="ext_mem_220631", .mem =
                                      futhark_mc_task_236583->free_ext_mem_220631,
                                      .size =0, .references =NULL};
    int64_t ext_220635 = futhark_mc_task_236583->free_ext_220635;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_task_236583->free_mem_220685,
                                  .size =0, .references =NULL};
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_task_236583->free_mem_220689,
                                  .size =0, .references =NULL};
    int64_t iter_234922;
    struct futhark_mc_segmap_parloop_struct_236585
    futhark_mc_segmap_parloop_struct_236585;
    
    futhark_mc_segmap_parloop_struct_236585.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236585.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236585.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236585.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236585.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236585.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236585.free_ext_mem_220630 =
        ext_mem_220630.mem;
    futhark_mc_segmap_parloop_struct_236585.free_ext_mem_220631 =
        ext_mem_220631.mem;
    futhark_mc_segmap_parloop_struct_236585.free_ext_220635 = ext_220635;
    futhark_mc_segmap_parloop_struct_236585.free_mem_220685 = mem_220685.mem;
    futhark_mc_segmap_parloop_struct_236585.free_mem_220689 = mem_220689.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236586_task;
    
    futhark_mc_segmap_parloop_236586_task.name =
        "futhark_mc_segmap_parloop_236586";
    futhark_mc_segmap_parloop_236586_task.fn = futhark_mc_segmap_parloop_236586;
    futhark_mc_segmap_parloop_236586_task.args =
        &futhark_mc_segmap_parloop_struct_236585;
    futhark_mc_segmap_parloop_236586_task.iterations = iterations;
    futhark_mc_segmap_parloop_236586_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236586_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236586_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236586_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236586_task);
    
    if (futhark_mc_segmap_parloop_236586_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236586_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236586_total_end -
                 futhark_mc_segmap_parloop_236586_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236586_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236586_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236586_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236584_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236584_end -
                 futhark_mc_segmap_task_236584_start;
        
        ctx->futhark_mc_segmap_task_236584_runs[tid]++;
        ctx->futhark_mc_segmap_task_236584_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236584_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236590 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    int64_t free_bytes_217302;
    unsigned char *free_mem_217340;
    unsigned char *free_ext_mem_220630;
    unsigned char *free_ext_mem_220631;
    int64_t free_ext_220635;
    unsigned char *free_mem_220685;
    unsigned char *free_mem_220689;
};
struct futhark_mc_task_236594 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215650;
    unsigned char *free_mem_217297;
    unsigned char *free_ext_mem_220630;
    unsigned char *free_ext_mem_220631;
    int64_t free_ext_220635;
    unsigned char *free_mem_220648;
};
struct futhark_mc_segmap_parloop_struct_236596 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215650;
    unsigned char *free_mem_217297;
    unsigned char *free_ext_mem_220630;
    unsigned char *free_ext_mem_220631;
    int64_t free_ext_220635;
    unsigned char *free_mem_220648;
};
static int futhark_mc_segmap_parloop_236597(void *args, int64_t start,
                                            int64_t end, int flat_tid_234949,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236596
    *futhark_mc_segmap_parloop_struct_236596 =
    (struct futhark_mc_segmap_parloop_struct_236596 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236596->ctx;
    uint64_t futhark_mc_segmap_parloop_236597_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236597_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236596->free_n_203490;
    int64_t gtid_215650 =
            futhark_mc_segmap_parloop_struct_236596->free_gtid_215650;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220630 = {.desc ="ext_mem_220630", .mem =
                                      futhark_mc_segmap_parloop_struct_236596->free_ext_mem_220630,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220631 = {.desc ="ext_mem_220631", .mem =
                                      futhark_mc_segmap_parloop_struct_236596->free_ext_mem_220631,
                                      .size =0, .references =NULL};
    int64_t ext_220635 =
            futhark_mc_segmap_parloop_struct_236596->free_ext_220635;
    struct memblock mem_220648 = {.desc ="mem_220648", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_220648,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234971 = start;
    
    for (; iter_234971 < end; iter_234971++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234973 = n_203490;
        int64_t gtid_234950 = iter_234971;
        int64_t remnant_234974 = iter_234971 - gtid_234950;
        double x_234951;
        
        x_234951 = ((double *) mem_217297.mem)[gtid_215650 * n_203490 +
                                               gtid_234950];
        
        double x_234952;
        
        x_234952 = ((double *) ext_mem_220631.mem)[gtid_215650 * n_203490 +
                                                   gtid_234950];
        
        double x_234953;
        
        x_234953 = ((double *) ext_mem_220630.mem)[gtid_215650 * ext_220635 +
                                                   gtid_234950];
        
        double x_234954 = x_234951 - x_234952;
        double defunc_2_f_res_234955 = x_234954 - x_234953;
        bool isnan_res_234956;
        
        isnan_res_234956 = futrts_isnan64(defunc_2_f_res_234955);
        
        double defunc_0_f_res_234957;
        
        if (isnan_res_234956) {
            defunc_0_f_res_234957 = defunc_2_f_res_234955;
        } else {
            double abs_res_234972 = fabs(defunc_2_f_res_234955);
            
            defunc_0_f_res_234957 = abs_res_234972;
        }
        ((double *) mem_220648.mem)[gtid_234950] = defunc_0_f_res_234957;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236597_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236597_end -
                 futhark_mc_segmap_parloop_236597_start;
        
        ctx->futhark_mc_segmap_parloop_236597_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236597_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236597_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236595(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234949 = tid;
    int num_tasks_234970 = info.nsubtasks;
    struct futhark_mc_task_236594 *futhark_mc_task_236594 =
                                  (struct futhark_mc_task_236594 *) args;
    struct futhark_context *ctx = futhark_mc_task_236594->ctx;
    uint64_t futhark_mc_segmap_task_236595_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236595_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236594->free_n_203490;
    int64_t gtid_215650 = futhark_mc_task_236594->free_gtid_215650;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236594->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220630 = {.desc ="ext_mem_220630", .mem =
                                      futhark_mc_task_236594->free_ext_mem_220630,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220631 = {.desc ="ext_mem_220631", .mem =
                                      futhark_mc_task_236594->free_ext_mem_220631,
                                      .size =0, .references =NULL};
    int64_t ext_220635 = futhark_mc_task_236594->free_ext_220635;
    struct memblock mem_220648 = {.desc ="mem_220648", .mem =
                                  futhark_mc_task_236594->free_mem_220648,
                                  .size =0, .references =NULL};
    int64_t iter_234971;
    struct futhark_mc_segmap_parloop_struct_236596
    futhark_mc_segmap_parloop_struct_236596;
    
    futhark_mc_segmap_parloop_struct_236596.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236596.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236596.free_gtid_215650 = gtid_215650;
    futhark_mc_segmap_parloop_struct_236596.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236596.free_ext_mem_220630 =
        ext_mem_220630.mem;
    futhark_mc_segmap_parloop_struct_236596.free_ext_mem_220631 =
        ext_mem_220631.mem;
    futhark_mc_segmap_parloop_struct_236596.free_ext_220635 = ext_220635;
    futhark_mc_segmap_parloop_struct_236596.free_mem_220648 = mem_220648.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236597_task;
    
    futhark_mc_segmap_parloop_236597_task.name =
        "futhark_mc_segmap_parloop_236597";
    futhark_mc_segmap_parloop_236597_task.fn = futhark_mc_segmap_parloop_236597;
    futhark_mc_segmap_parloop_236597_task.args =
        &futhark_mc_segmap_parloop_struct_236596;
    futhark_mc_segmap_parloop_236597_task.iterations = iterations;
    futhark_mc_segmap_parloop_236597_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236597_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236597_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236597_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236597_task);
    
    if (futhark_mc_segmap_parloop_236597_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236597_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236597_total_end -
                 futhark_mc_segmap_parloop_236597_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236597_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236597_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236597_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236595_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236595_end -
                 futhark_mc_segmap_task_236595_start;
        
        ctx->futhark_mc_segmap_task_236595_runs[tid]++;
        ctx->futhark_mc_segmap_task_236595_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236595_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236598 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215650;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220648;
    unsigned char *free_mem_220651;
};
struct futhark_mc_segmap_parloop_struct_236600 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215650;
    unsigned char *free_mem_217340;
    unsigned char *free_mem_220648;
    unsigned char *free_mem_220651;
};
static int futhark_mc_segmap_parloop_236601(void *args, int64_t start,
                                            int64_t end, int flat_tid_234959,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236600
    *futhark_mc_segmap_parloop_struct_236600 =
    (struct futhark_mc_segmap_parloop_struct_236600 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236600->ctx;
    uint64_t futhark_mc_segmap_parloop_236601_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236601_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236600->free_n_203490;
    int64_t gtid_215650 =
            futhark_mc_segmap_parloop_struct_236600->free_gtid_215650;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236600->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220648 = {.desc ="mem_220648", .mem =
                                  futhark_mc_segmap_parloop_struct_236600->free_mem_220648,
                                  .size =0, .references =NULL};
    struct memblock mem_220651 = {.desc ="mem_220651", .mem =
                                  futhark_mc_segmap_parloop_struct_236600->free_mem_220651,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234976 = start;
    
    for (; iter_234976 < end; iter_234976++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234981 = n_203490;
        int64_t gtid_234960 = iter_234976;
        int64_t remnant_234982 = iter_234976 - gtid_234960;
        int64_t x_234961;
        
        x_234961 = ((int64_t *) mem_217340.mem)[gtid_215650 * n_203490 +
                                                gtid_234960];
        
        bool cond_234962 = sle64((int64_t) 0, x_234961);
        double defunc_0_f_res_234963;
        
        if (cond_234962) {
            bool y_234977 = slt64(x_234961, n_203490);
            bool bounds_check_234978 = cond_234962 && y_234977;
            bool index_certs_234979;
            
            if (!bounds_check_234978) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_234961,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  utils.fut:32:29-33\n   #1  utils.fut:32:3-49\n   #2  stl.fut:334:21-49\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:332:13-335:35\n   #6  stl.fut:415:61-429:75\n   #7  stl.fut:455:3-469:34\n   #8  stl.fut:439:1-469:34\n");
                err = 1;
                goto cleanup;
            }
            
            double defunc_0_f_res_t_res_234980;
            
            defunc_0_f_res_t_res_234980 = ((double *) mem_220648.mem)[x_234961];
            defunc_0_f_res_234963 = defunc_0_f_res_t_res_234980;
        } else {
            defunc_0_f_res_234963 = INFINITY;
        }
        ((double *) mem_220651.mem)[gtid_234960] = defunc_0_f_res_234963;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236601_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236601_end -
                 futhark_mc_segmap_parloop_236601_start;
        
        ctx->futhark_mc_segmap_parloop_236601_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236601_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236601_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236599(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234959 = tid;
    int num_tasks_234975 = info.nsubtasks;
    struct futhark_mc_task_236598 *futhark_mc_task_236598 =
                                  (struct futhark_mc_task_236598 *) args;
    struct futhark_context *ctx = futhark_mc_task_236598->ctx;
    uint64_t futhark_mc_segmap_task_236599_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236599_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236598->free_n_203490;
    int64_t gtid_215650 = futhark_mc_task_236598->free_gtid_215650;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236598->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock mem_220648 = {.desc ="mem_220648", .mem =
                                  futhark_mc_task_236598->free_mem_220648,
                                  .size =0, .references =NULL};
    struct memblock mem_220651 = {.desc ="mem_220651", .mem =
                                  futhark_mc_task_236598->free_mem_220651,
                                  .size =0, .references =NULL};
    int64_t iter_234976;
    struct futhark_mc_segmap_parloop_struct_236600
    futhark_mc_segmap_parloop_struct_236600;
    
    futhark_mc_segmap_parloop_struct_236600.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236600.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236600.free_gtid_215650 = gtid_215650;
    futhark_mc_segmap_parloop_struct_236600.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236600.free_mem_220648 = mem_220648.mem;
    futhark_mc_segmap_parloop_struct_236600.free_mem_220651 = mem_220651.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236601_task;
    
    futhark_mc_segmap_parloop_236601_task.name =
        "futhark_mc_segmap_parloop_236601";
    futhark_mc_segmap_parloop_236601_task.fn = futhark_mc_segmap_parloop_236601;
    futhark_mc_segmap_parloop_236601_task.args =
        &futhark_mc_segmap_parloop_struct_236600;
    futhark_mc_segmap_parloop_236601_task.iterations = iterations;
    futhark_mc_segmap_parloop_236601_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236601_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236601_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236601_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236601_task);
    
    if (futhark_mc_segmap_parloop_236601_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236601_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236601_total_end -
                 futhark_mc_segmap_parloop_236601_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236601_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236601_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236601_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236599_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236599_end -
                 futhark_mc_segmap_task_236599_start;
        
        ctx->futhark_mc_segmap_task_236599_runs[tid]++;
        ctx->futhark_mc_segmap_task_236599_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236599_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236591(void *args, int64_t start,
                                            int64_t end, int flat_tid_215649,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236590
    *futhark_mc_segmap_parloop_struct_236590 =
    (struct futhark_mc_segmap_parloop_struct_236590 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236590->ctx;
    uint64_t futhark_mc_segmap_parloop_236591_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236591_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236590->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236590->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236590->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236590->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_segmap_parloop_struct_236590->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220630 = {.desc ="ext_mem_220630", .mem =
                                      futhark_mc_segmap_parloop_struct_236590->free_ext_mem_220630,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220631 = {.desc ="ext_mem_220631", .mem =
                                      futhark_mc_segmap_parloop_struct_236590->free_ext_mem_220631,
                                      .size =0, .references =NULL};
    int64_t ext_220635 =
            futhark_mc_segmap_parloop_struct_236590->free_ext_220635;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_segmap_parloop_struct_236590->free_mem_220685,
                                  .size =0, .references =NULL};
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_segmap_parloop_struct_236590->free_mem_220689,
                                  .size =0, .references =NULL};
    size_t mem_220648_cached_sizze_236592 = 0;
    unsigned char *mem_220648 = NULL;
    size_t mem_220651_cached_sizze_236593 = 0;
    unsigned char *mem_220651 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234948 = start;
    
    if (mem_220648_cached_sizze_236592 < (size_t) bytes_217302) {
        mem_220648 = realloc(mem_220648, bytes_217302);
        mem_220648_cached_sizze_236592 = bytes_217302;
    }
    if (mem_220651_cached_sizze_236593 < (size_t) bytes_217302) {
        mem_220651 = realloc(mem_220651, bytes_217302);
        mem_220651_cached_sizze_236593 = bytes_217302;
    }
    for (; iter_234948 < end; iter_234948++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234968 = partition_sizze_203577;
        int64_t gtid_215650 = iter_234948;
        int64_t remnant_234969 = iter_234948 - gtid_215650;
        int64_t flat_tid_234949 = (int64_t) 0;
        int32_t num_tasks_234970;
        struct futhark_mc_task_236594 futhark_mc_task_236594;
        
        futhark_mc_task_236594.ctx = ctx;
        futhark_mc_task_236594.free_n_203490 = n_203490;
        futhark_mc_task_236594.free_gtid_215650 = gtid_215650;
        futhark_mc_task_236594.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236594.free_ext_mem_220630 = ext_mem_220630.mem;
        futhark_mc_task_236594.free_ext_mem_220631 = ext_mem_220631.mem;
        futhark_mc_task_236594.free_ext_220635 = ext_220635;
        futhark_mc_task_236594.free_mem_220648 = mem_220648;
        
        struct scheduler_segop futhark_mc_task_236594_task;
        
        futhark_mc_task_236594_task.args = &futhark_mc_task_236594;
        futhark_mc_task_236594_task.top_level_fn =
            futhark_mc_segmap_task_236595;
        futhark_mc_task_236594_task.name = "futhark_mc_segmap_task_236595";
        futhark_mc_task_236594_task.iterations = n_203490;
        futhark_mc_task_236594_task.task_time =
            &ctx->futhark_mc_segmap_task_236595_total_time;
        futhark_mc_task_236594_task.task_iter =
            &ctx->futhark_mc_segmap_task_236595_total_iter;
        futhark_mc_task_236594_task.sched = STATIC;
        futhark_mc_task_236594_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236595_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236594_task);
        
        if (futhark_mc_segmap_task_236595_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_234959 = (int64_t) 0;
        int32_t num_tasks_234975;
        struct futhark_mc_task_236598 futhark_mc_task_236598;
        
        futhark_mc_task_236598.ctx = ctx;
        futhark_mc_task_236598.free_n_203490 = n_203490;
        futhark_mc_task_236598.free_gtid_215650 = gtid_215650;
        futhark_mc_task_236598.free_mem_217340 = mem_217340.mem;
        futhark_mc_task_236598.free_mem_220648 = mem_220648;
        futhark_mc_task_236598.free_mem_220651 = mem_220651;
        
        struct scheduler_segop futhark_mc_task_236598_task;
        
        futhark_mc_task_236598_task.args = &futhark_mc_task_236598;
        futhark_mc_task_236598_task.top_level_fn =
            futhark_mc_segmap_task_236599;
        futhark_mc_task_236598_task.name = "futhark_mc_segmap_task_236599";
        futhark_mc_task_236598_task.iterations = n_203490;
        futhark_mc_task_236598_task.task_time =
            &ctx->futhark_mc_segmap_task_236599_total_time;
        futhark_mc_task_236598_task.task_iter =
            &ctx->futhark_mc_segmap_task_236599_total_iter;
        futhark_mc_task_236598_task.sched = STATIC;
        futhark_mc_task_236598_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236599_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236598_task);
        
        if (futhark_mc_segmap_task_236599_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220685.mem + gtid_215650 * n_203490 * (int64_t) 8,
                    mem_220651 + (int64_t) 0, n_203490 * (int64_t) 8);
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220689.mem + gtid_215650 * n_203490 * (int64_t) 8,
                    mem_220648 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220648);
    free(mem_220651);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236591_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236591_end -
                 futhark_mc_segmap_parloop_236591_start;
        
        ctx->futhark_mc_segmap_parloop_236591_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236591_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236591_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236589(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215649 = tid;
    int num_tasks_234921 = info.nsubtasks;
    struct futhark_mc_task_236583 *futhark_mc_task_236583 =
                                  (struct futhark_mc_task_236583 *) args;
    struct futhark_context *ctx = futhark_mc_task_236583->ctx;
    uint64_t futhark_mc_segmap_nested_task_236589_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236589_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236583->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236583->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236583->free_mem_217297,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236583->free_bytes_217302;
    struct memblock mem_217340 = {.desc ="mem_217340", .mem =
                                  futhark_mc_task_236583->free_mem_217340,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220630 = {.desc ="ext_mem_220630", .mem =
                                      futhark_mc_task_236583->free_ext_mem_220630,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220631 = {.desc ="ext_mem_220631", .mem =
                                      futhark_mc_task_236583->free_ext_mem_220631,
                                      .size =0, .references =NULL};
    int64_t ext_220635 = futhark_mc_task_236583->free_ext_220635;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_task_236583->free_mem_220685,
                                  .size =0, .references =NULL};
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_task_236583->free_mem_220689,
                                  .size =0, .references =NULL};
    int64_t iter_234948;
    struct futhark_mc_segmap_parloop_struct_236590
    futhark_mc_segmap_parloop_struct_236590;
    
    futhark_mc_segmap_parloop_struct_236590.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236590.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236590.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236590.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236590.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236590.free_mem_217340 = mem_217340.mem;
    futhark_mc_segmap_parloop_struct_236590.free_ext_mem_220630 =
        ext_mem_220630.mem;
    futhark_mc_segmap_parloop_struct_236590.free_ext_mem_220631 =
        ext_mem_220631.mem;
    futhark_mc_segmap_parloop_struct_236590.free_ext_220635 = ext_220635;
    futhark_mc_segmap_parloop_struct_236590.free_mem_220685 = mem_220685.mem;
    futhark_mc_segmap_parloop_struct_236590.free_mem_220689 = mem_220689.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236591_task;
    
    futhark_mc_segmap_parloop_236591_task.name =
        "futhark_mc_segmap_parloop_236591";
    futhark_mc_segmap_parloop_236591_task.fn = futhark_mc_segmap_parloop_236591;
    futhark_mc_segmap_parloop_236591_task.args =
        &futhark_mc_segmap_parloop_struct_236590;
    futhark_mc_segmap_parloop_236591_task.iterations = iterations;
    futhark_mc_segmap_parloop_236591_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236591_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236591_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236591_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236591_task);
    
    if (futhark_mc_segmap_parloop_236591_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236591_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236591_total_end -
                 futhark_mc_segmap_parloop_236591_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236591_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236591_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236591_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236589_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236589_end -
                 futhark_mc_segmap_nested_task_236589_start;
        
        ctx->futhark_mc_segmap_nested_task_236589_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236589_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236589_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236602 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_i_203670;
    int32_t free_iters_206665;
    int64_t free_bytes_217302;
    unsigned char *free_mem_220685;
    int64_t free_bytes_220714;
    unsigned char *free_mem_220835;
    int64_t free_num_bytes_221020;
    int64_t free_num_bytes_221025;
};
struct futhark_mc_segmap_parloop_struct_236604 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_i_203670;
    int32_t free_iters_206665;
    int64_t free_bytes_217302;
    unsigned char *free_mem_220685;
    int64_t free_bytes_220714;
    unsigned char *free_mem_220835;
    int64_t free_num_bytes_221025;
};
static int futhark_mc_segmap_parloop_236605(void *args, int64_t start,
                                            int64_t end, int flat_tid_215676,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236604
    *futhark_mc_segmap_parloop_struct_236604 =
    (struct futhark_mc_segmap_parloop_struct_236604 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236604->ctx;
    uint64_t futhark_mc_segmap_parloop_236605_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236605_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236604->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236604->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236604->free_i_203670;
    int32_t iters_206665 =
            futhark_mc_segmap_parloop_struct_236604->free_iters_206665;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236604->free_bytes_217302;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_220685,
                                  .size =0, .references =NULL};
    int64_t bytes_220714 =
            futhark_mc_segmap_parloop_struct_236604->free_bytes_220714;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_220835,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221025 =
            futhark_mc_segmap_parloop_struct_236604->free_num_bytes_221025;
    size_t mem_220739_cached_sizze_236606 = 0;
    unsigned char *mem_220739 = NULL;
    size_t mem_220742_cached_sizze_236607 = 0;
    unsigned char *mem_220742 = NULL;
    size_t mem_220745_cached_sizze_236608 = 0;
    unsigned char *mem_220745 = NULL;
    size_t mem_220748_cached_sizze_236609 = 0;
    unsigned char *mem_220748 = NULL;
    size_t mem_220751_cached_sizze_236610 = 0;
    unsigned char *mem_220751 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234984 = start;
    
    if (mem_220739_cached_sizze_236606 < (size_t) bytes_217302) {
        mem_220739 = realloc(mem_220739, bytes_217302);
        mem_220739_cached_sizze_236606 = bytes_217302;
    }
    if (mem_220742_cached_sizze_236607 < (size_t) bytes_217302) {
        mem_220742 = realloc(mem_220742, bytes_217302);
        mem_220742_cached_sizze_236607 = bytes_217302;
    }
    if (mem_220745_cached_sizze_236608 < (size_t) bytes_217302) {
        mem_220745 = realloc(mem_220745, bytes_217302);
        mem_220745_cached_sizze_236608 = bytes_217302;
    }
    if (mem_220748_cached_sizze_236609 < (size_t) bytes_217302) {
        mem_220748 = realloc(mem_220748, bytes_217302);
        mem_220748_cached_sizze_236609 = bytes_217302;
    }
    if (mem_220751_cached_sizze_236610 < (size_t) bytes_220714) {
        mem_220751 = realloc(mem_220751, bytes_220714);
        mem_220751_cached_sizze_236610 = bytes_220714;
    }
    
    struct memblock mem_in_221026;
    
    mem_in_221026.references = NULL;
    if (memblock_alloc(ctx, &mem_in_221026, num_bytes_221025,
                       "mem_in_221026")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock mem_220814;
    
    mem_220814.references = NULL;
    if (memblock_alloc(ctx, &mem_220814, bytes_217302, "mem_220814")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock ext_mem_220827;
    
    ext_mem_220827.references = NULL;
    
    struct memblock ext_mem_unused_221027;
    
    ext_mem_unused_221027.references = NULL;
    
    struct memblock mem_param_234986;
    
    mem_param_234986.references = NULL;
    
    struct memblock mem_param_out_234987;
    
    mem_param_out_234987.references = NULL;
    for (; iter_234984 < end; iter_234984++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235094 = partition_sizze_203577;
        int64_t gtid_215677 = iter_234984;
        int64_t remnant_235095 = iter_234984 - gtid_215677;
        
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_in_221026.mem + (int64_t) 0, mem_220685.mem +
                    gtid_215677 * n_203490 * (int64_t) 8, n_203490 *
                    (int64_t) 8);
        if (memblock_set(ctx, &mem_param_234986, &mem_in_221026,
                         "mem_in_221026") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_out_234987, &mem_220814,
                         "mem_220814") != 0)
            return 1;
        for (int32_t i_234985 = 0; i_234985 < iters_206665; i_234985++) {
            int32_t defunc_2_radix_sort_step_arg_234989 = mul32(2, i_234985);
            int32_t defunc_0_get_bit_arg_234990 = add32(1,
                                                        defunc_2_radix_sort_step_arg_234989);
            bool cond_f_res_234991 = defunc_0_get_bit_arg_234990 == 63;
            bool cond_f_res_234992 = defunc_2_radix_sort_step_arg_234989 == 63;
            int64_t unsign_arg_234993 =
                    zext_i32_i64(defunc_0_get_bit_arg_234990);
            int64_t unsign_arg_234994 =
                    zext_i32_i64(defunc_2_radix_sort_step_arg_234989);
            int64_t discard_235000;
            int64_t discard_235001;
            int64_t discard_235002;
            int64_t discard_235003;
            int64_t scanacc_235010;
            int64_t scanacc_235011;
            int64_t scanacc_235012;
            int64_t scanacc_235013;
            
            scanacc_235010 = (int64_t) 0;
            scanacc_235011 = (int64_t) 0;
            scanacc_235012 = (int64_t) 0;
            scanacc_235013 = (int64_t) 0;
            for (int64_t i_235009 = 0; i_235009 < n_203490; i_235009++) {
                double x_235019;
                
                x_235019 = ((double *) mem_param_234986.mem)[i_235009];
                
                int64_t i64_arg_235020;
                
                i64_arg_235020 = futrts_to_bits64(x_235019);
                
                int64_t unsign_arg_235021 = ashr64(i64_arg_235020,
                                                   unsign_arg_234993);
                int64_t unsign_arg_235022 = (int64_t) 1 & unsign_arg_235021;
                int32_t to_i32_res_235023 = zext_i64_i32(unsign_arg_235022);
                int64_t unsign_arg_235024 = ashr64(i64_arg_235020,
                                                   (int64_t) 63);
                int64_t unsign_arg_235025 = (int64_t) 1 & unsign_arg_235024;
                int32_t to_i32_res_235026 = zext_i64_i32(unsign_arg_235025);
                bool cond_235027 = to_i32_res_235026 == 1;
                bool x_235028 = !cond_235027;
                bool y_235029 = cond_f_res_234991 && x_235028;
                bool cond_235030 = cond_235027 || y_235029;
                int32_t defunc_1_get_bit_res_235031;
                
                if (cond_235030) {
                    int32_t defunc_1_get_bit_res_t_res_235032 = 1 ^
                            to_i32_res_235023;
                    
                    defunc_1_get_bit_res_235031 =
                        defunc_1_get_bit_res_t_res_235032;
                } else {
                    defunc_1_get_bit_res_235031 = to_i32_res_235023;
                }
                
                int32_t x_235033 = mul32(2, defunc_1_get_bit_res_235031);
                int64_t unsign_arg_235034 = ashr64(i64_arg_235020,
                                                   unsign_arg_234994);
                int64_t unsign_arg_235035 = (int64_t) 1 & unsign_arg_235034;
                int32_t to_i32_res_235036 = zext_i64_i32(unsign_arg_235035);
                bool y_235037 = cond_f_res_234992 && x_235028;
                bool cond_235038 = cond_235027 || y_235037;
                int32_t defunc_1_get_bit_res_235039;
                
                if (cond_235038) {
                    int32_t defunc_1_get_bit_res_t_res_235040 = 1 ^
                            to_i32_res_235036;
                    
                    defunc_1_get_bit_res_235039 =
                        defunc_1_get_bit_res_t_res_235040;
                } else {
                    defunc_1_get_bit_res_235039 = to_i32_res_235036;
                }
                
                int32_t defunc_0_f_res_235041 = add32(x_235033,
                                                      defunc_1_get_bit_res_235039);
                bool cond_235042 = defunc_0_f_res_235041 == 0;
                int64_t defunc_0_f_res_235043 = btoi_bool_i64(cond_235042);
                int64_t defunc_0_f_res_235044;
                int64_t defunc_0_f_res_235045;
                int64_t defunc_0_f_res_235046;
                
                if (cond_235042) {
                    defunc_0_f_res_235044 = (int64_t) 0;
                    defunc_0_f_res_235045 = (int64_t) 0;
                    defunc_0_f_res_235046 = (int64_t) 0;
                } else {
                    bool cond_235047 = defunc_0_f_res_235041 == 1;
                    int64_t defunc_0_f_res_f_res_235048 =
                            btoi_bool_i64(cond_235047);
                    int64_t defunc_0_f_res_f_res_235049;
                    int64_t defunc_0_f_res_f_res_235050;
                    
                    if (cond_235047) {
                        defunc_0_f_res_f_res_235049 = (int64_t) 0;
                        defunc_0_f_res_f_res_235050 = (int64_t) 0;
                    } else {
                        bool cond_235051 = defunc_0_f_res_235041 == 2;
                        int64_t defunc_0_f_res_f_res_f_res_235052 =
                                btoi_bool_i64(cond_235051);
                        bool cond_neg_235053 = !cond_235051;
                        int64_t defunc_0_f_res_f_res_f_res_235054 =
                                btoi_bool_i64(cond_neg_235053);
                        
                        defunc_0_f_res_f_res_235049 =
                            defunc_0_f_res_f_res_f_res_235052;
                        defunc_0_f_res_f_res_235050 =
                            defunc_0_f_res_f_res_f_res_235054;
                    }
                    defunc_0_f_res_235044 = defunc_0_f_res_f_res_235048;
                    defunc_0_f_res_235045 = defunc_0_f_res_f_res_235049;
                    defunc_0_f_res_235046 = defunc_0_f_res_f_res_235050;
                }
                
                int64_t defunc_1_op_res_235055 = add64(defunc_0_f_res_235043,
                                                       scanacc_235010);
                int64_t defunc_1_op_res_235056 = add64(defunc_0_f_res_235044,
                                                       scanacc_235011);
                int64_t defunc_1_op_res_235057 = add64(defunc_0_f_res_235045,
                                                       scanacc_235012);
                int64_t defunc_1_op_res_235058 = add64(defunc_0_f_res_235046,
                                                       scanacc_235013);
                
                ((int64_t *) mem_220739)[i_235009] = defunc_1_op_res_235055;
                ((int64_t *) mem_220742)[i_235009] = defunc_1_op_res_235056;
                ((int64_t *) mem_220745)[i_235009] = defunc_1_op_res_235057;
                ((int64_t *) mem_220748)[i_235009] = defunc_1_op_res_235058;
                ((int32_t *) mem_220751)[i_235009] = defunc_0_f_res_235041;
                
                int64_t scanacc_tmp_235099 = defunc_1_op_res_235055;
                int64_t scanacc_tmp_235100 = defunc_1_op_res_235056;
                int64_t scanacc_tmp_235101 = defunc_1_op_res_235057;
                int64_t scanacc_tmp_235102 = defunc_1_op_res_235058;
                
                scanacc_235010 = scanacc_tmp_235099;
                scanacc_235011 = scanacc_tmp_235100;
                scanacc_235012 = scanacc_tmp_235101;
                scanacc_235013 = scanacc_tmp_235102;
            }
            discard_235000 = scanacc_235010;
            discard_235001 = scanacc_235011;
            discard_235002 = scanacc_235012;
            discard_235003 = scanacc_235013;
            
            int64_t last_res_235064;
            
            last_res_235064 = ((int64_t *) mem_220739)[i_203670];
            
            int64_t last_res_235065;
            
            last_res_235065 = ((int64_t *) mem_220742)[i_203670];
            
            int64_t last_res_235066;
            
            last_res_235066 = ((int64_t *) mem_220745)[i_203670];
            if (n_203490 * (int64_t) 8 > 0)
                memmove(mem_param_out_234987.mem + (int64_t) 0,
                        mem_param_234986.mem + (int64_t) 0, n_203490 *
                        (int64_t) 8);
            for (int64_t write_iter_235069 = 0; write_iter_235069 < n_203490;
                 write_iter_235069++) {
                int32_t write_iv_235071;
                
                write_iv_235071 = ((int32_t *) mem_220751)[write_iter_235069];
                
                bool match_lit_235072 = 0 == write_iv_235071;
                int64_t defunc_1_f_res_235073;
                
                if (match_lit_235072) {
                    int64_t write_iv_235074;
                    
                    write_iv_235074 =
                        ((int64_t *) mem_220739)[write_iter_235069];
                    
                    int64_t case_res_235075 = sub64(write_iv_235074,
                                                    (int64_t) 1);
                    
                    defunc_1_f_res_235073 = case_res_235075;
                } else {
                    bool match_lit_235076 = 1 == write_iv_235071;
                    int64_t x_235077;
                    
                    if (match_lit_235076) {
                        int64_t write_iv_235078;
                        
                        write_iv_235078 =
                            ((int64_t *) mem_220742)[write_iter_235069];
                        
                        int64_t x_235079 = add64(last_res_235064,
                                                 write_iv_235078);
                        int64_t case_res_235080 = sub64(x_235079, (int64_t) 1);
                        
                        x_235077 = case_res_235080;
                    } else {
                        bool match_lit_235081 = 2 == write_iv_235071;
                        int64_t x_235082;
                        
                        if (match_lit_235081) {
                            int64_t write_iv_235083;
                            
                            write_iv_235083 =
                                ((int64_t *) mem_220745)[write_iter_235069];
                            
                            int64_t x_235084 = add64(last_res_235064,
                                                     last_res_235065);
                            int64_t x_235085 = add64(x_235084, write_iv_235083);
                            int64_t case_res_235086 = sub64(x_235085,
                                                            (int64_t) 1);
                            
                            x_235082 = case_res_235086;
                        } else {
                            int64_t write_iv_235087;
                            
                            write_iv_235087 =
                                ((int64_t *) mem_220748)[write_iter_235069];
                            
                            int64_t x_235088 = add64(last_res_235064,
                                                     last_res_235065);
                            int64_t x_235089 = add64(last_res_235066, x_235088);
                            int64_t x_235090 = add64(x_235089, write_iv_235087);
                            int64_t defunc_1_f_res_res_235091 = sub64(x_235090,
                                                                      (int64_t) 1);
                            
                            x_235082 = defunc_1_f_res_res_235091;
                        }
                        x_235077 = x_235082;
                    }
                    defunc_1_f_res_235073 = x_235077;
                }
                if (sle64((int64_t) 0, defunc_1_f_res_235073) &&
                    slt64(defunc_1_f_res_235073, n_203490)) {
                    if ((int64_t) 8 > 0)
                        memmove(mem_param_out_234987.mem +
                                defunc_1_f_res_235073 * (int64_t) 8,
                                mem_param_234986.mem + write_iter_235069 *
                                (int64_t) 8, (int64_t) 8);
                }
            }
            
            struct memblock mem_param_tmp_235096;
            
            mem_param_tmp_235096.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_235096, &mem_param_out_234987,
                             "mem_param_out_234987") != 0)
                return 1;
            
            struct memblock mem_param_out_tmp_235097;
            
            mem_param_out_tmp_235097.references = NULL;
            if (memblock_set(ctx, &mem_param_out_tmp_235097, &mem_param_234986,
                             "mem_param_234986") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_234986, &mem_param_tmp_235096,
                             "mem_param_tmp_235096") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_out_234987,
                             &mem_param_out_tmp_235097,
                             "mem_param_out_tmp_235097") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_out_tmp_235097,
                               "mem_param_out_tmp_235097") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_235096,
                               "mem_param_tmp_235096") != 0)
                return 1;
        }
        if (memblock_set(ctx, &ext_mem_220827, &mem_param_234986,
                         "mem_param_234986") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_unused_221027, &mem_param_out_234987,
                         "mem_param_out_234987") != 0)
            return 1;
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220835.mem + gtid_215677 * n_203490 * (int64_t) 8,
                    ext_mem_220827.mem + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220739);
    free(mem_220742);
    free(mem_220745);
    free(mem_220748);
    free(mem_220751);
    if (memblock_unref(ctx, &mem_param_out_234987, "mem_param_out_234987") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_234986, "mem_param_234986") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_unused_221027, "ext_mem_unused_221027") !=
        0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220827, "ext_mem_220827") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_220814, "mem_220814") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_in_221026, "mem_in_221026") != 0)
        return 1;
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236605_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236605_end -
                 futhark_mc_segmap_parloop_236605_start;
        
        ctx->futhark_mc_segmap_parloop_236605_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236605_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236605_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236603(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215676 = tid;
    int num_tasks_234983 = info.nsubtasks;
    struct futhark_mc_task_236602 *futhark_mc_task_236602 =
                                  (struct futhark_mc_task_236602 *) args;
    struct futhark_context *ctx = futhark_mc_task_236602->ctx;
    uint64_t futhark_mc_segmap_task_236603_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236603_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236602->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236602->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_task_236602->free_i_203670;
    int32_t iters_206665 = futhark_mc_task_236602->free_iters_206665;
    int64_t bytes_217302 = futhark_mc_task_236602->free_bytes_217302;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_task_236602->free_mem_220685,
                                  .size =0, .references =NULL};
    int64_t bytes_220714 = futhark_mc_task_236602->free_bytes_220714;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_task_236602->free_mem_220835,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221020 = futhark_mc_task_236602->free_num_bytes_221020;
    int64_t num_bytes_221025 = futhark_mc_task_236602->free_num_bytes_221025;
    int64_t iter_234984;
    struct futhark_mc_segmap_parloop_struct_236604
    futhark_mc_segmap_parloop_struct_236604;
    
    futhark_mc_segmap_parloop_struct_236604.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236604.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236604.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236604.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236604.free_iters_206665 = iters_206665;
    futhark_mc_segmap_parloop_struct_236604.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236604.free_mem_220685 = mem_220685.mem;
    futhark_mc_segmap_parloop_struct_236604.free_bytes_220714 = bytes_220714;
    futhark_mc_segmap_parloop_struct_236604.free_mem_220835 = mem_220835.mem;
    futhark_mc_segmap_parloop_struct_236604.free_num_bytes_221025 =
        num_bytes_221025;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236605_task;
    
    futhark_mc_segmap_parloop_236605_task.name =
        "futhark_mc_segmap_parloop_236605";
    futhark_mc_segmap_parloop_236605_task.fn = futhark_mc_segmap_parloop_236605;
    futhark_mc_segmap_parloop_236605_task.args =
        &futhark_mc_segmap_parloop_struct_236604;
    futhark_mc_segmap_parloop_236605_task.iterations = iterations;
    futhark_mc_segmap_parloop_236605_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236605_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236605_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236605_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236605_task);
    
    if (futhark_mc_segmap_parloop_236605_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236605_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236605_total_end -
                 futhark_mc_segmap_parloop_236605_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236605_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236605_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236605_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236603_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236603_end -
                 futhark_mc_segmap_task_236603_start;
        
        ctx->futhark_mc_segmap_task_236603_runs[tid]++;
        ctx->futhark_mc_segmap_task_236603_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236603_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236612 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_i_203670;
    int32_t free_iters_206665;
    int64_t free_bytes_217302;
    unsigned char *free_mem_220685;
    int64_t free_bytes_220714;
    unsigned char *free_mem_220835;
    int64_t free_num_bytes_221020;
};
struct futhark_mc_task_236619 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    unsigned char *free_mem_220703;
    unsigned char *free_mem_220706;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220712;
    unsigned char *free_mem_220715;
    unsigned char *free_mem_param_235111;
    bool free_cond_f_res_235116;
    bool free_cond_f_res_235117;
    int64_t free_unsign_arg_235118;
    int64_t free_unsign_arg_235119;
};
struct futhark_mc_scan_stage_1_parloop_struct_236625 {
    struct futhark_context *ctx;
    unsigned char *free_mem_220703;
    unsigned char *free_mem_220706;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220712;
    unsigned char *free_mem_220715;
    unsigned char *free_mem_param_235111;
    bool free_cond_f_res_235116;
    bool free_cond_f_res_235117;
    int64_t free_unsign_arg_235118;
    int64_t free_unsign_arg_235119;
};
static int futhark_mc_scan_stage_1_parloop_236626(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_235125, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_236625
    *futhark_mc_scan_stage_1_parloop_struct_236625 =
    (struct futhark_mc_scan_stage_1_parloop_struct_236625 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_236625->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_236626_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236626_start = get_wall_time();
    
    struct memblock mem_220703 = {.desc ="mem_220703", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236625->free_mem_220703,
                                  .size =0, .references =NULL};
    struct memblock mem_220706 = {.desc ="mem_220706", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236625->free_mem_220706,
                                  .size =0, .references =NULL};
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236625->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220712 = {.desc ="mem_220712", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236625->free_mem_220712,
                                  .size =0, .references =NULL};
    struct memblock mem_220715 = {.desc ="mem_220715", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236625->free_mem_220715,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235111 = {.desc ="mem_param_235111", .mem =
                                        futhark_mc_scan_stage_1_parloop_struct_236625->free_mem_param_235111,
                                        .size =0, .references =NULL};
    bool cond_f_res_235116 =
         futhark_mc_scan_stage_1_parloop_struct_236625->free_cond_f_res_235116;
    bool cond_f_res_235117 =
         futhark_mc_scan_stage_1_parloop_struct_236625->free_cond_f_res_235117;
    int64_t unsign_arg_235118 =
            futhark_mc_scan_stage_1_parloop_struct_236625->free_unsign_arg_235118;
    int64_t unsign_arg_235119 =
            futhark_mc_scan_stage_1_parloop_struct_236625->free_unsign_arg_235119;
    int64_t iterations = end - start;
    int64_t iter_235210 = start;
    int64_t x_235127;
    int64_t x_235128;
    int64_t x_235129;
    int64_t x_235130;
    int64_t x_235131;
    int64_t x_235132;
    int64_t x_235133;
    int64_t x_235134;
    
    x_235127 = (int64_t) 0;
    x_235128 = (int64_t) 0;
    x_235129 = (int64_t) 0;
    x_235130 = (int64_t) 0;
    for (; iter_235210 < end; iter_235210++) {
        int64_t gtid_235126 = iter_235210;
        
        // stage 1 scan body
        {
            double x_235139;
            
            x_235139 = ((double *) mem_param_235111.mem)[gtid_235126];
            
            int64_t i64_arg_235140;
            
            i64_arg_235140 = futrts_to_bits64(x_235139);
            
            int64_t unsign_arg_235141 = ashr64(i64_arg_235140,
                                               unsign_arg_235118);
            int64_t unsign_arg_235142 = (int64_t) 1 & unsign_arg_235141;
            int32_t to_i32_res_235143 = zext_i64_i32(unsign_arg_235142);
            int64_t unsign_arg_235144 = ashr64(i64_arg_235140, (int64_t) 63);
            int64_t unsign_arg_235145 = (int64_t) 1 & unsign_arg_235144;
            int32_t to_i32_res_235146 = zext_i64_i32(unsign_arg_235145);
            bool cond_235147 = to_i32_res_235146 == 1;
            bool x_235148 = !cond_235147;
            bool y_235149 = cond_f_res_235116 && x_235148;
            bool cond_235150 = cond_235147 || y_235149;
            int32_t defunc_1_get_bit_res_235151;
            
            if (cond_235150) {
                int32_t defunc_1_get_bit_res_t_res_235152 = 1 ^
                        to_i32_res_235143;
                
                defunc_1_get_bit_res_235151 = defunc_1_get_bit_res_t_res_235152;
            } else {
                defunc_1_get_bit_res_235151 = to_i32_res_235143;
            }
            
            int32_t x_235153 = mul32(2, defunc_1_get_bit_res_235151);
            int64_t unsign_arg_235154 = ashr64(i64_arg_235140,
                                               unsign_arg_235119);
            int64_t unsign_arg_235155 = (int64_t) 1 & unsign_arg_235154;
            int32_t to_i32_res_235156 = zext_i64_i32(unsign_arg_235155);
            bool y_235157 = cond_f_res_235117 && x_235148;
            bool cond_235158 = cond_235147 || y_235157;
            int32_t defunc_1_get_bit_res_235159;
            
            if (cond_235158) {
                int32_t defunc_1_get_bit_res_t_res_235160 = 1 ^
                        to_i32_res_235156;
                
                defunc_1_get_bit_res_235159 = defunc_1_get_bit_res_t_res_235160;
            } else {
                defunc_1_get_bit_res_235159 = to_i32_res_235156;
            }
            
            int32_t defunc_0_f_res_235161 = add32(x_235153,
                                                  defunc_1_get_bit_res_235159);
            bool cond_235162 = defunc_0_f_res_235161 == 0;
            int64_t defunc_0_f_res_235163 = btoi_bool_i64(cond_235162);
            int64_t defunc_0_f_res_235164;
            int64_t defunc_0_f_res_235165;
            int64_t defunc_0_f_res_235166;
            
            if (cond_235162) {
                defunc_0_f_res_235164 = (int64_t) 0;
                defunc_0_f_res_235165 = (int64_t) 0;
                defunc_0_f_res_235166 = (int64_t) 0;
            } else {
                bool cond_235167 = defunc_0_f_res_235161 == 1;
                int64_t defunc_0_f_res_f_res_235168 =
                        btoi_bool_i64(cond_235167);
                int64_t defunc_0_f_res_f_res_235169;
                int64_t defunc_0_f_res_f_res_235170;
                
                if (cond_235167) {
                    defunc_0_f_res_f_res_235169 = (int64_t) 0;
                    defunc_0_f_res_f_res_235170 = (int64_t) 0;
                } else {
                    bool cond_235171 = defunc_0_f_res_235161 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_235172 =
                            btoi_bool_i64(cond_235171);
                    bool cond_neg_235173 = !cond_235171;
                    int64_t defunc_0_f_res_f_res_f_res_235174 =
                            btoi_bool_i64(cond_neg_235173);
                    
                    defunc_0_f_res_f_res_235169 =
                        defunc_0_f_res_f_res_f_res_235172;
                    defunc_0_f_res_f_res_235170 =
                        defunc_0_f_res_f_res_f_res_235174;
                }
                defunc_0_f_res_235164 = defunc_0_f_res_f_res_235168;
                defunc_0_f_res_235165 = defunc_0_f_res_f_res_235169;
                defunc_0_f_res_235166 = defunc_0_f_res_f_res_235170;
            }
            // write mapped values results to memory
            {
                ((int32_t *) mem_220715.mem)[gtid_235126] =
                    defunc_0_f_res_235161;
            }
            x_235127 = x_235127;
            x_235128 = x_235128;
            x_235129 = x_235129;
            x_235130 = x_235130;
            // Read next values
            {
                x_235131 = defunc_0_f_res_235163;
                x_235132 = defunc_0_f_res_235164;
                x_235133 = defunc_0_f_res_235165;
                x_235134 = defunc_0_f_res_235166;
            }
            
            int64_t defunc_1_op_res_235135 = add64(x_235127, x_235131);
            int64_t defunc_1_op_res_235136 = add64(x_235128, x_235132);
            int64_t defunc_1_op_res_235137 = add64(x_235129, x_235133);
            int64_t defunc_1_op_res_235138 = add64(x_235130, x_235134);
            
            ((int64_t *) mem_220703.mem)[gtid_235126] = defunc_1_op_res_235135;
            x_235127 = defunc_1_op_res_235135;
            ((int64_t *) mem_220706.mem)[gtid_235126] = defunc_1_op_res_235136;
            x_235128 = defunc_1_op_res_235136;
            ((int64_t *) mem_220709.mem)[gtid_235126] = defunc_1_op_res_235137;
            x_235129 = defunc_1_op_res_235137;
            ((int64_t *) mem_220712.mem)[gtid_235126] = defunc_1_op_res_235138;
            x_235130 = defunc_1_op_res_235138;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236626_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236626_end -
                 futhark_mc_scan_stage_1_parloop_236626_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_236626_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_236626_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_236626_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_236627 {
    struct futhark_context *ctx;
    unsigned char *free_mem_220703;
    unsigned char *free_mem_220706;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220712;
    unsigned char *free_mem_param_235111;
    bool free_cond_f_res_235116;
    bool free_cond_f_res_235117;
    int64_t free_unsign_arg_235118;
    int64_t free_unsign_arg_235119;
};
static int futhark_mc_scan_stage_3_parloop_236628(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_235125, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_236627
    *futhark_mc_scan_stage_3_parloop_struct_236627 =
    (struct futhark_mc_scan_stage_3_parloop_struct_236627 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_236627->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_236628_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_236628_start = get_wall_time();
    
    struct memblock mem_220703 = {.desc ="mem_220703", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236627->free_mem_220703,
                                  .size =0, .references =NULL};
    struct memblock mem_220706 = {.desc ="mem_220706", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236627->free_mem_220706,
                                  .size =0, .references =NULL};
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236627->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220712 = {.desc ="mem_220712", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236627->free_mem_220712,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235111 = {.desc ="mem_param_235111", .mem =
                                        futhark_mc_scan_stage_3_parloop_struct_236627->free_mem_param_235111,
                                        .size =0, .references =NULL};
    bool cond_f_res_235116 =
         futhark_mc_scan_stage_3_parloop_struct_236627->free_cond_f_res_235116;
    bool cond_f_res_235117 =
         futhark_mc_scan_stage_3_parloop_struct_236627->free_cond_f_res_235117;
    int64_t unsign_arg_235118 =
            futhark_mc_scan_stage_3_parloop_struct_236627->free_unsign_arg_235118;
    int64_t unsign_arg_235119 =
            futhark_mc_scan_stage_3_parloop_struct_236627->free_unsign_arg_235119;
    int64_t iterations = end - start;
    int64_t iter_235246 = start;
    int64_t x_235234;
    int64_t x_235235;
    int64_t x_235236;
    int64_t x_235237;
    int64_t x_235238;
    int64_t x_235239;
    int64_t x_235240;
    int64_t x_235241;
    
    if (iter_235246 == (int64_t) 0) {
        x_235234 = (int64_t) 0;
    } else {
        x_235234 = ((int64_t *) mem_220703.mem)[iter_235246 - (int64_t) 1];
    }
    if (iter_235246 == (int64_t) 0) {
        x_235235 = (int64_t) 0;
    } else {
        x_235235 = ((int64_t *) mem_220706.mem)[iter_235246 - (int64_t) 1];
    }
    if (iter_235246 == (int64_t) 0) {
        x_235236 = (int64_t) 0;
    } else {
        x_235236 = ((int64_t *) mem_220709.mem)[iter_235246 - (int64_t) 1];
    }
    if (iter_235246 == (int64_t) 0) {
        x_235237 = (int64_t) 0;
    } else {
        x_235237 = ((int64_t *) mem_220712.mem)[iter_235246 - (int64_t) 1];
    }
    for (; iter_235246 < end; iter_235246++) {
        int64_t gtid_235126 = iter_235246;
        
        // stage 3 scan body
        {
            double x_235139;
            
            x_235139 = ((double *) mem_param_235111.mem)[gtid_235126];
            
            int64_t i64_arg_235140;
            
            i64_arg_235140 = futrts_to_bits64(x_235139);
            
            int64_t unsign_arg_235141 = ashr64(i64_arg_235140,
                                               unsign_arg_235118);
            int64_t unsign_arg_235142 = (int64_t) 1 & unsign_arg_235141;
            int32_t to_i32_res_235143 = zext_i64_i32(unsign_arg_235142);
            int64_t unsign_arg_235144 = ashr64(i64_arg_235140, (int64_t) 63);
            int64_t unsign_arg_235145 = (int64_t) 1 & unsign_arg_235144;
            int32_t to_i32_res_235146 = zext_i64_i32(unsign_arg_235145);
            bool cond_235147 = to_i32_res_235146 == 1;
            bool x_235148 = !cond_235147;
            bool y_235149 = cond_f_res_235116 && x_235148;
            bool cond_235150 = cond_235147 || y_235149;
            int32_t defunc_1_get_bit_res_235151;
            
            if (cond_235150) {
                int32_t defunc_1_get_bit_res_t_res_235152 = 1 ^
                        to_i32_res_235143;
                
                defunc_1_get_bit_res_235151 = defunc_1_get_bit_res_t_res_235152;
            } else {
                defunc_1_get_bit_res_235151 = to_i32_res_235143;
            }
            
            int32_t x_235153 = mul32(2, defunc_1_get_bit_res_235151);
            int64_t unsign_arg_235154 = ashr64(i64_arg_235140,
                                               unsign_arg_235119);
            int64_t unsign_arg_235155 = (int64_t) 1 & unsign_arg_235154;
            int32_t to_i32_res_235156 = zext_i64_i32(unsign_arg_235155);
            bool y_235157 = cond_f_res_235117 && x_235148;
            bool cond_235158 = cond_235147 || y_235157;
            int32_t defunc_1_get_bit_res_235159;
            
            if (cond_235158) {
                int32_t defunc_1_get_bit_res_t_res_235160 = 1 ^
                        to_i32_res_235156;
                
                defunc_1_get_bit_res_235159 = defunc_1_get_bit_res_t_res_235160;
            } else {
                defunc_1_get_bit_res_235159 = to_i32_res_235156;
            }
            
            int32_t defunc_0_f_res_235161 = add32(x_235153,
                                                  defunc_1_get_bit_res_235159);
            bool cond_235162 = defunc_0_f_res_235161 == 0;
            int64_t defunc_0_f_res_235163 = btoi_bool_i64(cond_235162);
            int64_t defunc_0_f_res_235164;
            int64_t defunc_0_f_res_235165;
            int64_t defunc_0_f_res_235166;
            
            if (cond_235162) {
                defunc_0_f_res_235164 = (int64_t) 0;
                defunc_0_f_res_235165 = (int64_t) 0;
                defunc_0_f_res_235166 = (int64_t) 0;
            } else {
                bool cond_235167 = defunc_0_f_res_235161 == 1;
                int64_t defunc_0_f_res_f_res_235168 =
                        btoi_bool_i64(cond_235167);
                int64_t defunc_0_f_res_f_res_235169;
                int64_t defunc_0_f_res_f_res_235170;
                
                if (cond_235167) {
                    defunc_0_f_res_f_res_235169 = (int64_t) 0;
                    defunc_0_f_res_f_res_235170 = (int64_t) 0;
                } else {
                    bool cond_235171 = defunc_0_f_res_235161 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_235172 =
                            btoi_bool_i64(cond_235171);
                    bool cond_neg_235173 = !cond_235171;
                    int64_t defunc_0_f_res_f_res_f_res_235174 =
                            btoi_bool_i64(cond_neg_235173);
                    
                    defunc_0_f_res_f_res_235169 =
                        defunc_0_f_res_f_res_f_res_235172;
                    defunc_0_f_res_f_res_235170 =
                        defunc_0_f_res_f_res_f_res_235174;
                }
                defunc_0_f_res_235164 = defunc_0_f_res_f_res_235168;
                defunc_0_f_res_235165 = defunc_0_f_res_f_res_235169;
                defunc_0_f_res_235166 = defunc_0_f_res_f_res_235170;
            }
            x_235234 = x_235234;
            x_235235 = x_235235;
            x_235236 = x_235236;
            x_235237 = x_235237;
            x_235238 = defunc_0_f_res_235163;
            x_235239 = defunc_0_f_res_235164;
            x_235240 = defunc_0_f_res_235165;
            x_235241 = defunc_0_f_res_235166;
            
            int64_t defunc_1_op_res_235242 = add64(x_235234, x_235238);
            int64_t defunc_1_op_res_235243 = add64(x_235235, x_235239);
            int64_t defunc_1_op_res_235244 = add64(x_235236, x_235240);
            int64_t defunc_1_op_res_235245 = add64(x_235237, x_235241);
            
            ((int64_t *) mem_220703.mem)[gtid_235126] = defunc_1_op_res_235242;
            x_235234 = defunc_1_op_res_235242;
            ((int64_t *) mem_220706.mem)[gtid_235126] = defunc_1_op_res_235243;
            x_235235 = defunc_1_op_res_235243;
            ((int64_t *) mem_220709.mem)[gtid_235126] = defunc_1_op_res_235244;
            x_235236 = defunc_1_op_res_235244;
            ((int64_t *) mem_220712.mem)[gtid_235126] = defunc_1_op_res_235245;
            x_235237 = defunc_1_op_res_235245;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_236628_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_236628_end -
                 futhark_mc_scan_stage_3_parloop_236628_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_236628_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_236628_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_236628_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_236620(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235125 = tid;
    int num_tasks_235209 = info.nsubtasks;
    struct futhark_mc_task_236619 *futhark_mc_task_236619 =
                                  (struct futhark_mc_task_236619 *) args;
    struct futhark_context *ctx = futhark_mc_task_236619->ctx;
    uint64_t futhark_mc_segscan_task_236620_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_236620_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236619->free_n_203490;
    struct memblock mem_220703 = {.desc ="mem_220703", .mem =
                                  futhark_mc_task_236619->free_mem_220703,
                                  .size =0, .references =NULL};
    struct memblock mem_220706 = {.desc ="mem_220706", .mem =
                                  futhark_mc_task_236619->free_mem_220706,
                                  .size =0, .references =NULL};
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_task_236619->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220712 = {.desc ="mem_220712", .mem =
                                  futhark_mc_task_236619->free_mem_220712,
                                  .size =0, .references =NULL};
    struct memblock mem_220715 = {.desc ="mem_220715", .mem =
                                  futhark_mc_task_236619->free_mem_220715,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235111 = {.desc ="mem_param_235111", .mem =
                                        futhark_mc_task_236619->free_mem_param_235111,
                                        .size =0, .references =NULL};
    bool cond_f_res_235116 = futhark_mc_task_236619->free_cond_f_res_235116;
    bool cond_f_res_235117 = futhark_mc_task_236619->free_cond_f_res_235117;
    int64_t unsign_arg_235118 = futhark_mc_task_236619->free_unsign_arg_235118;
    int64_t unsign_arg_235119 = futhark_mc_task_236619->free_unsign_arg_235119;
    size_t scan_stage_2_accum_mem_235225_cached_sizze_236621 = 0;
    unsigned char *scan_stage_2_accum_mem_235225 = NULL;
    size_t scan_stage_2_accum_mem_235227_cached_sizze_236622 = 0;
    unsigned char *scan_stage_2_accum_mem_235227 = NULL;
    size_t scan_stage_2_accum_mem_235229_cached_sizze_236623 = 0;
    unsigned char *scan_stage_2_accum_mem_235229 = NULL;
    size_t scan_stage_2_accum_mem_235231_cached_sizze_236624 = 0;
    unsigned char *scan_stage_2_accum_mem_235231 = NULL;
    int64_t iter_235210;
    struct futhark_mc_scan_stage_1_parloop_struct_236625
    futhark_mc_scan_stage_1_parloop_struct_236625;
    
    futhark_mc_scan_stage_1_parloop_struct_236625.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_mem_220703 =
        mem_220703.mem;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_mem_220706 =
        mem_220706.mem;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_mem_220709 =
        mem_220709.mem;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_mem_220712 =
        mem_220712.mem;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_mem_220715 =
        mem_220715.mem;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_mem_param_235111 =
        mem_param_235111.mem;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_cond_f_res_235116 =
        cond_f_res_235116;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_cond_f_res_235117 =
        cond_f_res_235117;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_unsign_arg_235118 =
        unsign_arg_235118;
    futhark_mc_scan_stage_1_parloop_struct_236625.free_unsign_arg_235119 =
        unsign_arg_235119;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_236626_task;
    
    futhark_mc_scan_stage_1_parloop_236626_task.name =
        "futhark_mc_scan_stage_1_parloop_236626";
    futhark_mc_scan_stage_1_parloop_236626_task.fn =
        futhark_mc_scan_stage_1_parloop_236626;
    futhark_mc_scan_stage_1_parloop_236626_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_236625;
    futhark_mc_scan_stage_1_parloop_236626_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_236626_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_236626_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236626_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_236626_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_236626_task);
    
    if (futhark_mc_scan_stage_1_parloop_236626_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236626_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236626_total_end -
                 futhark_mc_scan_stage_1_parloop_236626_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236626_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236626_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236626_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_235209)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_235211;
        int64_t x_235212;
        int64_t x_235213;
        int64_t x_235214;
        int64_t x_235215;
        int64_t x_235216;
        int64_t x_235217;
        int64_t x_235218;
        int64_t offset_235223 = (int64_t) 0;
        int64_t offset_index_235224 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_235225_cached_sizze_236621 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235225 =
                realloc(scan_stage_2_accum_mem_235225, (int64_t) 8);
            scan_stage_2_accum_mem_235225_cached_sizze_236621 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_235227_cached_sizze_236622 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235227 =
                realloc(scan_stage_2_accum_mem_235227, (int64_t) 8);
            scan_stage_2_accum_mem_235227_cached_sizze_236622 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_235229_cached_sizze_236623 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235229 =
                realloc(scan_stage_2_accum_mem_235229, (int64_t) 8);
            scan_stage_2_accum_mem_235229_cached_sizze_236623 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_235231_cached_sizze_236624 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235231 =
                realloc(scan_stage_2_accum_mem_235231, (int64_t) 8);
            scan_stage_2_accum_mem_235231_cached_sizze_236624 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_235225)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_235227)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_235229)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_235231)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_235233 = 0; i_235233 < num_tasks_235209 - 1;
             i_235233++) {
            offset_235223 = squot64(n_203490, sext_i32_i64(num_tasks_235209));
            if (slt64(sext_i32_i64(i_235233), srem64(n_203490,
                                                     sext_i32_i64(num_tasks_235209)))) {
                offset_235223 += (int64_t) 1;
            }
            offset_index_235224 += offset_235223;
            
            int64_t gtid_235126 = offset_index_235224;
            double x_235139;
            
            x_235139 = ((double *) mem_param_235111.mem)[gtid_235126];
            
            int64_t i64_arg_235140;
            
            i64_arg_235140 = futrts_to_bits64(x_235139);
            
            int64_t unsign_arg_235141 = ashr64(i64_arg_235140,
                                               unsign_arg_235118);
            int64_t unsign_arg_235142 = (int64_t) 1 & unsign_arg_235141;
            int32_t to_i32_res_235143 = zext_i64_i32(unsign_arg_235142);
            int64_t unsign_arg_235144 = ashr64(i64_arg_235140, (int64_t) 63);
            int64_t unsign_arg_235145 = (int64_t) 1 & unsign_arg_235144;
            int32_t to_i32_res_235146 = zext_i64_i32(unsign_arg_235145);
            bool cond_235147 = to_i32_res_235146 == 1;
            bool x_235148 = !cond_235147;
            bool y_235149 = cond_f_res_235116 && x_235148;
            bool cond_235150 = cond_235147 || y_235149;
            int32_t defunc_1_get_bit_res_235151;
            
            if (cond_235150) {
                int32_t defunc_1_get_bit_res_t_res_235152 = 1 ^
                        to_i32_res_235143;
                
                defunc_1_get_bit_res_235151 = defunc_1_get_bit_res_t_res_235152;
            } else {
                defunc_1_get_bit_res_235151 = to_i32_res_235143;
            }
            
            int32_t x_235153 = mul32(2, defunc_1_get_bit_res_235151);
            int64_t unsign_arg_235154 = ashr64(i64_arg_235140,
                                               unsign_arg_235119);
            int64_t unsign_arg_235155 = (int64_t) 1 & unsign_arg_235154;
            int32_t to_i32_res_235156 = zext_i64_i32(unsign_arg_235155);
            bool y_235157 = cond_f_res_235117 && x_235148;
            bool cond_235158 = cond_235147 || y_235157;
            int32_t defunc_1_get_bit_res_235159;
            
            if (cond_235158) {
                int32_t defunc_1_get_bit_res_t_res_235160 = 1 ^
                        to_i32_res_235156;
                
                defunc_1_get_bit_res_235159 = defunc_1_get_bit_res_t_res_235160;
            } else {
                defunc_1_get_bit_res_235159 = to_i32_res_235156;
            }
            
            int32_t defunc_0_f_res_235161 = add32(x_235153,
                                                  defunc_1_get_bit_res_235159);
            bool cond_235162 = defunc_0_f_res_235161 == 0;
            int64_t defunc_0_f_res_235163 = btoi_bool_i64(cond_235162);
            int64_t defunc_0_f_res_235164;
            int64_t defunc_0_f_res_235165;
            int64_t defunc_0_f_res_235166;
            
            if (cond_235162) {
                defunc_0_f_res_235164 = (int64_t) 0;
                defunc_0_f_res_235165 = (int64_t) 0;
                defunc_0_f_res_235166 = (int64_t) 0;
            } else {
                bool cond_235167 = defunc_0_f_res_235161 == 1;
                int64_t defunc_0_f_res_f_res_235168 =
                        btoi_bool_i64(cond_235167);
                int64_t defunc_0_f_res_f_res_235169;
                int64_t defunc_0_f_res_f_res_235170;
                
                if (cond_235167) {
                    defunc_0_f_res_f_res_235169 = (int64_t) 0;
                    defunc_0_f_res_f_res_235170 = (int64_t) 0;
                } else {
                    bool cond_235171 = defunc_0_f_res_235161 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_235172 =
                            btoi_bool_i64(cond_235171);
                    bool cond_neg_235173 = !cond_235171;
                    int64_t defunc_0_f_res_f_res_f_res_235174 =
                            btoi_bool_i64(cond_neg_235173);
                    
                    defunc_0_f_res_f_res_235169 =
                        defunc_0_f_res_f_res_f_res_235172;
                    defunc_0_f_res_f_res_235170 =
                        defunc_0_f_res_f_res_f_res_235174;
                }
                defunc_0_f_res_235164 = defunc_0_f_res_f_res_235168;
                defunc_0_f_res_235165 = defunc_0_f_res_f_res_235169;
                defunc_0_f_res_235166 = defunc_0_f_res_f_res_235170;
            }
            // Read carry in
            {
                x_235211 =
                    ((int64_t *) scan_stage_2_accum_mem_235225)[(int64_t) 0];
                x_235212 =
                    ((int64_t *) scan_stage_2_accum_mem_235227)[(int64_t) 0];
                x_235213 =
                    ((int64_t *) scan_stage_2_accum_mem_235229)[(int64_t) 0];
                x_235214 =
                    ((int64_t *) scan_stage_2_accum_mem_235231)[(int64_t) 0];
            }
            // Read next values
            {
                x_235215 = ((int64_t *) mem_220703.mem)[offset_index_235224 -
                                                        (int64_t) 1];
                x_235216 = ((int64_t *) mem_220706.mem)[offset_index_235224 -
                                                        (int64_t) 1];
                x_235217 = ((int64_t *) mem_220709.mem)[offset_index_235224 -
                                                        (int64_t) 1];
                x_235218 = ((int64_t *) mem_220712.mem)[offset_index_235224 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_235219 = add64(x_235211, x_235215);
            int64_t defunc_1_op_res_235220 = add64(x_235212, x_235216);
            int64_t defunc_1_op_res_235221 = add64(x_235213, x_235217);
            int64_t defunc_1_op_res_235222 = add64(x_235214, x_235218);
            
            ((int64_t *) mem_220703.mem)[offset_index_235224 - (int64_t) 1] =
                defunc_1_op_res_235219;
            ((int64_t *) scan_stage_2_accum_mem_235225)[(int64_t) 0] =
                defunc_1_op_res_235219;
            ((int64_t *) mem_220706.mem)[offset_index_235224 - (int64_t) 1] =
                defunc_1_op_res_235220;
            ((int64_t *) scan_stage_2_accum_mem_235227)[(int64_t) 0] =
                defunc_1_op_res_235220;
            ((int64_t *) mem_220709.mem)[offset_index_235224 - (int64_t) 1] =
                defunc_1_op_res_235221;
            ((int64_t *) scan_stage_2_accum_mem_235229)[(int64_t) 0] =
                defunc_1_op_res_235221;
            ((int64_t *) mem_220712.mem)[offset_index_235224 - (int64_t) 1] =
                defunc_1_op_res_235222;
            ((int64_t *) scan_stage_2_accum_mem_235231)[(int64_t) 0] =
                defunc_1_op_res_235222;
        }
        
        int64_t iter_235246 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_236627
        futhark_mc_scan_stage_3_parloop_struct_236627;
        
        futhark_mc_scan_stage_3_parloop_struct_236627.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_mem_220703 =
            mem_220703.mem;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_mem_220706 =
            mem_220706.mem;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_mem_220709 =
            mem_220709.mem;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_mem_220712 =
            mem_220712.mem;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_mem_param_235111 =
            mem_param_235111.mem;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_cond_f_res_235116 =
            cond_f_res_235116;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_cond_f_res_235117 =
            cond_f_res_235117;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_unsign_arg_235118 =
            unsign_arg_235118;
        futhark_mc_scan_stage_3_parloop_struct_236627.free_unsign_arg_235119 =
            unsign_arg_235119;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_236628_task;
        
        futhark_mc_scan_stage_3_parloop_236628_task.name =
            "futhark_mc_scan_stage_3_parloop_236628";
        futhark_mc_scan_stage_3_parloop_236628_task.fn =
            futhark_mc_scan_stage_3_parloop_236628;
        futhark_mc_scan_stage_3_parloop_236628_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_236627;
        futhark_mc_scan_stage_3_parloop_236628_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_236628_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_236628_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_236628_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_236628_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_236628_task);
        
        if (futhark_mc_scan_stage_3_parloop_236628_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_236628_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_236628_total_end -
                     futhark_mc_scan_stage_3_parloop_236628_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236628_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236628_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236628_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_235225);
        free(scan_stage_2_accum_mem_235227);
        free(scan_stage_2_accum_mem_235229);
        free(scan_stage_2_accum_mem_235231);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_236620_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_236620_end -
                 futhark_mc_segscan_task_236620_start;
        
        ctx->futhark_mc_segscan_task_236620_runs[tid]++;
        ctx->futhark_mc_segscan_task_236620_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_236620_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236629 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    unsigned char *free_mem_220703;
    unsigned char *free_mem_220706;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220712;
    unsigned char *free_mem_220715;
    unsigned char *free_mem_param_235111;
    unsigned char *free_mem_param_out_235112;
    int64_t free_last_res_235175;
    int64_t free_last_res_235176;
    int64_t free_last_res_235177;
};
struct futhark_mc_segmap_parloop_struct_236631 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    unsigned char *free_mem_220703;
    unsigned char *free_mem_220706;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220712;
    unsigned char *free_mem_220715;
    unsigned char *free_mem_param_235111;
    unsigned char *free_mem_param_out_235112;
    int64_t free_last_res_235175;
    int64_t free_last_res_235176;
    int64_t free_last_res_235177;
};
static int futhark_mc_segmap_parloop_236632(void *args, int64_t start,
                                            int64_t end, int flat_tid_235180,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236631
    *futhark_mc_segmap_parloop_struct_236631 =
    (struct futhark_mc_segmap_parloop_struct_236631 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236631->ctx;
    uint64_t futhark_mc_segmap_parloop_236632_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236632_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236631->free_n_203490;
    struct memblock mem_220703 = {.desc ="mem_220703", .mem =
                                  futhark_mc_segmap_parloop_struct_236631->free_mem_220703,
                                  .size =0, .references =NULL};
    struct memblock mem_220706 = {.desc ="mem_220706", .mem =
                                  futhark_mc_segmap_parloop_struct_236631->free_mem_220706,
                                  .size =0, .references =NULL};
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_segmap_parloop_struct_236631->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220712 = {.desc ="mem_220712", .mem =
                                  futhark_mc_segmap_parloop_struct_236631->free_mem_220712,
                                  .size =0, .references =NULL};
    struct memblock mem_220715 = {.desc ="mem_220715", .mem =
                                  futhark_mc_segmap_parloop_struct_236631->free_mem_220715,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235111 = {.desc ="mem_param_235111", .mem =
                                        futhark_mc_segmap_parloop_struct_236631->free_mem_param_235111,
                                        .size =0, .references =NULL};
    struct memblock mem_param_out_235112 = {.desc ="mem_param_out_235112",
                                            .mem =
                                            futhark_mc_segmap_parloop_struct_236631->free_mem_param_out_235112,
                                            .size =0, .references =NULL};
    int64_t last_res_235175 =
            futhark_mc_segmap_parloop_struct_236631->free_last_res_235175;
    int64_t last_res_235176 =
            futhark_mc_segmap_parloop_struct_236631->free_last_res_235176;
    int64_t last_res_235177 =
            futhark_mc_segmap_parloop_struct_236631->free_last_res_235177;
    int64_t iterations = end - start;
    int64_t iter_235248 = start;
    
    for (; iter_235248 < end; iter_235248++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235267 = n_203490;
        int64_t gtid_235181 = iter_235248;
        int64_t remnant_235268 = iter_235248 - gtid_235181;
        int32_t x_235182;
        
        x_235182 = ((int32_t *) mem_220715.mem)[gtid_235181];
        
        double write_value_235183;
        
        write_value_235183 = ((double *) mem_param_235111.mem)[gtid_235181];
        
        bool match_lit_235184 = 0 == x_235182;
        int64_t defunc_1_f_res_235185;
        
        if (match_lit_235184) {
            int64_t x_235249;
            
            x_235249 = ((int64_t *) mem_220703.mem)[gtid_235181];
            
            int64_t case_res_235250 = sub64(x_235249, (int64_t) 1);
            
            defunc_1_f_res_235185 = case_res_235250;
        } else {
            bool match_lit_235251 = 1 == x_235182;
            int64_t x_235252;
            
            if (match_lit_235251) {
                int64_t x_235253;
                
                x_235253 = ((int64_t *) mem_220706.mem)[gtid_235181];
                
                int64_t x_235254 = add64(last_res_235175, x_235253);
                int64_t case_res_235255 = sub64(x_235254, (int64_t) 1);
                
                x_235252 = case_res_235255;
            } else {
                bool match_lit_235256 = 2 == x_235182;
                int64_t x_235257;
                
                if (match_lit_235256) {
                    int64_t x_235258;
                    
                    x_235258 = ((int64_t *) mem_220709.mem)[gtid_235181];
                    
                    int64_t x_235259 = add64(last_res_235175, last_res_235176);
                    int64_t x_235260 = add64(x_235258, x_235259);
                    int64_t case_res_235261 = sub64(x_235260, (int64_t) 1);
                    
                    x_235257 = case_res_235261;
                } else {
                    int64_t x_235262;
                    
                    x_235262 = ((int64_t *) mem_220712.mem)[gtid_235181];
                    
                    int64_t x_235263 = add64(last_res_235175, last_res_235176);
                    int64_t x_235264 = add64(last_res_235177, x_235263);
                    int64_t x_235265 = add64(x_235262, x_235264);
                    int64_t defunc_1_f_res_res_235266 = sub64(x_235265,
                                                              (int64_t) 1);
                    
                    x_235257 = defunc_1_f_res_res_235266;
                }
                x_235252 = x_235257;
            }
            defunc_1_f_res_235185 = x_235252;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_235185) &&
            slt64(defunc_1_f_res_235185, n_203490)) {
            ((double *) mem_param_out_235112.mem)[defunc_1_f_res_235185] =
                write_value_235183;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236632_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236632_end -
                 futhark_mc_segmap_parloop_236632_start;
        
        ctx->futhark_mc_segmap_parloop_236632_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236632_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236632_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236630(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235180 = tid;
    int num_tasks_235247 = info.nsubtasks;
    struct futhark_mc_task_236629 *futhark_mc_task_236629 =
                                  (struct futhark_mc_task_236629 *) args;
    struct futhark_context *ctx = futhark_mc_task_236629->ctx;
    uint64_t futhark_mc_segmap_task_236630_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236630_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236629->free_n_203490;
    struct memblock mem_220703 = {.desc ="mem_220703", .mem =
                                  futhark_mc_task_236629->free_mem_220703,
                                  .size =0, .references =NULL};
    struct memblock mem_220706 = {.desc ="mem_220706", .mem =
                                  futhark_mc_task_236629->free_mem_220706,
                                  .size =0, .references =NULL};
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_task_236629->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220712 = {.desc ="mem_220712", .mem =
                                  futhark_mc_task_236629->free_mem_220712,
                                  .size =0, .references =NULL};
    struct memblock mem_220715 = {.desc ="mem_220715", .mem =
                                  futhark_mc_task_236629->free_mem_220715,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235111 = {.desc ="mem_param_235111", .mem =
                                        futhark_mc_task_236629->free_mem_param_235111,
                                        .size =0, .references =NULL};
    struct memblock mem_param_out_235112 = {.desc ="mem_param_out_235112",
                                            .mem =
                                            futhark_mc_task_236629->free_mem_param_out_235112,
                                            .size =0, .references =NULL};
    int64_t last_res_235175 = futhark_mc_task_236629->free_last_res_235175;
    int64_t last_res_235176 = futhark_mc_task_236629->free_last_res_235176;
    int64_t last_res_235177 = futhark_mc_task_236629->free_last_res_235177;
    int64_t iter_235248;
    struct futhark_mc_segmap_parloop_struct_236631
    futhark_mc_segmap_parloop_struct_236631;
    
    futhark_mc_segmap_parloop_struct_236631.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236631.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236631.free_mem_220703 = mem_220703.mem;
    futhark_mc_segmap_parloop_struct_236631.free_mem_220706 = mem_220706.mem;
    futhark_mc_segmap_parloop_struct_236631.free_mem_220709 = mem_220709.mem;
    futhark_mc_segmap_parloop_struct_236631.free_mem_220712 = mem_220712.mem;
    futhark_mc_segmap_parloop_struct_236631.free_mem_220715 = mem_220715.mem;
    futhark_mc_segmap_parloop_struct_236631.free_mem_param_235111 =
        mem_param_235111.mem;
    futhark_mc_segmap_parloop_struct_236631.free_mem_param_out_235112 =
        mem_param_out_235112.mem;
    futhark_mc_segmap_parloop_struct_236631.free_last_res_235175 =
        last_res_235175;
    futhark_mc_segmap_parloop_struct_236631.free_last_res_235176 =
        last_res_235176;
    futhark_mc_segmap_parloop_struct_236631.free_last_res_235177 =
        last_res_235177;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236632_task;
    
    futhark_mc_segmap_parloop_236632_task.name =
        "futhark_mc_segmap_parloop_236632";
    futhark_mc_segmap_parloop_236632_task.fn = futhark_mc_segmap_parloop_236632;
    futhark_mc_segmap_parloop_236632_task.args =
        &futhark_mc_segmap_parloop_struct_236631;
    futhark_mc_segmap_parloop_236632_task.iterations = iterations;
    futhark_mc_segmap_parloop_236632_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236632_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236632_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236632_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236632_task);
    
    if (futhark_mc_segmap_parloop_236632_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236632_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236632_total_end -
                 futhark_mc_segmap_parloop_236632_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236632_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236632_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236632_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236630_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236630_end -
                 futhark_mc_segmap_task_236630_start;
        
        ctx->futhark_mc_segmap_task_236630_runs[tid]++;
        ctx->futhark_mc_segmap_task_236630_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236630_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236613(void *args, int64_t start,
                                            int64_t end, int flat_tid_215684,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236612
    *futhark_mc_segmap_parloop_struct_236612 =
    (struct futhark_mc_segmap_parloop_struct_236612 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236612->ctx;
    uint64_t futhark_mc_segmap_parloop_236613_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236613_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236612->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236612->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_segmap_parloop_struct_236612->free_i_203670;
    int32_t iters_206665 =
            futhark_mc_segmap_parloop_struct_236612->free_iters_206665;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236612->free_bytes_217302;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_segmap_parloop_struct_236612->free_mem_220685,
                                  .size =0, .references =NULL};
    int64_t bytes_220714 =
            futhark_mc_segmap_parloop_struct_236612->free_bytes_220714;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_segmap_parloop_struct_236612->free_mem_220835,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221020 =
            futhark_mc_segmap_parloop_struct_236612->free_num_bytes_221020;
    size_t mem_220703_cached_sizze_236614 = 0;
    unsigned char *mem_220703 = NULL;
    size_t mem_220706_cached_sizze_236615 = 0;
    unsigned char *mem_220706 = NULL;
    size_t mem_220709_cached_sizze_236616 = 0;
    unsigned char *mem_220709 = NULL;
    size_t mem_220712_cached_sizze_236617 = 0;
    unsigned char *mem_220712 = NULL;
    size_t mem_220715_cached_sizze_236618 = 0;
    unsigned char *mem_220715 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235109 = start;
    
    if (mem_220703_cached_sizze_236614 < (size_t) bytes_217302) {
        mem_220703 = realloc(mem_220703, bytes_217302);
        mem_220703_cached_sizze_236614 = bytes_217302;
    }
    if (mem_220706_cached_sizze_236615 < (size_t) bytes_217302) {
        mem_220706 = realloc(mem_220706, bytes_217302);
        mem_220706_cached_sizze_236615 = bytes_217302;
    }
    if (mem_220709_cached_sizze_236616 < (size_t) bytes_217302) {
        mem_220709 = realloc(mem_220709, bytes_217302);
        mem_220709_cached_sizze_236616 = bytes_217302;
    }
    if (mem_220712_cached_sizze_236617 < (size_t) bytes_217302) {
        mem_220712 = realloc(mem_220712, bytes_217302);
        mem_220712_cached_sizze_236617 = bytes_217302;
    }
    if (mem_220715_cached_sizze_236618 < (size_t) bytes_220714) {
        mem_220715 = realloc(mem_220715, bytes_220714);
        mem_220715_cached_sizze_236618 = bytes_220714;
    }
    
    struct memblock mem_in_221021;
    
    mem_in_221021.references = NULL;
    if (memblock_alloc(ctx, &mem_in_221021, num_bytes_221020,
                       "mem_in_221021")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock mem_220718;
    
    mem_220718.references = NULL;
    if (memblock_alloc(ctx, &mem_220718, bytes_217302, "mem_220718")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock ext_mem_220721;
    
    ext_mem_220721.references = NULL;
    
    struct memblock ext_mem_unused_221022;
    
    ext_mem_unused_221022.references = NULL;
    
    struct memblock mem_param_235111;
    
    mem_param_235111.references = NULL;
    
    struct memblock mem_param_out_235112;
    
    mem_param_out_235112.references = NULL;
    for (; iter_235109 < end; iter_235109++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235204 = partition_sizze_203577;
        int64_t gtid_215685 = iter_235109;
        int64_t remnant_235205 = iter_235109 - gtid_215685;
        
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_in_221021.mem + (int64_t) 0, mem_220685.mem +
                    gtid_215685 * n_203490 * (int64_t) 8, n_203490 *
                    (int64_t) 8);
        if (memblock_set(ctx, &mem_param_235111, &mem_in_221021,
                         "mem_in_221021") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_out_235112, &mem_220718,
                         "mem_220718") != 0)
            return 1;
        for (int32_t i_235110 = 0; i_235110 < iters_206665; i_235110++) {
            int32_t defunc_2_radix_sort_step_arg_235114 = mul32(2, i_235110);
            int32_t defunc_0_get_bit_arg_235115 = add32(1,
                                                        defunc_2_radix_sort_step_arg_235114);
            bool cond_f_res_235116 = defunc_0_get_bit_arg_235115 == 63;
            bool cond_f_res_235117 = defunc_2_radix_sort_step_arg_235114 == 63;
            int64_t unsign_arg_235118 =
                    zext_i32_i64(defunc_0_get_bit_arg_235115);
            int64_t unsign_arg_235119 =
                    zext_i32_i64(defunc_2_radix_sort_step_arg_235114);
            int64_t flat_tid_235125 = (int64_t) 0;
            int32_t num_tasks_235209;
            
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "nonsegmented segScan");
            
            struct futhark_mc_task_236619 futhark_mc_task_236619;
            
            futhark_mc_task_236619.ctx = ctx;
            futhark_mc_task_236619.free_n_203490 = n_203490;
            futhark_mc_task_236619.free_mem_220703 = mem_220703;
            futhark_mc_task_236619.free_mem_220706 = mem_220706;
            futhark_mc_task_236619.free_mem_220709 = mem_220709;
            futhark_mc_task_236619.free_mem_220712 = mem_220712;
            futhark_mc_task_236619.free_mem_220715 = mem_220715;
            futhark_mc_task_236619.free_mem_param_235111 = mem_param_235111.mem;
            futhark_mc_task_236619.free_cond_f_res_235116 = cond_f_res_235116;
            futhark_mc_task_236619.free_cond_f_res_235117 = cond_f_res_235117;
            futhark_mc_task_236619.free_unsign_arg_235118 = unsign_arg_235118;
            futhark_mc_task_236619.free_unsign_arg_235119 = unsign_arg_235119;
            
            struct scheduler_segop futhark_mc_task_236619_task;
            
            futhark_mc_task_236619_task.args = &futhark_mc_task_236619;
            futhark_mc_task_236619_task.top_level_fn =
                futhark_mc_segscan_task_236620;
            futhark_mc_task_236619_task.name = "futhark_mc_segscan_task_236620";
            futhark_mc_task_236619_task.iterations = n_203490;
            futhark_mc_task_236619_task.task_time =
                &ctx->futhark_mc_segscan_task_236620_total_time;
            futhark_mc_task_236619_task.task_iter =
                &ctx->futhark_mc_segscan_task_236620_total_iter;
            futhark_mc_task_236619_task.sched = STATIC;
            futhark_mc_task_236619_task.nested_fn = NULL;
            
            int futhark_mc_segscan_task_236620_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236619_task);
            
            if (futhark_mc_segscan_task_236620_err != 0) {
                if (memblock_unref(ctx, &mem_param_out_235112,
                                   "mem_param_out_235112") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_235111,
                                   "mem_param_235111") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_unused_221022,
                                   "ext_mem_unused_221022") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220721, "ext_mem_220721") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_220718, "mem_220718") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_in_221021, "mem_in_221021") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t last_res_235175;
            
            last_res_235175 = ((int64_t *) mem_220703)[i_203670];
            
            int64_t last_res_235176;
            
            last_res_235176 = ((int64_t *) mem_220706)[i_203670];
            
            int64_t last_res_235177;
            
            last_res_235177 = ((int64_t *) mem_220709)[i_203670];
            if (n_203490 * (int64_t) 8 > 0)
                memmove(mem_param_out_235112.mem + (int64_t) 0,
                        mem_param_235111.mem + (int64_t) 0, n_203490 *
                        (int64_t) 8);
            
            int64_t flat_tid_235180 = (int64_t) 0;
            int32_t num_tasks_235247;
            struct futhark_mc_task_236629 futhark_mc_task_236629;
            
            futhark_mc_task_236629.ctx = ctx;
            futhark_mc_task_236629.free_n_203490 = n_203490;
            futhark_mc_task_236629.free_mem_220703 = mem_220703;
            futhark_mc_task_236629.free_mem_220706 = mem_220706;
            futhark_mc_task_236629.free_mem_220709 = mem_220709;
            futhark_mc_task_236629.free_mem_220712 = mem_220712;
            futhark_mc_task_236629.free_mem_220715 = mem_220715;
            futhark_mc_task_236629.free_mem_param_235111 = mem_param_235111.mem;
            futhark_mc_task_236629.free_mem_param_out_235112 =
                mem_param_out_235112.mem;
            futhark_mc_task_236629.free_last_res_235175 = last_res_235175;
            futhark_mc_task_236629.free_last_res_235176 = last_res_235176;
            futhark_mc_task_236629.free_last_res_235177 = last_res_235177;
            
            struct scheduler_segop futhark_mc_task_236629_task;
            
            futhark_mc_task_236629_task.args = &futhark_mc_task_236629;
            futhark_mc_task_236629_task.top_level_fn =
                futhark_mc_segmap_task_236630;
            futhark_mc_task_236629_task.name = "futhark_mc_segmap_task_236630";
            futhark_mc_task_236629_task.iterations = n_203490;
            futhark_mc_task_236629_task.task_time =
                &ctx->futhark_mc_segmap_task_236630_total_time;
            futhark_mc_task_236629_task.task_iter =
                &ctx->futhark_mc_segmap_task_236630_total_iter;
            futhark_mc_task_236629_task.sched = STATIC;
            futhark_mc_task_236629_task.nested_fn = NULL;
            
            int futhark_mc_segmap_task_236630_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236629_task);
            
            if (futhark_mc_segmap_task_236630_err != 0) {
                if (memblock_unref(ctx, &mem_param_out_235112,
                                   "mem_param_out_235112") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_235111,
                                   "mem_param_235111") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_unused_221022,
                                   "ext_mem_unused_221022") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220721, "ext_mem_220721") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_220718, "mem_220718") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_in_221021, "mem_in_221021") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock mem_param_tmp_235206;
            
            mem_param_tmp_235206.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_235206, &mem_param_out_235112,
                             "mem_param_out_235112") != 0)
                return 1;
            
            struct memblock mem_param_out_tmp_235207;
            
            mem_param_out_tmp_235207.references = NULL;
            if (memblock_set(ctx, &mem_param_out_tmp_235207, &mem_param_235111,
                             "mem_param_235111") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_235111, &mem_param_tmp_235206,
                             "mem_param_tmp_235206") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_out_235112,
                             &mem_param_out_tmp_235207,
                             "mem_param_out_tmp_235207") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_out_tmp_235207,
                               "mem_param_out_tmp_235207") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_235206,
                               "mem_param_tmp_235206") != 0)
                return 1;
        }
        if (memblock_set(ctx, &ext_mem_220721, &mem_param_235111,
                         "mem_param_235111") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_unused_221022, &mem_param_out_235112,
                         "mem_param_out_235112") != 0)
            return 1;
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220835.mem + gtid_215685 * n_203490 * (int64_t) 8,
                    ext_mem_220721.mem + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220703);
    free(mem_220706);
    free(mem_220709);
    free(mem_220712);
    free(mem_220715);
    if (memblock_unref(ctx, &mem_param_out_235112, "mem_param_out_235112") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_235111, "mem_param_235111") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_unused_221022, "ext_mem_unused_221022") !=
        0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220721, "ext_mem_220721") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_220718, "mem_220718") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_in_221021, "mem_in_221021") != 0)
        return 1;
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236613_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236613_end -
                 futhark_mc_segmap_parloop_236613_start;
        
        ctx->futhark_mc_segmap_parloop_236613_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236613_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236613_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236611(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215684 = tid;
    int num_tasks_234983 = info.nsubtasks;
    struct futhark_mc_task_236602 *futhark_mc_task_236602 =
                                  (struct futhark_mc_task_236602 *) args;
    struct futhark_context *ctx = futhark_mc_task_236602->ctx;
    uint64_t futhark_mc_segmap_nested_task_236611_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236611_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236602->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236602->free_partition_sizze_203577;
    int64_t i_203670 = futhark_mc_task_236602->free_i_203670;
    int32_t iters_206665 = futhark_mc_task_236602->free_iters_206665;
    int64_t bytes_217302 = futhark_mc_task_236602->free_bytes_217302;
    struct memblock mem_220685 = {.desc ="mem_220685", .mem =
                                  futhark_mc_task_236602->free_mem_220685,
                                  .size =0, .references =NULL};
    int64_t bytes_220714 = futhark_mc_task_236602->free_bytes_220714;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_task_236602->free_mem_220835,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221020 = futhark_mc_task_236602->free_num_bytes_221020;
    int64_t num_bytes_221025 = futhark_mc_task_236602->free_num_bytes_221025;
    int64_t iter_235109;
    struct futhark_mc_segmap_parloop_struct_236612
    futhark_mc_segmap_parloop_struct_236612;
    
    futhark_mc_segmap_parloop_struct_236612.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236612.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236612.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236612.free_i_203670 = i_203670;
    futhark_mc_segmap_parloop_struct_236612.free_iters_206665 = iters_206665;
    futhark_mc_segmap_parloop_struct_236612.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236612.free_mem_220685 = mem_220685.mem;
    futhark_mc_segmap_parloop_struct_236612.free_bytes_220714 = bytes_220714;
    futhark_mc_segmap_parloop_struct_236612.free_mem_220835 = mem_220835.mem;
    futhark_mc_segmap_parloop_struct_236612.free_num_bytes_221020 =
        num_bytes_221020;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236613_task;
    
    futhark_mc_segmap_parloop_236613_task.name =
        "futhark_mc_segmap_parloop_236613";
    futhark_mc_segmap_parloop_236613_task.fn = futhark_mc_segmap_parloop_236613;
    futhark_mc_segmap_parloop_236613_task.args =
        &futhark_mc_segmap_parloop_struct_236612;
    futhark_mc_segmap_parloop_236613_task.iterations = iterations;
    futhark_mc_segmap_parloop_236613_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236613_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236613_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236613_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236613_task);
    
    if (futhark_mc_segmap_parloop_236613_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236613_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236613_total_end -
                 futhark_mc_segmap_parloop_236613_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236613_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236613_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236613_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236611_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236611_end -
                 futhark_mc_segmap_nested_task_236611_start;
        
        ctx->futhark_mc_segmap_nested_task_236611_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236611_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236611_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236633 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_stl_res_203664;
    int64_t free_j_m_i_204133;
    unsigned char *free_mem_220835;
    unsigned char *free_mem_220838;
    unsigned char *free_mem_220841;
    unsigned char *free_mem_220844;
};
struct futhark_mc_segmap_parloop_struct_236635 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_stl_res_203664;
    int64_t free_j_m_i_204133;
    unsigned char *free_mem_220835;
    unsigned char *free_mem_220838;
    unsigned char *free_mem_220841;
    unsigned char *free_mem_220844;
};
static int futhark_mc_segmap_parloop_236636(void *args, int64_t start,
                                            int64_t end, int flat_tid_215780,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236635
    *futhark_mc_segmap_parloop_struct_236635 =
    (struct futhark_mc_segmap_parloop_struct_236635 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236635->ctx;
    uint64_t futhark_mc_segmap_parloop_236636_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236636_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236635->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236635->free_partition_sizze_203577;
    int64_t stl_res_203664 =
            futhark_mc_segmap_parloop_struct_236635->free_stl_res_203664;
    int64_t j_m_i_204133 =
            futhark_mc_segmap_parloop_struct_236635->free_j_m_i_204133;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_segmap_parloop_struct_236635->free_mem_220835,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_segmap_parloop_struct_236635->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_segmap_parloop_struct_236635->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_segmap_parloop_struct_236635->free_mem_220844,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235270 = start;
    
    for (; iter_235270 < end; iter_235270++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235276 = partition_sizze_203577;
        int64_t gtid_215781 = iter_235270;
        int64_t remnant_235277 = iter_235270 - gtid_215781;
        double defunc_2_reduce_res_206809;
        double redout_235272 = 0.0;
        
        for (int64_t i_235271 = 0; i_235271 < j_m_i_204133; i_235271++) {
            int64_t slice_235273 = stl_res_203664 + i_235271;
            double x_235274;
            
            x_235274 = ((double *) mem_220835.mem)[gtid_215781 * n_203490 +
                                                   slice_235273];
            
            double defunc_1_op_res_235275 = x_235274 + redout_235272;
            double redout_tmp_235278 = defunc_1_op_res_235275;
            
            redout_235272 = redout_tmp_235278;
        }
        defunc_2_reduce_res_206809 = redout_235272;
        
        double h_206814 = 3.0 * defunc_2_reduce_res_206809;
        double h9_206815 = 0.999 * h_206814;
        double h1_206816 = 1.0e-3 * h_206814;
        
        ((double *) mem_220838.mem)[gtid_215781] = h_206814;
        ((double *) mem_220841.mem)[gtid_215781] = h9_206815;
        ((double *) mem_220844.mem)[gtid_215781] = h1_206816;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236636_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236636_end -
                 futhark_mc_segmap_parloop_236636_start;
        
        ctx->futhark_mc_segmap_parloop_236636_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236636_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236636_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236634(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215780 = tid;
    int num_tasks_235269 = info.nsubtasks;
    struct futhark_mc_task_236633 *futhark_mc_task_236633 =
                                  (struct futhark_mc_task_236633 *) args;
    struct futhark_context *ctx = futhark_mc_task_236633->ctx;
    uint64_t futhark_mc_segmap_task_236634_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236634_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236633->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236633->free_partition_sizze_203577;
    int64_t stl_res_203664 = futhark_mc_task_236633->free_stl_res_203664;
    int64_t j_m_i_204133 = futhark_mc_task_236633->free_j_m_i_204133;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_task_236633->free_mem_220835,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_task_236633->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_task_236633->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_task_236633->free_mem_220844,
                                  .size =0, .references =NULL};
    int64_t iter_235270;
    struct futhark_mc_segmap_parloop_struct_236635
    futhark_mc_segmap_parloop_struct_236635;
    
    futhark_mc_segmap_parloop_struct_236635.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236635.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236635.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236635.free_stl_res_203664 =
        stl_res_203664;
    futhark_mc_segmap_parloop_struct_236635.free_j_m_i_204133 = j_m_i_204133;
    futhark_mc_segmap_parloop_struct_236635.free_mem_220835 = mem_220835.mem;
    futhark_mc_segmap_parloop_struct_236635.free_mem_220838 = mem_220838.mem;
    futhark_mc_segmap_parloop_struct_236635.free_mem_220841 = mem_220841.mem;
    futhark_mc_segmap_parloop_struct_236635.free_mem_220844 = mem_220844.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236636_task;
    
    futhark_mc_segmap_parloop_236636_task.name =
        "futhark_mc_segmap_parloop_236636";
    futhark_mc_segmap_parloop_236636_task.fn = futhark_mc_segmap_parloop_236636;
    futhark_mc_segmap_parloop_236636_task.args =
        &futhark_mc_segmap_parloop_struct_236635;
    futhark_mc_segmap_parloop_236636_task.iterations = iterations;
    futhark_mc_segmap_parloop_236636_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236636_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236636_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236636_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236636_task);
    
    if (futhark_mc_segmap_parloop_236636_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236636_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236636_total_end -
                 futhark_mc_segmap_parloop_236636_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236636_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236636_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236636_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236634_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236634_end -
                 futhark_mc_segmap_task_236634_start;
        
        ctx->futhark_mc_segmap_task_236634_runs[tid]++;
        ctx->futhark_mc_segmap_task_236634_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236634_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236638 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_stl_res_203664;
    int64_t free_j_m_i_204133;
    unsigned char *free_mem_220835;
    unsigned char *free_mem_220838;
    unsigned char *free_mem_220841;
    unsigned char *free_mem_220844;
};
struct futhark_mc_task_236640 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_stl_res_203664;
    int64_t free_gtid_215787;
    unsigned char *free_mem_220835;
    double *retval_defunc_2_reduce_res_215789;
};
struct futhark_mc_segred_stage_1_parloop_struct_236643 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_stl_res_203664;
    int64_t free_gtid_215787;
    unsigned char *free_mem_220835;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_235290;
};
static int futhark_mc_segred_stage_1_parloop_236644(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_235280,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236643
    *futhark_mc_segred_stage_1_parloop_struct_236643 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236643 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236643->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236644_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236644_start = get_wall_time();
    
    int64_t n_203490 =
            futhark_mc_segred_stage_1_parloop_struct_236643->free_n_203490;
    int64_t stl_res_203664 =
            futhark_mc_segred_stage_1_parloop_struct_236643->free_stl_res_203664;
    int64_t gtid_215787 =
            futhark_mc_segred_stage_1_parloop_struct_236643->free_gtid_215787;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236643->free_mem_220835,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_235290 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_235290",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236643->free_reduce_stage_1_tid_res_arr_mem_235290,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235292 = start;
    double x_235282;
    double x_235283;
    double local_acc_235293 = 0.0;
    
    for (; iter_235292 < end; iter_235292++) {
        int64_t gtid_235281 = iter_235292;
        int64_t slice_235285 = stl_res_203664 + gtid_235281;
        double x_235286;
        
        x_235286 = ((double *) mem_220835.mem)[gtid_215787 * n_203490 +
                                               slice_235285];
        // save map-out results
        { }
        // Load accum params
        {
            x_235282 = local_acc_235293;
        }
        // Load next params
        {
            x_235283 = x_235286;
        }
        // Red body
        {
            double defunc_1_op_res_235284 = x_235282 + x_235283;
            
            local_acc_235293 = defunc_1_op_res_235284;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_235290.mem)[flat_tid_235280] =
        local_acc_235293;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236644_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236644_end -
                 futhark_mc_segred_stage_1_parloop_236644_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236644_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236644_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236644_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236641(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235280 = tid;
    int num_tasks_235289 = info.nsubtasks;
    struct futhark_mc_task_236640 *futhark_mc_task_236640 =
                                  (struct futhark_mc_task_236640 *) args;
    struct futhark_context *ctx = futhark_mc_task_236640->ctx;
    uint64_t futhark_mc_segred_task_236641_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236641_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236640->free_n_203490;
    int64_t stl_res_203664 = futhark_mc_task_236640->free_stl_res_203664;
    int64_t gtid_215787 = futhark_mc_task_236640->free_gtid_215787;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_task_236640->free_mem_220835,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_215789 =
           *futhark_mc_task_236640->retval_defunc_2_reduce_res_215789;
    size_t reduce_stage_1_tid_res_arr_mem_235290_cached_sizze_236642 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_235290 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_235290_cached_sizze_236642 <
        (size_t) ((int64_t) 8 * num_tasks_235289)) {
        reduce_stage_1_tid_res_arr_mem_235290 =
            realloc(reduce_stage_1_tid_res_arr_mem_235290, (int64_t) 8 *
                    num_tasks_235289);
        reduce_stage_1_tid_res_arr_mem_235290_cached_sizze_236642 =
            (int64_t) 8 * num_tasks_235289;
    }
    
    int64_t iter_235292;
    struct futhark_mc_segred_stage_1_parloop_struct_236643
    futhark_mc_segred_stage_1_parloop_struct_236643;
    
    futhark_mc_segred_stage_1_parloop_struct_236643.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236643.free_n_203490 = n_203490;
    futhark_mc_segred_stage_1_parloop_struct_236643.free_stl_res_203664 =
        stl_res_203664;
    futhark_mc_segred_stage_1_parloop_struct_236643.free_gtid_215787 =
        gtid_215787;
    futhark_mc_segred_stage_1_parloop_struct_236643.free_mem_220835 =
        mem_220835.mem;
    futhark_mc_segred_stage_1_parloop_struct_236643.free_reduce_stage_1_tid_res_arr_mem_235290 =
        reduce_stage_1_tid_res_arr_mem_235290;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236644_task;
    
    futhark_mc_segred_stage_1_parloop_236644_task.name =
        "futhark_mc_segred_stage_1_parloop_236644";
    futhark_mc_segred_stage_1_parloop_236644_task.fn =
        futhark_mc_segred_stage_1_parloop_236644;
    futhark_mc_segred_stage_1_parloop_236644_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236643;
    futhark_mc_segred_stage_1_parloop_236644_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236644_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236644_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236644_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236644_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236644_task);
    
    if (futhark_mc_segred_stage_1_parloop_236644_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236644_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236644_total_end -
                 futhark_mc_segred_stage_1_parloop_236644_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236644_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236644_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236644_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_215789 = 0.0;
    }
    
    double x_235294;
    double x_235295;
    
    for (int32_t i_235297 = 0; i_235297 < num_tasks_235289; i_235297++) {
        flat_tid_235280 = i_235297;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_235294 = defunc_2_reduce_res_215789;
            }
            // load next params
            {
                x_235295 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_235290)[flat_tid_235280];
            }
            // red body
            {
                double defunc_1_op_res_235296 = x_235294 + x_235295;
                
                defunc_2_reduce_res_215789 = defunc_1_op_res_235296;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_235290);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236641_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236641_end -
                 futhark_mc_segred_task_236641_start;
        
        ctx->futhark_mc_segred_task_236641_runs[tid]++;
        ctx->futhark_mc_segred_task_236641_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236641_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236640->retval_defunc_2_reduce_res_215789 =
            defunc_2_reduce_res_215789;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236639(void *args, int64_t start,
                                            int64_t end, int flat_tid_215786,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236638
    *futhark_mc_segmap_parloop_struct_236638 =
    (struct futhark_mc_segmap_parloop_struct_236638 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236638->ctx;
    uint64_t futhark_mc_segmap_parloop_236639_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236639_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236638->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236638->free_partition_sizze_203577;
    int64_t stl_res_203664 =
            futhark_mc_segmap_parloop_struct_236638->free_stl_res_203664;
    int64_t j_m_i_204133 =
            futhark_mc_segmap_parloop_struct_236638->free_j_m_i_204133;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_segmap_parloop_struct_236638->free_mem_220835,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_segmap_parloop_struct_236638->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_segmap_parloop_struct_236638->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_segmap_parloop_struct_236638->free_mem_220844,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235279 = start;
    
    for (; iter_235279 < end; iter_235279++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235287 = partition_sizze_203577;
        int64_t gtid_215787 = iter_235279;
        int64_t remnant_235288 = iter_235279 - gtid_215787;
        double defunc_2_reduce_res_215789;
        int64_t flat_tid_235280 = (int64_t) 0;
        int32_t num_tasks_235289;
        
        defunc_2_reduce_res_215789 = 0.0;
        
        struct futhark_mc_task_236640 futhark_mc_task_236640;
        
        futhark_mc_task_236640.ctx = ctx;
        futhark_mc_task_236640.free_n_203490 = n_203490;
        futhark_mc_task_236640.free_stl_res_203664 = stl_res_203664;
        futhark_mc_task_236640.free_gtid_215787 = gtid_215787;
        futhark_mc_task_236640.free_mem_220835 = mem_220835.mem;
        futhark_mc_task_236640.retval_defunc_2_reduce_res_215789 =
            &defunc_2_reduce_res_215789;
        
        struct scheduler_segop futhark_mc_task_236640_task;
        
        futhark_mc_task_236640_task.args = &futhark_mc_task_236640;
        futhark_mc_task_236640_task.top_level_fn =
            futhark_mc_segred_task_236641;
        futhark_mc_task_236640_task.name = "futhark_mc_segred_task_236641";
        futhark_mc_task_236640_task.iterations = j_m_i_204133;
        futhark_mc_task_236640_task.task_time =
            &ctx->futhark_mc_segred_task_236641_total_time;
        futhark_mc_task_236640_task.task_iter =
            &ctx->futhark_mc_segred_task_236641_total_iter;
        futhark_mc_task_236640_task.sched = STATIC;
        futhark_mc_task_236640_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236641_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236640_task);
        
        if (futhark_mc_segred_task_236641_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double h_215796 = 3.0 * defunc_2_reduce_res_215789;
        double h9_215797 = 0.999 * h_215796;
        double h1_215798 = 1.0e-3 * h_215796;
        
        ((double *) mem_220838.mem)[gtid_215787] = h_215796;
        ((double *) mem_220841.mem)[gtid_215787] = h9_215797;
        ((double *) mem_220844.mem)[gtid_215787] = h1_215798;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236639_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236639_end -
                 futhark_mc_segmap_parloop_236639_start;
        
        ctx->futhark_mc_segmap_parloop_236639_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236639_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236639_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236637(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215786 = tid;
    int num_tasks_235269 = info.nsubtasks;
    struct futhark_mc_task_236633 *futhark_mc_task_236633 =
                                  (struct futhark_mc_task_236633 *) args;
    struct futhark_context *ctx = futhark_mc_task_236633->ctx;
    uint64_t futhark_mc_segmap_nested_task_236637_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236637_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236633->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236633->free_partition_sizze_203577;
    int64_t stl_res_203664 = futhark_mc_task_236633->free_stl_res_203664;
    int64_t j_m_i_204133 = futhark_mc_task_236633->free_j_m_i_204133;
    struct memblock mem_220835 = {.desc ="mem_220835", .mem =
                                  futhark_mc_task_236633->free_mem_220835,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_task_236633->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_task_236633->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_task_236633->free_mem_220844,
                                  .size =0, .references =NULL};
    int64_t iter_235279;
    struct futhark_mc_segmap_parloop_struct_236638
    futhark_mc_segmap_parloop_struct_236638;
    
    futhark_mc_segmap_parloop_struct_236638.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236638.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236638.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236638.free_stl_res_203664 =
        stl_res_203664;
    futhark_mc_segmap_parloop_struct_236638.free_j_m_i_204133 = j_m_i_204133;
    futhark_mc_segmap_parloop_struct_236638.free_mem_220835 = mem_220835.mem;
    futhark_mc_segmap_parloop_struct_236638.free_mem_220838 = mem_220838.mem;
    futhark_mc_segmap_parloop_struct_236638.free_mem_220841 = mem_220841.mem;
    futhark_mc_segmap_parloop_struct_236638.free_mem_220844 = mem_220844.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236639_task;
    
    futhark_mc_segmap_parloop_236639_task.name =
        "futhark_mc_segmap_parloop_236639";
    futhark_mc_segmap_parloop_236639_task.fn = futhark_mc_segmap_parloop_236639;
    futhark_mc_segmap_parloop_236639_task.args =
        &futhark_mc_segmap_parloop_struct_236638;
    futhark_mc_segmap_parloop_236639_task.iterations = iterations;
    futhark_mc_segmap_parloop_236639_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236639_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236639_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236639_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236639_task);
    
    if (futhark_mc_segmap_parloop_236639_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236639_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236639_total_end -
                 futhark_mc_segmap_parloop_236639_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236639_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236639_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236639_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236637_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236637_end -
                 futhark_mc_segmap_nested_task_236637_start;
        
        ctx->futhark_mc_segmap_nested_task_236637_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236637_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236637_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236645 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_bytes_217302;
    unsigned char *free_mem_220689;
    unsigned char *free_mem_220838;
    unsigned char *free_mem_220841;
    unsigned char *free_mem_220844;
    unsigned char *free_mem_220866;
};
struct futhark_mc_segmap_parloop_struct_236647 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_bytes_217302;
    unsigned char *free_mem_220689;
    unsigned char *free_mem_220838;
    unsigned char *free_mem_220841;
    unsigned char *free_mem_220844;
    unsigned char *free_mem_220866;
};
static int futhark_mc_segmap_parloop_236648(void *args, int64_t start,
                                            int64_t end, int flat_tid_215799,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236647
    *futhark_mc_segmap_parloop_struct_236647 =
    (struct futhark_mc_segmap_parloop_struct_236647 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236647->ctx;
    uint64_t futhark_mc_segmap_parloop_236648_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236648_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236647->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236647->free_partition_sizze_203577;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236647->free_bytes_217302;
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_segmap_parloop_struct_236647->free_mem_220689,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_segmap_parloop_struct_236647->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_segmap_parloop_struct_236647->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_segmap_parloop_struct_236647->free_mem_220844,
                                  .size =0, .references =NULL};
    struct memblock mem_220866 = {.desc ="mem_220866", .mem =
                                  futhark_mc_segmap_parloop_struct_236647->free_mem_220866,
                                  .size =0, .references =NULL};
    size_t mem_220850_cached_sizze_236649 = 0;
    unsigned char *mem_220850 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235299 = start;
    
    if (mem_220850_cached_sizze_236649 < (size_t) bytes_217302) {
        mem_220850 = realloc(mem_220850, bytes_217302);
        mem_220850_cached_sizze_236649 = bytes_217302;
    }
    for (; iter_235299 < end; iter_235299++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235320 = partition_sizze_203577;
        int64_t gtid_215800 = iter_235299;
        int64_t remnant_235321 = iter_235299 - gtid_215800;
        double x_206822;
        
        x_206822 = ((double *) mem_220838.mem)[gtid_215800];
        
        double x_206823;
        
        x_206823 = ((double *) mem_220841.mem)[gtid_215800];
        
        double x_206824;
        
        x_206824 = ((double *) mem_220844.mem)[gtid_215800];
        for (int64_t i_235300 = 0; i_235300 < n_203490; i_235300++) {
            double x_235302;
            
            x_235302 = ((double *) mem_220689.mem)[gtid_215800 * n_203490 +
                                                   i_235300];
            
            double x_235303 = x_235302 / x_206822;
            double y_235304 = fpow64(x_235303, 2.0);
            double x_235305 = 1.0 - y_235304;
            double bicube_235306 = fpow64(x_235305, 2.0);
            bool isnan_res_235307;
            
            isnan_res_235307 = futrts_isnan64(x_235302);
            
            bool cond_f_res_235308 = x_235302 <= x_206824;
            bool x_235309 = !isnan_res_235307;
            bool y_235310 = cond_f_res_235308 && x_235309;
            bool cond_235311 = isnan_res_235307 || y_235310;
            double defunc_0_f_res_235312;
            
            if (cond_235311) {
                defunc_0_f_res_235312 = 1.0;
            } else {
                bool cond_235313 = x_206823 <= x_235302;
                bool cond_f_res_235314 = x_235302 <= 1.0e-6;
                bool x_235315 = !cond_235313;
                bool y_235316 = cond_f_res_235314 && x_235315;
                bool cond_235317 = cond_235313 || y_235316;
                double defunc_0_f_res_f_res_235318;
                
                if (cond_235317) {
                    defunc_0_f_res_f_res_235318 = 1.0e-6;
                } else {
                    defunc_0_f_res_f_res_235318 = bicube_235306;
                }
                defunc_0_f_res_235312 = defunc_0_f_res_f_res_235318;
            }
            ((double *) mem_220850)[i_235300] = defunc_0_f_res_235312;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220866.mem + gtid_215800 * n_203490 * (int64_t) 8,
                    mem_220850 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220850);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236648_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236648_end -
                 futhark_mc_segmap_parloop_236648_start;
        
        ctx->futhark_mc_segmap_parloop_236648_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236648_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236648_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236646(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215799 = tid;
    int num_tasks_235298 = info.nsubtasks;
    struct futhark_mc_task_236645 *futhark_mc_task_236645 =
                                  (struct futhark_mc_task_236645 *) args;
    struct futhark_context *ctx = futhark_mc_task_236645->ctx;
    uint64_t futhark_mc_segmap_task_236646_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236646_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236645->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236645->free_partition_sizze_203577;
    int64_t bytes_217302 = futhark_mc_task_236645->free_bytes_217302;
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_task_236645->free_mem_220689,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_task_236645->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_task_236645->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_task_236645->free_mem_220844,
                                  .size =0, .references =NULL};
    struct memblock mem_220866 = {.desc ="mem_220866", .mem =
                                  futhark_mc_task_236645->free_mem_220866,
                                  .size =0, .references =NULL};
    int64_t iter_235299;
    struct futhark_mc_segmap_parloop_struct_236647
    futhark_mc_segmap_parloop_struct_236647;
    
    futhark_mc_segmap_parloop_struct_236647.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236647.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236647.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236647.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236647.free_mem_220689 = mem_220689.mem;
    futhark_mc_segmap_parloop_struct_236647.free_mem_220838 = mem_220838.mem;
    futhark_mc_segmap_parloop_struct_236647.free_mem_220841 = mem_220841.mem;
    futhark_mc_segmap_parloop_struct_236647.free_mem_220844 = mem_220844.mem;
    futhark_mc_segmap_parloop_struct_236647.free_mem_220866 = mem_220866.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236648_task;
    
    futhark_mc_segmap_parloop_236648_task.name =
        "futhark_mc_segmap_parloop_236648";
    futhark_mc_segmap_parloop_236648_task.fn = futhark_mc_segmap_parloop_236648;
    futhark_mc_segmap_parloop_236648_task.args =
        &futhark_mc_segmap_parloop_struct_236647;
    futhark_mc_segmap_parloop_236648_task.iterations = iterations;
    futhark_mc_segmap_parloop_236648_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236648_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236648_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236648_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236648_task);
    
    if (futhark_mc_segmap_parloop_236648_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236648_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236648_total_end -
                 futhark_mc_segmap_parloop_236648_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236648_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236648_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236648_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236646_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236646_end -
                 futhark_mc_segmap_task_236646_start;
        
        ctx->futhark_mc_segmap_task_236646_runs[tid]++;
        ctx->futhark_mc_segmap_task_236646_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236646_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236651 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    int64_t free_bytes_217302;
    unsigned char *free_mem_220689;
    unsigned char *free_mem_220838;
    unsigned char *free_mem_220841;
    unsigned char *free_mem_220844;
    unsigned char *free_mem_220866;
};
struct futhark_mc_task_236654 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215806;
    double free_x_215808;
    double free_x_215809;
    double free_x_215810;
    unsigned char *free_mem_220689;
    unsigned char *free_mem_220847;
};
struct futhark_mc_segmap_parloop_struct_236656 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215806;
    double free_x_215808;
    double free_x_215809;
    double free_x_215810;
    unsigned char *free_mem_220689;
    unsigned char *free_mem_220847;
};
static int futhark_mc_segmap_parloop_236657(void *args, int64_t start,
                                            int64_t end, int flat_tid_235324,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236656
    *futhark_mc_segmap_parloop_struct_236656 =
    (struct futhark_mc_segmap_parloop_struct_236656 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236656->ctx;
    uint64_t futhark_mc_segmap_parloop_236657_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236657_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236656->free_n_203490;
    int64_t gtid_215806 =
            futhark_mc_segmap_parloop_struct_236656->free_gtid_215806;
    double x_215808 = futhark_mc_segmap_parloop_struct_236656->free_x_215808;
    double x_215809 = futhark_mc_segmap_parloop_struct_236656->free_x_215809;
    double x_215810 = futhark_mc_segmap_parloop_struct_236656->free_x_215810;
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_segmap_parloop_struct_236656->free_mem_220689,
                                  .size =0, .references =NULL};
    struct memblock mem_220847 = {.desc ="mem_220847", .mem =
                                  futhark_mc_segmap_parloop_struct_236656->free_mem_220847,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235346 = start;
    
    for (; iter_235346 < end; iter_235346++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235353 = n_203490;
        int64_t gtid_235325 = iter_235346;
        int64_t remnant_235354 = iter_235346 - gtid_235325;
        double x_235326;
        
        x_235326 = ((double *) mem_220689.mem)[gtid_215806 * n_203490 +
                                               gtid_235325];
        
        double x_235327 = x_235326 / x_215808;
        double y_235328 = fpow64(x_235327, 2.0);
        double x_235329 = 1.0 - y_235328;
        double bicube_235330 = fpow64(x_235329, 2.0);
        bool isnan_res_235331;
        
        isnan_res_235331 = futrts_isnan64(x_235326);
        
        bool cond_f_res_235332 = x_235326 <= x_215810;
        bool x_235333 = !isnan_res_235331;
        bool y_235334 = cond_f_res_235332 && x_235333;
        bool cond_235335 = isnan_res_235331 || y_235334;
        double defunc_0_f_res_235336;
        
        if (cond_235335) {
            defunc_0_f_res_235336 = 1.0;
        } else {
            bool cond_235347 = x_215809 <= x_235326;
            bool cond_f_res_235348 = x_235326 <= 1.0e-6;
            bool x_235349 = !cond_235347;
            bool y_235350 = cond_f_res_235348 && x_235349;
            bool cond_235351 = cond_235347 || y_235350;
            double defunc_0_f_res_f_res_235352;
            
            if (cond_235351) {
                defunc_0_f_res_f_res_235352 = 1.0e-6;
            } else {
                defunc_0_f_res_f_res_235352 = bicube_235330;
            }
            defunc_0_f_res_235336 = defunc_0_f_res_f_res_235352;
        }
        ((double *) mem_220847.mem)[gtid_235325] = defunc_0_f_res_235336;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236657_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236657_end -
                 futhark_mc_segmap_parloop_236657_start;
        
        ctx->futhark_mc_segmap_parloop_236657_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236657_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236657_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236655(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235324 = tid;
    int num_tasks_235345 = info.nsubtasks;
    struct futhark_mc_task_236654 *futhark_mc_task_236654 =
                                  (struct futhark_mc_task_236654 *) args;
    struct futhark_context *ctx = futhark_mc_task_236654->ctx;
    uint64_t futhark_mc_segmap_task_236655_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236655_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236654->free_n_203490;
    int64_t gtid_215806 = futhark_mc_task_236654->free_gtid_215806;
    double x_215808 = futhark_mc_task_236654->free_x_215808;
    double x_215809 = futhark_mc_task_236654->free_x_215809;
    double x_215810 = futhark_mc_task_236654->free_x_215810;
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_task_236654->free_mem_220689,
                                  .size =0, .references =NULL};
    struct memblock mem_220847 = {.desc ="mem_220847", .mem =
                                  futhark_mc_task_236654->free_mem_220847,
                                  .size =0, .references =NULL};
    int64_t iter_235346;
    struct futhark_mc_segmap_parloop_struct_236656
    futhark_mc_segmap_parloop_struct_236656;
    
    futhark_mc_segmap_parloop_struct_236656.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236656.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236656.free_gtid_215806 = gtid_215806;
    futhark_mc_segmap_parloop_struct_236656.free_x_215808 = x_215808;
    futhark_mc_segmap_parloop_struct_236656.free_x_215809 = x_215809;
    futhark_mc_segmap_parloop_struct_236656.free_x_215810 = x_215810;
    futhark_mc_segmap_parloop_struct_236656.free_mem_220689 = mem_220689.mem;
    futhark_mc_segmap_parloop_struct_236656.free_mem_220847 = mem_220847.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236657_task;
    
    futhark_mc_segmap_parloop_236657_task.name =
        "futhark_mc_segmap_parloop_236657";
    futhark_mc_segmap_parloop_236657_task.fn = futhark_mc_segmap_parloop_236657;
    futhark_mc_segmap_parloop_236657_task.args =
        &futhark_mc_segmap_parloop_struct_236656;
    futhark_mc_segmap_parloop_236657_task.iterations = iterations;
    futhark_mc_segmap_parloop_236657_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236657_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236657_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236657_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236657_task);
    
    if (futhark_mc_segmap_parloop_236657_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236657_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236657_total_end -
                 futhark_mc_segmap_parloop_236657_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236657_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236657_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236657_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236655_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236655_end -
                 futhark_mc_segmap_task_236655_start;
        
        ctx->futhark_mc_segmap_task_236655_runs[tid]++;
        ctx->futhark_mc_segmap_task_236655_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236655_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236652(void *args, int64_t start,
                                            int64_t end, int flat_tid_215805,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236651
    *futhark_mc_segmap_parloop_struct_236651 =
    (struct futhark_mc_segmap_parloop_struct_236651 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236651->ctx;
    uint64_t futhark_mc_segmap_parloop_236652_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236652_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236651->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236651->free_partition_sizze_203577;
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236651->free_bytes_217302;
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_segmap_parloop_struct_236651->free_mem_220689,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_segmap_parloop_struct_236651->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_segmap_parloop_struct_236651->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_segmap_parloop_struct_236651->free_mem_220844,
                                  .size =0, .references =NULL};
    struct memblock mem_220866 = {.desc ="mem_220866", .mem =
                                  futhark_mc_segmap_parloop_struct_236651->free_mem_220866,
                                  .size =0, .references =NULL};
    size_t mem_220847_cached_sizze_236653 = 0;
    unsigned char *mem_220847 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235323 = start;
    
    if (mem_220847_cached_sizze_236653 < (size_t) bytes_217302) {
        mem_220847 = realloc(mem_220847, bytes_217302);
        mem_220847_cached_sizze_236653 = bytes_217302;
    }
    for (; iter_235323 < end; iter_235323++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235343 = partition_sizze_203577;
        int64_t gtid_215806 = iter_235323;
        int64_t remnant_235344 = iter_235323 - gtid_215806;
        double x_215808;
        
        x_215808 = ((double *) mem_220838.mem)[gtid_215806];
        
        double x_215809;
        
        x_215809 = ((double *) mem_220841.mem)[gtid_215806];
        
        double x_215810;
        
        x_215810 = ((double *) mem_220844.mem)[gtid_215806];
        
        int64_t flat_tid_235324 = (int64_t) 0;
        int32_t num_tasks_235345;
        struct futhark_mc_task_236654 futhark_mc_task_236654;
        
        futhark_mc_task_236654.ctx = ctx;
        futhark_mc_task_236654.free_n_203490 = n_203490;
        futhark_mc_task_236654.free_gtid_215806 = gtid_215806;
        futhark_mc_task_236654.free_x_215808 = x_215808;
        futhark_mc_task_236654.free_x_215809 = x_215809;
        futhark_mc_task_236654.free_x_215810 = x_215810;
        futhark_mc_task_236654.free_mem_220689 = mem_220689.mem;
        futhark_mc_task_236654.free_mem_220847 = mem_220847;
        
        struct scheduler_segop futhark_mc_task_236654_task;
        
        futhark_mc_task_236654_task.args = &futhark_mc_task_236654;
        futhark_mc_task_236654_task.top_level_fn =
            futhark_mc_segmap_task_236655;
        futhark_mc_task_236654_task.name = "futhark_mc_segmap_task_236655";
        futhark_mc_task_236654_task.iterations = n_203490;
        futhark_mc_task_236654_task.task_time =
            &ctx->futhark_mc_segmap_task_236655_total_time;
        futhark_mc_task_236654_task.task_iter =
            &ctx->futhark_mc_segmap_task_236655_total_iter;
        futhark_mc_task_236654_task.sched = STATIC;
        futhark_mc_task_236654_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236655_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236654_task);
        
        if (futhark_mc_segmap_task_236655_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203490 * (int64_t) 8 > 0)
            memmove(mem_220866.mem + gtid_215806 * n_203490 * (int64_t) 8,
                    mem_220847 + (int64_t) 0, n_203490 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220847);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236652_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236652_end -
                 futhark_mc_segmap_parloop_236652_start;
        
        ctx->futhark_mc_segmap_parloop_236652_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236652_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236652_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236650(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215805 = tid;
    int num_tasks_235298 = info.nsubtasks;
    struct futhark_mc_task_236645 *futhark_mc_task_236645 =
                                  (struct futhark_mc_task_236645 *) args;
    struct futhark_context *ctx = futhark_mc_task_236645->ctx;
    uint64_t futhark_mc_segmap_nested_task_236650_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236650_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236645->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236645->free_partition_sizze_203577;
    int64_t bytes_217302 = futhark_mc_task_236645->free_bytes_217302;
    struct memblock mem_220689 = {.desc ="mem_220689", .mem =
                                  futhark_mc_task_236645->free_mem_220689,
                                  .size =0, .references =NULL};
    struct memblock mem_220838 = {.desc ="mem_220838", .mem =
                                  futhark_mc_task_236645->free_mem_220838,
                                  .size =0, .references =NULL};
    struct memblock mem_220841 = {.desc ="mem_220841", .mem =
                                  futhark_mc_task_236645->free_mem_220841,
                                  .size =0, .references =NULL};
    struct memblock mem_220844 = {.desc ="mem_220844", .mem =
                                  futhark_mc_task_236645->free_mem_220844,
                                  .size =0, .references =NULL};
    struct memblock mem_220866 = {.desc ="mem_220866", .mem =
                                  futhark_mc_task_236645->free_mem_220866,
                                  .size =0, .references =NULL};
    int64_t iter_235323;
    struct futhark_mc_segmap_parloop_struct_236651
    futhark_mc_segmap_parloop_struct_236651;
    
    futhark_mc_segmap_parloop_struct_236651.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236651.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236651.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236651.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236651.free_mem_220689 = mem_220689.mem;
    futhark_mc_segmap_parloop_struct_236651.free_mem_220838 = mem_220838.mem;
    futhark_mc_segmap_parloop_struct_236651.free_mem_220841 = mem_220841.mem;
    futhark_mc_segmap_parloop_struct_236651.free_mem_220844 = mem_220844.mem;
    futhark_mc_segmap_parloop_struct_236651.free_mem_220866 = mem_220866.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236652_task;
    
    futhark_mc_segmap_parloop_236652_task.name =
        "futhark_mc_segmap_parloop_236652";
    futhark_mc_segmap_parloop_236652_task.fn = futhark_mc_segmap_parloop_236652;
    futhark_mc_segmap_parloop_236652_task.args =
        &futhark_mc_segmap_parloop_struct_236651;
    futhark_mc_segmap_parloop_236652_task.iterations = iterations;
    futhark_mc_segmap_parloop_236652_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236652_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236652_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236652_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236652_task);
    
    if (futhark_mc_segmap_parloop_236652_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236652_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236652_total_end -
                 futhark_mc_segmap_parloop_236652_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236652_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236652_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236652_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236650_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236650_end -
                 futhark_mc_segmap_nested_task_236650_start;
        
        ctx->futhark_mc_segmap_nested_task_236650_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236650_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236650_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236658 {
    struct futhark_context *ctx;
    int64_t free_m_203489;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217300;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_220876;
    unsigned char *free_ext_mem_220877;
    int64_t free_ext_220888;
    unsigned char *free_mem_220902;
    unsigned char *free_mem_220906;
    unsigned char *free_mem_220910;
};
struct futhark_mc_segmap_parloop_struct_236660 {
    struct futhark_context *ctx;
    int64_t free_m_203489;
    int64_t free_n_203490;
    int64_t free_partition_sizze_203577;
    unsigned char *free_mem_217297;
    unsigned char *free_mem_217300;
    int64_t free_bytes_217302;
    unsigned char *free_ext_mem_220876;
    unsigned char *free_ext_mem_220877;
    int64_t free_ext_220888;
    unsigned char *free_mem_220902;
    unsigned char *free_mem_220906;
    unsigned char *free_mem_220910;
};
struct futhark_mc_task_236663 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215832;
    unsigned char *free_mem_217297;
    unsigned char *free_ext_mem_220876;
    unsigned char *free_ext_mem_220877;
    int64_t free_ext_220888;
    unsigned char *free_mem_220913;
};
struct futhark_mc_segmap_parloop_struct_236665 {
    struct futhark_context *ctx;
    int64_t free_n_203490;
    int64_t free_gtid_215832;
    unsigned char *free_mem_217297;
    unsigned char *free_ext_mem_220876;
    unsigned char *free_ext_mem_220877;
    int64_t free_ext_220888;
    unsigned char *free_mem_220913;
};
static int futhark_mc_segmap_parloop_236666(void *args, int64_t start,
                                            int64_t end, int flat_tid_235363,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236665
    *futhark_mc_segmap_parloop_struct_236665 =
    (struct futhark_mc_segmap_parloop_struct_236665 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236665->ctx;
    uint64_t futhark_mc_segmap_parloop_236666_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236666_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236665->free_n_203490;
    int64_t gtid_215832 =
            futhark_mc_segmap_parloop_struct_236665->free_gtid_215832;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236665->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220876 = {.desc ="ext_mem_220876", .mem =
                                      futhark_mc_segmap_parloop_struct_236665->free_ext_mem_220876,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220877 = {.desc ="ext_mem_220877", .mem =
                                      futhark_mc_segmap_parloop_struct_236665->free_ext_mem_220877,
                                      .size =0, .references =NULL};
    int64_t ext_220888 =
            futhark_mc_segmap_parloop_struct_236665->free_ext_220888;
    struct memblock mem_220913 = {.desc ="mem_220913", .mem =
                                  futhark_mc_segmap_parloop_struct_236665->free_mem_220913,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235373 = start;
    
    for (; iter_235373 < end; iter_235373++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235374 = n_203490;
        int64_t gtid_235364 = iter_235373;
        int64_t remnant_235375 = iter_235373 - gtid_235364;
        double x_235365;
        
        x_235365 = ((double *) mem_217297.mem)[gtid_215832 * n_203490 +
                                               gtid_235364];
        
        double x_235366;
        
        x_235366 = ((double *) ext_mem_220877.mem)[gtid_215832 * n_203490 +
                                                   gtid_235364];
        
        double x_235367;
        
        x_235367 = ((double *) ext_mem_220876.mem)[gtid_215832 * ext_220888 +
                                                   gtid_235364];
        
        double x_235368 = x_235365 - x_235366;
        double defunc_2_f_res_235369 = x_235368 - x_235367;
        
        ((double *) mem_220913.mem)[gtid_235364] = defunc_2_f_res_235369;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236666_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236666_end -
                 futhark_mc_segmap_parloop_236666_start;
        
        ctx->futhark_mc_segmap_parloop_236666_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236666_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236666_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236664(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235363 = tid;
    int num_tasks_235372 = info.nsubtasks;
    struct futhark_mc_task_236663 *futhark_mc_task_236663 =
                                  (struct futhark_mc_task_236663 *) args;
    struct futhark_context *ctx = futhark_mc_task_236663->ctx;
    uint64_t futhark_mc_segmap_task_236664_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236664_start = get_wall_time();
    
    int64_t n_203490 = futhark_mc_task_236663->free_n_203490;
    int64_t gtid_215832 = futhark_mc_task_236663->free_gtid_215832;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236663->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220876 = {.desc ="ext_mem_220876", .mem =
                                      futhark_mc_task_236663->free_ext_mem_220876,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220877 = {.desc ="ext_mem_220877", .mem =
                                      futhark_mc_task_236663->free_ext_mem_220877,
                                      .size =0, .references =NULL};
    int64_t ext_220888 = futhark_mc_task_236663->free_ext_220888;
    struct memblock mem_220913 = {.desc ="mem_220913", .mem =
                                  futhark_mc_task_236663->free_mem_220913,
                                  .size =0, .references =NULL};
    int64_t iter_235373;
    struct futhark_mc_segmap_parloop_struct_236665
    futhark_mc_segmap_parloop_struct_236665;
    
    futhark_mc_segmap_parloop_struct_236665.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236665.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236665.free_gtid_215832 = gtid_215832;
    futhark_mc_segmap_parloop_struct_236665.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236665.free_ext_mem_220876 =
        ext_mem_220876.mem;
    futhark_mc_segmap_parloop_struct_236665.free_ext_mem_220877 =
        ext_mem_220877.mem;
    futhark_mc_segmap_parloop_struct_236665.free_ext_220888 = ext_220888;
    futhark_mc_segmap_parloop_struct_236665.free_mem_220913 = mem_220913.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236666_task;
    
    futhark_mc_segmap_parloop_236666_task.name =
        "futhark_mc_segmap_parloop_236666";
    futhark_mc_segmap_parloop_236666_task.fn = futhark_mc_segmap_parloop_236666;
    futhark_mc_segmap_parloop_236666_task.args =
        &futhark_mc_segmap_parloop_struct_236665;
    futhark_mc_segmap_parloop_236666_task.iterations = iterations;
    futhark_mc_segmap_parloop_236666_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236666_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236666_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236666_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236666_task);
    
    if (futhark_mc_segmap_parloop_236666_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236666_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236666_total_end -
                 futhark_mc_segmap_parloop_236666_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236666_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236666_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236666_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236664_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236664_end -
                 futhark_mc_segmap_task_236664_start;
        
        ctx->futhark_mc_segmap_task_236664_runs[tid]++;
        ctx->futhark_mc_segmap_task_236664_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236664_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236661(void *args, int64_t start,
                                            int64_t end, int flat_tid_215831,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236660
    *futhark_mc_segmap_parloop_struct_236660 =
    (struct futhark_mc_segmap_parloop_struct_236660 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236660->ctx;
    uint64_t futhark_mc_segmap_parloop_236661_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236661_start = get_wall_time();
    
    int64_t m_203489 = futhark_mc_segmap_parloop_struct_236660->free_m_203489;
    int64_t n_203490 = futhark_mc_segmap_parloop_struct_236660->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_segmap_parloop_struct_236660->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_segmap_parloop_struct_236660->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217300 = {.desc ="mem_217300", .mem =
                                  futhark_mc_segmap_parloop_struct_236660->free_mem_217300,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 =
            futhark_mc_segmap_parloop_struct_236660->free_bytes_217302;
    struct memblock ext_mem_220876 = {.desc ="ext_mem_220876", .mem =
                                      futhark_mc_segmap_parloop_struct_236660->free_ext_mem_220876,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220877 = {.desc ="ext_mem_220877", .mem =
                                      futhark_mc_segmap_parloop_struct_236660->free_ext_mem_220877,
                                      .size =0, .references =NULL};
    int64_t ext_220888 =
            futhark_mc_segmap_parloop_struct_236660->free_ext_220888;
    struct memblock mem_220902 = {.desc ="mem_220902", .mem =
                                  futhark_mc_segmap_parloop_struct_236660->free_mem_220902,
                                  .size =0, .references =NULL};
    struct memblock mem_220906 = {.desc ="mem_220906", .mem =
                                  futhark_mc_segmap_parloop_struct_236660->free_mem_220906,
                                  .size =0, .references =NULL};
    struct memblock mem_220910 = {.desc ="mem_220910", .mem =
                                  futhark_mc_segmap_parloop_struct_236660->free_mem_220910,
                                  .size =0, .references =NULL};
    size_t mem_220913_cached_sizze_236662 = 0;
    unsigned char *mem_220913 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235362 = start;
    
    if (mem_220913_cached_sizze_236662 < (size_t) bytes_217302) {
        mem_220913 = realloc(mem_220913, bytes_217302);
        mem_220913_cached_sizze_236662 = bytes_217302;
    }
    for (; iter_235362 < end; iter_235362++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235370 = partition_sizze_203577;
        int64_t gtid_215832 = iter_235362;
        int64_t remnant_235371 = iter_235362 - gtid_215832;
        int64_t write_index_206853;
        
        write_index_206853 = ((int64_t *) mem_217300.mem)[gtid_215832];
        
        int64_t flat_tid_235363 = (int64_t) 0;
        int32_t num_tasks_235372;
        struct futhark_mc_task_236663 futhark_mc_task_236663;
        
        futhark_mc_task_236663.ctx = ctx;
        futhark_mc_task_236663.free_n_203490 = n_203490;
        futhark_mc_task_236663.free_gtid_215832 = gtid_215832;
        futhark_mc_task_236663.free_mem_217297 = mem_217297.mem;
        futhark_mc_task_236663.free_ext_mem_220876 = ext_mem_220876.mem;
        futhark_mc_task_236663.free_ext_mem_220877 = ext_mem_220877.mem;
        futhark_mc_task_236663.free_ext_220888 = ext_220888;
        futhark_mc_task_236663.free_mem_220913 = mem_220913;
        
        struct scheduler_segop futhark_mc_task_236663_task;
        
        futhark_mc_task_236663_task.args = &futhark_mc_task_236663;
        futhark_mc_task_236663_task.top_level_fn =
            futhark_mc_segmap_task_236664;
        futhark_mc_task_236663_task.name = "futhark_mc_segmap_task_236664";
        futhark_mc_task_236663_task.iterations = n_203490;
        futhark_mc_task_236663_task.task_time =
            &ctx->futhark_mc_segmap_task_236664_total_time;
        futhark_mc_task_236663_task.task_iter =
            &ctx->futhark_mc_segmap_task_236664_total_iter;
        futhark_mc_task_236663_task.sched = STATIC;
        futhark_mc_task_236663_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236664_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236663_task);
        
        if (futhark_mc_segmap_task_236664_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (sle64((int64_t) 0, write_index_206853) && slt64(write_index_206853,
                                                            m_203489)) {
            if (n_203490 * (int64_t) 8 > 0)
                memmove(mem_220910.mem + write_index_206853 * n_203490 *
                        (int64_t) 8, mem_220913 + (int64_t) 0, n_203490 *
                        (int64_t) 8);
        }
        if (sle64((int64_t) 0, write_index_206853) && slt64(write_index_206853,
                                                            m_203489)) {
            if (n_203490 * (int64_t) 8 > 0)
                memmove(mem_220906.mem + write_index_206853 * n_203490 *
                        (int64_t) 8, ext_mem_220876.mem + gtid_215832 *
                        ext_220888 * (int64_t) 8, n_203490 * (int64_t) 8);
        }
        if (sle64((int64_t) 0, write_index_206853) && slt64(write_index_206853,
                                                            m_203489)) {
            if (n_203490 * (int64_t) 8 > 0)
                memmove(mem_220902.mem + write_index_206853 * n_203490 *
                        (int64_t) 8, ext_mem_220877.mem + gtid_215832 *
                        n_203490 * (int64_t) 8, n_203490 * (int64_t) 8);
        }
    }
    
  cleanup:
    { }
    free(mem_220913);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236661_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236661_end -
                 futhark_mc_segmap_parloop_236661_start;
        
        ctx->futhark_mc_segmap_parloop_236661_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236661_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236661_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236659(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215831 = tid;
    int num_tasks_235361 = info.nsubtasks;
    struct futhark_mc_task_236658 *futhark_mc_task_236658 =
                                  (struct futhark_mc_task_236658 *) args;
    struct futhark_context *ctx = futhark_mc_task_236658->ctx;
    uint64_t futhark_mc_segmap_task_236659_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236659_start = get_wall_time();
    
    int64_t m_203489 = futhark_mc_task_236658->free_m_203489;
    int64_t n_203490 = futhark_mc_task_236658->free_n_203490;
    int64_t partition_sizze_203577 =
            futhark_mc_task_236658->free_partition_sizze_203577;
    struct memblock mem_217297 = {.desc ="mem_217297", .mem =
                                  futhark_mc_task_236658->free_mem_217297,
                                  .size =0, .references =NULL};
    struct memblock mem_217300 = {.desc ="mem_217300", .mem =
                                  futhark_mc_task_236658->free_mem_217300,
                                  .size =0, .references =NULL};
    int64_t bytes_217302 = futhark_mc_task_236658->free_bytes_217302;
    struct memblock ext_mem_220876 = {.desc ="ext_mem_220876", .mem =
                                      futhark_mc_task_236658->free_ext_mem_220876,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220877 = {.desc ="ext_mem_220877", .mem =
                                      futhark_mc_task_236658->free_ext_mem_220877,
                                      .size =0, .references =NULL};
    int64_t ext_220888 = futhark_mc_task_236658->free_ext_220888;
    struct memblock mem_220902 = {.desc ="mem_220902", .mem =
                                  futhark_mc_task_236658->free_mem_220902,
                                  .size =0, .references =NULL};
    struct memblock mem_220906 = {.desc ="mem_220906", .mem =
                                  futhark_mc_task_236658->free_mem_220906,
                                  .size =0, .references =NULL};
    struct memblock mem_220910 = {.desc ="mem_220910", .mem =
                                  futhark_mc_task_236658->free_mem_220910,
                                  .size =0, .references =NULL};
    int64_t iter_235362;
    struct futhark_mc_segmap_parloop_struct_236660
    futhark_mc_segmap_parloop_struct_236660;
    
    futhark_mc_segmap_parloop_struct_236660.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236660.free_m_203489 = m_203489;
    futhark_mc_segmap_parloop_struct_236660.free_n_203490 = n_203490;
    futhark_mc_segmap_parloop_struct_236660.free_partition_sizze_203577 =
        partition_sizze_203577;
    futhark_mc_segmap_parloop_struct_236660.free_mem_217297 = mem_217297.mem;
    futhark_mc_segmap_parloop_struct_236660.free_mem_217300 = mem_217300.mem;
    futhark_mc_segmap_parloop_struct_236660.free_bytes_217302 = bytes_217302;
    futhark_mc_segmap_parloop_struct_236660.free_ext_mem_220876 =
        ext_mem_220876.mem;
    futhark_mc_segmap_parloop_struct_236660.free_ext_mem_220877 =
        ext_mem_220877.mem;
    futhark_mc_segmap_parloop_struct_236660.free_ext_220888 = ext_220888;
    futhark_mc_segmap_parloop_struct_236660.free_mem_220902 = mem_220902.mem;
    futhark_mc_segmap_parloop_struct_236660.free_mem_220906 = mem_220906.mem;
    futhark_mc_segmap_parloop_struct_236660.free_mem_220910 = mem_220910.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236661_task;
    
    futhark_mc_segmap_parloop_236661_task.name =
        "futhark_mc_segmap_parloop_236661";
    futhark_mc_segmap_parloop_236661_task.fn = futhark_mc_segmap_parloop_236661;
    futhark_mc_segmap_parloop_236661_task.args =
        &futhark_mc_segmap_parloop_struct_236660;
    futhark_mc_segmap_parloop_236661_task.iterations = iterations;
    futhark_mc_segmap_parloop_236661_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236661_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236661_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236661_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236661_task);
    
    if (futhark_mc_segmap_parloop_236661_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236661_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236661_total_end -
                 futhark_mc_segmap_parloop_236661_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236661_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236661_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236661_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236659_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236659_end -
                 futhark_mc_segmap_task_236659_start;
        
        ctx->futhark_mc_segmap_task_236659_runs[tid]++;
        ctx->futhark_mc_segmap_task_236659_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236659_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_f64_2d {
    struct memblock mem;
    int64_t shape[2];
};
struct futhark_f64_2d *futhark_new_f64_2d(struct futhark_context *ctx, const
                                          double *data, int64_t dim0,
                                          int64_t dim1)
{
    struct futhark_f64_2d *bad = NULL;
    struct futhark_f64_2d *arr =
                          (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    arr->mem.references = NULL;
    if (memblock_alloc(ctx, &arr->mem, dim0 * dim1 * 8, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    if ((size_t) (dim0 * dim1) * 8 > 0)
        memmove(arr->mem.mem + 0, data + 0, (size_t) (dim0 * dim1) * 8);
    lock_unlock(&ctx->lock);
    return arr;
}
struct futhark_f64_2d *futhark_new_raw_f64_2d(struct futhark_context *ctx, const
                                              unsigned char *data,
                                              int64_t offset, int64_t dim0,
                                              int64_t dim1)
{
    struct futhark_f64_2d *bad = NULL;
    struct futhark_f64_2d *arr =
                          (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    arr->mem.references = NULL;
    if (memblock_alloc(ctx, &arr->mem, dim0 * dim1 * 8, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    if ((size_t) (dim0 * dim1) * 8 > 0)
        memmove(arr->mem.mem + 0, data + offset, (size_t) (dim0 * dim1) * 8);
    lock_unlock(&ctx->lock);
    return arr;
}
int futhark_free_f64_2d(struct futhark_context *ctx, struct futhark_f64_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_f64_2d(struct futhark_context *ctx,
                          struct futhark_f64_2d *arr, double *data)
{
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    if ((size_t) (arr->shape[0] * arr->shape[1]) * 8 > 0)
        memmove(data + 0, arr->mem.mem + 0, (size_t) (arr->shape[0] *
                                                      arr->shape[1]) * 8);
    lock_unlock(&ctx->lock);
    return 0;
}
unsigned char *futhark_values_raw_f64_2d(struct futhark_context *ctx,
                                         struct futhark_f64_2d *arr)
{
    (void) ctx;
    return arr->mem.mem;
}
const int64_t *futhark_shape_f64_2d(struct futhark_context *ctx,
                                    struct futhark_f64_2d *arr)
{
    (void) ctx;
    return arr->shape;
}

static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock *mem_out_p_235376,
                             struct memblock *mem_out_p_235377,
                             struct memblock *mem_out_p_235378,
                             struct memblock Y_mem_217285, int64_t m_203489,
                             int64_t n_203490, int64_t n_p_203492,
                             int64_t q_s_203493, int64_t q_t_203494,
                             int64_t q_l_203495, int64_t d_s_203496,
                             int64_t d_t_203497, int64_t d_l_203498,
                             int64_t jump_s_203499, int64_t jump_t_203500,
                             int64_t jump_l_203501, int64_t n_inner_203502,
                             int64_t n_outer_203503,
                             int64_t jump_threshold_203504,
                             int64_t q_threshold_203505)
{
    (void) ctx;
    
    int err = 0;
    size_t mem_217288_cached_sizze_235379 = 0;
    unsigned char *mem_217288 = NULL;
    size_t mem_217291_cached_sizze_235380 = 0;
    unsigned char *mem_217291 = NULL;
    size_t mem_217293_cached_sizze_235381 = 0;
    unsigned char *mem_217293 = NULL;
    size_t mem_217297_cached_sizze_235382 = 0;
    unsigned char *mem_217297 = NULL;
    size_t mem_217300_cached_sizze_235383 = 0;
    unsigned char *mem_217300 = NULL;
    size_t mem_217340_cached_sizze_235384 = 0;
    unsigned char *mem_217340 = NULL;
    size_t mem_217343_cached_sizze_235385 = 0;
    unsigned char *mem_217343 = NULL;
    size_t mem_217414_cached_sizze_235386 = 0;
    unsigned char *mem_217414 = NULL;
    size_t mem_217536_cached_sizze_235387 = 0;
    unsigned char *mem_217536 = NULL;
    size_t mem_217540_cached_sizze_235388 = 0;
    unsigned char *mem_217540 = NULL;
    size_t mem_217710_cached_sizze_235389 = 0;
    unsigned char *mem_217710 = NULL;
    size_t mem_217715_cached_sizze_235390 = 0;
    unsigned char *mem_217715 = NULL;
    size_t mem_217773_cached_sizze_235391 = 0;
    unsigned char *mem_217773 = NULL;
    size_t mem_217777_cached_sizze_235392 = 0;
    unsigned char *mem_217777 = NULL;
    size_t mem_217835_cached_sizze_235393 = 0;
    unsigned char *mem_217835 = NULL;
    size_t mem_217839_cached_sizze_235394 = 0;
    unsigned char *mem_217839 = NULL;
    size_t mem_217915_cached_sizze_235395 = 0;
    unsigned char *mem_217915 = NULL;
    size_t mem_218052_cached_sizze_235396 = 0;
    unsigned char *mem_218052 = NULL;
    size_t mem_218057_cached_sizze_235397 = 0;
    unsigned char *mem_218057 = NULL;
    size_t mem_219218_cached_sizze_235398 = 0;
    unsigned char *mem_219218 = NULL;
    size_t mem_219221_cached_sizze_235399 = 0;
    unsigned char *mem_219221 = NULL;
    size_t mem_219243_cached_sizze_235400 = 0;
    unsigned char *mem_219243 = NULL;
    size_t mem_219246_cached_sizze_235401 = 0;
    unsigned char *mem_219246 = NULL;
    size_t mem_219268_cached_sizze_235402 = 0;
    unsigned char *mem_219268 = NULL;
    size_t mem_219271_cached_sizze_235403 = 0;
    unsigned char *mem_219271 = NULL;
    size_t mem_219293_cached_sizze_235404 = 0;
    unsigned char *mem_219293 = NULL;
    size_t mem_220685_cached_sizze_235405 = 0;
    unsigned char *mem_220685 = NULL;
    size_t mem_220689_cached_sizze_235406 = 0;
    unsigned char *mem_220689 = NULL;
    size_t mem_220835_cached_sizze_235407 = 0;
    unsigned char *mem_220835 = NULL;
    size_t mem_220838_cached_sizze_235408 = 0;
    unsigned char *mem_220838 = NULL;
    size_t mem_220841_cached_sizze_235409 = 0;
    unsigned char *mem_220841 = NULL;
    size_t mem_220844_cached_sizze_235410 = 0;
    unsigned char *mem_220844 = NULL;
    struct memblock mem_out_221030;
    
    mem_out_221030.references = NULL;
    
    struct memblock mem_out_221031;
    
    mem_out_221031.references = NULL;
    
    struct memblock mem_out_221032;
    
    mem_out_221032.references = NULL;
    
    double i64_res_203506 = sitofp_i64_f64(n_203490);
    double i64_res_203507 = sitofp_i64_f64(n_p_203492);
    double ceil_arg_203508 = i64_res_203506 / i64_res_203507;
    double ceil_res_203509;
    
    ceil_res_203509 = futrts_ceil64(ceil_arg_203508);
    
    int64_t defunc_0_f_res_203510 = fptosi_f64_i64(ceil_res_203509);
    bool bounds_invalid_upwards_203511 = slt64(n_p_203492, (int64_t) 0);
    bool valid_203512 = !bounds_invalid_upwards_203511;
    bool range_valid_c_203513;
    
    if (!valid_203512) {
        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_p_203492, " 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  stl.fut:403:29-408:37\n   #4  stl.fut:402:22-409:28\n   #5  stl.fut:455:3-469:34\n   #6  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_203515 = slt64(defunc_0_f_res_203510,
                                               (int64_t) 0);
    bool valid_203516 = !bounds_invalid_upwards_203515;
    bool range_valid_c_203517;
    
    if (!valid_203516) {
        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) defunc_0_f_res_203510,
                               " 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  stl.fut:404:36-407:52\n   #4  /prelude/soacs.fut:59:3-10\n   #5  /prelude/array.fut:195:3-17\n   #6  utils.fut:6:3-16\n   #7  stl.fut:403:29-408:37\n   #8  stl.fut:402:22-409:28\n   #9  stl.fut:455:3-469:34\n   #10 stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_y_217286 = (int64_t) 8 * m_203489;
    int64_t bytes_217287 = smax64((int64_t) 0, binop_y_217286);
    
    if (mem_217288_cached_sizze_235379 < (size_t) bytes_217287) {
        mem_217288 = realloc(mem_217288, bytes_217287);
        mem_217288_cached_sizze_235379 = bytes_217287;
    }
    if (mem_217291_cached_sizze_235380 < (size_t) bytes_217287) {
        mem_217291 = realloc(mem_217291, bytes_217287);
        mem_217291_cached_sizze_235380 = bytes_217287;
    }
    
    int64_t bytes_217292 = smax64((int64_t) 0, m_203489);
    
    if (mem_217293_cached_sizze_235381 < (size_t) bytes_217292) {
        mem_217293 = realloc(mem_217293, bytes_217292);
        mem_217293_cached_sizze_235381 = bytes_217292;
    }
    
    int64_t flat_tid_206860 = (int64_t) 0;
    int32_t num_tasks_221033;
    
    if (ctx->debugging)
        fprintf(ctx->log, "%s\n", "nonsegmented segScan");
    
    struct futhark_mc_task_235411 futhark_mc_task_235411;
    
    futhark_mc_task_235411.ctx = ctx;
    futhark_mc_task_235411.free_m_203489 = m_203489;
    futhark_mc_task_235411.free_n_203490 = n_203490;
    futhark_mc_task_235411.free_n_p_203492 = n_p_203492;
    futhark_mc_task_235411.free_defunc_0_f_res_203510 = defunc_0_f_res_203510;
    futhark_mc_task_235411.free_Y_mem_217285 = Y_mem_217285.mem;
    futhark_mc_task_235411.free_mem_217288 = mem_217288;
    futhark_mc_task_235411.free_mem_217291 = mem_217291;
    futhark_mc_task_235411.free_mem_217293 = mem_217293;
    
    struct scheduler_segop futhark_mc_task_235411_task;
    
    futhark_mc_task_235411_task.args = &futhark_mc_task_235411;
    futhark_mc_task_235411_task.top_level_fn = futhark_mc_segscan_task_235412;
    futhark_mc_task_235411_task.name = "futhark_mc_segscan_task_235412";
    futhark_mc_task_235411_task.iterations = m_203489;
    futhark_mc_task_235411_task.task_time =
        &ctx->futhark_mc_segscan_task_235412_total_time;
    futhark_mc_task_235411_task.task_iter =
        &ctx->futhark_mc_segscan_task_235412_total_iter;
    futhark_mc_task_235411_task.sched = STATIC;
    futhark_mc_task_235411_task.nested_fn = NULL;
    
    int futhark_mc_segscan_task_235412_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235411_task);
    
    if (futhark_mc_segscan_task_235412_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t last_index_203575 = m_203489 - (int64_t) 1;
    bool is_empty_203576 = m_203489 == (int64_t) 0;
    int64_t partition_sizze_203577;
    
    if (is_empty_203576) {
        partition_sizze_203577 = (int64_t) 0;
    } else {
        int64_t last_offset_203578;
        
        last_offset_203578 = ((int64_t *) mem_217288)[last_index_203575];
        partition_sizze_203577 = last_offset_203578;
    }
    
    int64_t binop_x_217294 = m_203489 * n_203490;
    int64_t binop_y_217295 = (int64_t) 8 * binop_x_217294;
    int64_t bytes_217296 = smax64((int64_t) 0, binop_y_217295);
    
    if (mem_217297_cached_sizze_235382 < (size_t) bytes_217296) {
        mem_217297 = realloc(mem_217297, bytes_217296);
        mem_217297_cached_sizze_235382 = bytes_217296;
    }
    if (mem_217300_cached_sizze_235383 < (size_t) bytes_217287) {
        mem_217300 = realloc(mem_217300, bytes_217287);
        mem_217300_cached_sizze_235383 = bytes_217287;
    }
    
    int64_t flat_tid_206890 = (int64_t) 0;
    int32_t num_tasks_221128;
    struct futhark_mc_task_235460 futhark_mc_task_235460;
    
    futhark_mc_task_235460.ctx = ctx;
    futhark_mc_task_235460.free_m_203489 = m_203489;
    futhark_mc_task_235460.free_n_203490 = n_203490;
    futhark_mc_task_235460.free_Y_mem_217285 = Y_mem_217285.mem;
    futhark_mc_task_235460.free_mem_217288 = mem_217288;
    futhark_mc_task_235460.free_mem_217291 = mem_217291;
    futhark_mc_task_235460.free_mem_217297 = mem_217297;
    futhark_mc_task_235460.free_mem_217300 = mem_217300;
    
    struct scheduler_segop futhark_mc_task_235460_task;
    
    futhark_mc_task_235460_task.args = &futhark_mc_task_235460;
    futhark_mc_task_235460_task.top_level_fn = futhark_mc_segmap_task_235461;
    futhark_mc_task_235460_task.name = "futhark_mc_segmap_task_235461";
    futhark_mc_task_235460_task.iterations = m_203489;
    futhark_mc_task_235460_task.task_time =
        &ctx->futhark_mc_segmap_task_235461_total_time;
    futhark_mc_task_235460_task.task_iter =
        &ctx->futhark_mc_segmap_task_235461_total_iter;
    futhark_mc_task_235460_task.sched = STATIC;
    futhark_mc_task_235460_task.nested_fn = NULL;
    
    int futhark_mc_segmap_task_235461_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235460_task);
    
    if (futhark_mc_segmap_task_235461_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    bool empty_slice_203591 = partition_sizze_203577 == (int64_t) 0;
    int64_t m_203592 = sub64(partition_sizze_203577, (int64_t) 1);
    bool zzero_leq_i_p_m_t_s_203593 = sle64((int64_t) 0, m_203592);
    bool i_p_m_t_s_leq_w_203594 = slt64(m_203592, m_203489);
    bool i_lte_j_203595 = sle64((int64_t) 0, partition_sizze_203577);
    bool y_203596 = zzero_leq_i_p_m_t_s_203593 && i_p_m_t_s_leq_w_203594;
    bool y_203597 = i_lte_j_203595 && y_203596;
    bool ok_or_empty_203598 = empty_slice_203591 || y_203597;
    bool index_certs_203599;
    
    if (!ok_or_empty_203598) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (long long) partition_sizze_203577,
                               "] out of bounds for array of shape [",
                               (long long) m_203489, "].",
                               "-> #0  /prelude/soacs.fut:163:6-16\n   #1  stl.fut:412:7-66\n   #2  stl.fut:455:3-469:34\n   #3  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203602 = sle64((int64_t) 4, n_p_203492);
    bool assert_c_203603;
    
    if (!assert_cond_203602) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (n_p >= 4)",
                               "-> #0  stl.fut:69:13-33\n   #1  stl.fut:415:61-429:75\n   #2  stl.fut:455:3-469:34\n   #3  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t x_203604 = smod64(q_t_203494, (int64_t) 2);
    bool assert_cond_203605 = x_203604 == (int64_t) 1;
    bool assert_c_203606;
    
    if (!assert_cond_203605) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x % 2 == 1)",
                               "-> #0  utils.fut:20:3-23\n   #1  /prelude/functional.fut:39:62-64\n   #2  stl.fut:71:13-25\n   #3  stl.fut:415:61-429:75\n   #4  stl.fut:455:3-469:34\n   #5  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203607 = slt64((int64_t) 0, q_t_203494);
    bool assert_c_203608;
    
    if (!assert_cond_203607) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:17:3-18\n   #1  /prelude/functional.fut:39:59-65\n   #2  stl.fut:71:13-25\n   #3  stl.fut:415:61-429:75\n   #4  stl.fut:455:3-469:34\n   #5  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t x_203609 = smod64(q_l_203495, (int64_t) 2);
    bool assert_cond_203610 = x_203609 == (int64_t) 1;
    bool assert_c_203611;
    
    if (!assert_cond_203610) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x % 2 == 1)",
                               "-> #0  utils.fut:20:3-23\n   #1  /prelude/functional.fut:39:62-64\n   #2  stl.fut:72:13-25\n   #3  stl.fut:415:61-429:75\n   #4  stl.fut:455:3-469:34\n   #5  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203612 = slt64((int64_t) 0, q_l_203495);
    bool assert_c_203613;
    
    if (!assert_cond_203612) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:17:3-18\n   #1  /prelude/functional.fut:39:59-65\n   #2  stl.fut:72:13-25\n   #3  stl.fut:415:61-429:75\n   #4  stl.fut:455:3-469:34\n   #5  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool cond_203614 = sle64((int64_t) 0, d_t_203497);
    bool assert_cond_t_res_203615 = sle64(d_t_203497, (int64_t) 2);
    bool x_203616 = cond_203614 && assert_cond_t_res_203615;
    bool assert_c_203617;
    
    if (!x_203616) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x >= 0 && x <= 2)",
                               "-> #0  utils.fut:23:3-29\n   #1  stl.fut:74:13-25\n   #2  stl.fut:415:61-429:75\n   #3  stl.fut:455:3-469:34\n   #4  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool cond_203618 = sle64((int64_t) 0, d_l_203498);
    bool assert_cond_t_res_203619 = sle64(d_l_203498, (int64_t) 2);
    bool x_203620 = cond_203618 && assert_cond_t_res_203619;
    bool assert_c_203621;
    
    if (!x_203620) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x >= 0 && x <= 2)",
                               "-> #0  utils.fut:23:3-29\n   #1  stl.fut:75:13-25\n   #2  stl.fut:415:61-429:75\n   #3  stl.fut:455:3-469:34\n   #4  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203622 = slt64((int64_t) 0, jump_t_203500);
    bool assert_c_203623;
    
    if (!assert_cond_203622) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:17:3-18\n   #1  stl.fut:77:16-31\n   #2  stl.fut:415:61-429:75\n   #3  stl.fut:455:3-469:34\n   #4  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203624 = slt64((int64_t) 0, jump_l_203501);
    bool assert_c_203625;
    
    if (!assert_cond_203624) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:17:3-18\n   #1  stl.fut:78:16-31\n   #2  stl.fut:415:61-429:75\n   #3  stl.fut:455:3-469:34\n   #4  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203626 = slt64((int64_t) 0, n_inner_203502);
    bool assert_c_203627;
    
    if (!assert_cond_203626) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:17:3-18\n   #1  stl.fut:80:17-33\n   #2  stl.fut:415:61-429:75\n   #3  stl.fut:455:3-469:34\n   #4  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203628 = slt64((int64_t) 0, n_outer_203503);
    bool assert_c_203629;
    
    if (!assert_cond_203628) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:17:3-18\n   #1  stl.fut:81:17-33\n   #2  stl.fut:415:61-429:75\n   #3  stl.fut:455:3-469:34\n   #4  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    double ceil_res_203630;
    
    ceil_res_203630 = futrts_ceil64(ceil_arg_203508);
    
    int64_t defunc_0_f_res_203631 = fptosi_f64_i64(ceil_res_203630);
    int64_t pad_css_len_203632 = add64((int64_t) 2, defunc_0_f_res_203631);
    int64_t y_203633 = mul64((int64_t) 2, n_p_203492);
    int64_t C_len_203634 = add64(n_203490, y_203633);
    bool cond_203635 = jump_s_203499 == (int64_t) 1;
    int64_t s_n_m_203636;
    
    if (cond_203635) {
        s_n_m_203636 = pad_css_len_203632;
    } else {
        bool zzero_203637 = jump_s_203499 == (int64_t) 0;
        bool nonzzero_203638 = !zzero_203637;
        bool nonzzero_cert_203639;
        
        if (!nonzzero_203638) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  stl.fut:88:52-71\n   #1  stl.fut:415:61-429:75\n   #2  stl.fut:455:3-469:34\n   #3  stl.fut:439:1-469:34\n");
            if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_203640 = sdiv64(defunc_0_f_res_203631, jump_s_203499);
        int64_t s_n_m_f_res_203641 = add64((int64_t) 3, x_203640);
        
        s_n_m_203636 = s_n_m_f_res_203641;
    }
    
    bool cond_203642 = jump_l_203501 == (int64_t) 1;
    int64_t l_n_m_203643;
    
    if (cond_203642) {
        l_n_m_203643 = n_203490;
    } else {
        bool zzero_203644 = jump_l_203501 == (int64_t) 0;
        bool nonzzero_203645 = !zzero_203644;
        bool nonzzero_cert_203646;
        
        if (!nonzzero_203645) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  stl.fut:94:42-51\n   #1  stl.fut:415:61-429:75\n   #2  stl.fut:455:3-469:34\n   #3  stl.fut:439:1-469:34\n");
            if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_203647 = sdiv64(n_203490, jump_l_203501);
        int64_t l_n_m_f_res_203648 = add64((int64_t) 1, x_203647);
        
        l_n_m_203643 = l_n_m_f_res_203648;
    }
    
    bool cond_203649 = jump_t_203500 == (int64_t) 1;
    int64_t t_n_m_203650;
    
    if (cond_203649) {
        t_n_m_203650 = n_203490;
    } else {
        bool zzero_203651 = jump_t_203500 == (int64_t) 0;
        bool nonzzero_203652 = !zzero_203651;
        bool nonzzero_cert_203653;
        
        if (!nonzzero_203652) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  stl.fut:98:42-51\n   #1  stl.fut:415:61-429:75\n   #2  stl.fut:455:3-469:34\n   #3  stl.fut:439:1-469:34\n");
            if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_203654 = sdiv64(n_203490, jump_t_203500);
        int64_t t_n_m_f_res_203655 = add64((int64_t) 1, x_203654);
        
        t_n_m_203650 = t_n_m_f_res_203655;
    }
    
    double x_203656 = i64_res_203506 / 2.0;
    double floor_arg_203657 = 1.0 + x_203656;
    double floor_res_203658;
    
    floor_res_203658 = futrts_floor64(floor_arg_203657);
    
    int64_t defunc_0_f_res_203659 = fptosi_f64_i64(floor_res_203658);
    int64_t x_203660 = sub64(n_203490, defunc_0_f_res_203659);
    int64_t mid2_203661 = add64((int64_t) 1, x_203660);
    bool cond_203662 = defunc_0_f_res_203659 == mid2_203661;
    int64_t stl_res_t_res_203663 = sub64(defunc_0_f_res_203659, (int64_t) 1);
    int64_t stl_res_203664;
    int64_t stl_res_203665;
    
    if (cond_203662) {
        stl_res_203664 = stl_res_t_res_203663;
        stl_res_203665 = defunc_0_f_res_203659;
    } else {
        int64_t min_res_203666 = smin64(defunc_0_f_res_203659, mid2_203661);
        int64_t stl_res_f_res_203667 = sub64(min_res_203666, (int64_t) 1);
        int64_t max_res_203668 = smax64(defunc_0_f_res_203659, mid2_203661);
        
        stl_res_203664 = stl_res_f_res_203667;
        stl_res_203665 = max_res_203668;
    }
    
    int64_t i_203670 = sub64(n_203490, (int64_t) 1);
    bool x_203671 = sle64((int64_t) 0, i_203670);
    bool y_203672 = slt64(i_203670, n_203490);
    bool bounds_check_203673 = x_203671 && y_203672;
    bool index_certs_203674;
    
    if (!bounds_check_203673) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) i_203670,
                               "] out of bounds for array of shape [",
                               (long long) n_203490, "].",
                               "-> #0  /prelude/array.fut:26:29-34\n   #1  utils.fut:45:13-20\n   #2  stl.fut:112:31-49\n   #3  stl.fut:415:61-429:75\n   #4  stl.fut:455:3-469:34\n   #5  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_x_217337 = n_203490 * partition_sizze_203577;
    int64_t binop_y_217338 = (int64_t) 8 * binop_x_217337;
    int64_t bytes_217339 = smax64((int64_t) 0, binop_y_217338);
    
    if (mem_217340_cached_sizze_235384 < (size_t) bytes_217339) {
        mem_217340 = realloc(mem_217340, bytes_217339);
        mem_217340_cached_sizze_235384 = bytes_217339;
    }
    
    int64_t binop_y_217341 = (int64_t) 8 * partition_sizze_203577;
    int64_t bytes_217342 = smax64((int64_t) 0, binop_y_217341);
    
    if (mem_217343_cached_sizze_235385 < (size_t) bytes_217342) {
        mem_217343 = realloc(mem_217343, bytes_217342);
        mem_217343_cached_sizze_235385 = bytes_217342;
    }
    
    int64_t binop_y_217301 = (int64_t) 8 * n_203490;
    int64_t bytes_217302 = smax64((int64_t) 0, binop_y_217301);
    int64_t flat_tid_206892 = (int64_t) 0;
    int32_t num_tasks_221132;
    int64_t flat_tid_206900 = (int64_t) 0;
    struct futhark_mc_task_235464 futhark_mc_task_235464;
    
    futhark_mc_task_235464.ctx = ctx;
    futhark_mc_task_235464.free_n_203490 = n_203490;
    futhark_mc_task_235464.free_partition_sizze_203577 = partition_sizze_203577;
    futhark_mc_task_235464.free_i_203670 = i_203670;
    futhark_mc_task_235464.free_mem_217297 = mem_217297;
    futhark_mc_task_235464.free_bytes_217302 = bytes_217302;
    futhark_mc_task_235464.free_mem_217340 = mem_217340;
    futhark_mc_task_235464.free_mem_217343 = mem_217343;
    
    struct scheduler_segop futhark_mc_task_235464_task;
    
    futhark_mc_task_235464_task.args = &futhark_mc_task_235464;
    futhark_mc_task_235464_task.top_level_fn = futhark_mc_segmap_task_235465;
    futhark_mc_task_235464_task.name = "futhark_mc_segmap_task_235465";
    futhark_mc_task_235464_task.iterations = partition_sizze_203577;
    futhark_mc_task_235464_task.task_time =
        &ctx->futhark_mc_segmap_task_235465_total_time;
    futhark_mc_task_235464_task.task_iter =
        &ctx->futhark_mc_segmap_task_235465_total_iter;
    futhark_mc_task_235464_task.sched = STATIC;
    futhark_mc_task_235464_task.nested_fn =
        futhark_mc_segmap_nested_task_235470;
    
    int futhark_mc_segmap_task_235465_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235464_task);
    
    if (futhark_mc_segmap_task_235465_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_203698 = slt64(defunc_0_f_res_203631,
                                               (int64_t) 0);
    bool valid_203699 = !bounds_invalid_upwards_203698;
    bool range_valid_c_203700;
    
    if (!valid_203699) {
        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) defunc_0_f_res_203631,
                               " 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  stl.fut:119:20-125:36\n   #4  /prelude/soacs.fut:59:3-10\n   #5  /prelude/array.fut:195:3-17\n   #6  utils.fut:6:3-16\n   #7  stl.fut:117:12-126:20\n   #8  stl.fut:116:5-127:11\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_x_217410 = n_p_203492 * partition_sizze_203577;
    int64_t binop_x_217411 = defunc_0_f_res_203631 * binop_x_217410;
    int64_t binop_y_217412 = (int64_t) 8 * binop_x_217411;
    int64_t bytes_217413 = smax64((int64_t) 0, binop_y_217412);
    
    if (mem_217414_cached_sizze_235386 < (size_t) bytes_217413) {
        mem_217414 = realloc(mem_217414, bytes_217413);
        mem_217414_cached_sizze_235386 = bytes_217413;
    }
    
    int64_t binop_x_217362 = n_p_203492 * defunc_0_f_res_203631;
    int64_t binop_y_217363 = (int64_t) 8 * binop_x_217362;
    int64_t bytes_217364 = smax64((int64_t) 0, binop_y_217363);
    int64_t binop_y_217344 = (int64_t) 8 * defunc_0_f_res_203631;
    int64_t bytes_217345 = smax64((int64_t) 0, binop_y_217344);
    int64_t flat_tid_206925 = (int64_t) 0;
    int32_t num_tasks_221199;
    int64_t flat_tid_206951 = (int64_t) 0;
    struct futhark_mc_task_235486 futhark_mc_task_235486;
    
    futhark_mc_task_235486.ctx = ctx;
    futhark_mc_task_235486.free_n_203490 = n_203490;
    futhark_mc_task_235486.free_n_p_203492 = n_p_203492;
    futhark_mc_task_235486.free_partition_sizze_203577 = partition_sizze_203577;
    futhark_mc_task_235486.free_defunc_0_f_res_203631 = defunc_0_f_res_203631;
    futhark_mc_task_235486.free_i_203670 = i_203670;
    futhark_mc_task_235486.free_mem_217297 = mem_217297;
    futhark_mc_task_235486.free_bytes_217345 = bytes_217345;
    futhark_mc_task_235486.free_bytes_217364 = bytes_217364;
    futhark_mc_task_235486.free_mem_217414 = mem_217414;
    
    struct scheduler_segop futhark_mc_task_235486_task;
    
    futhark_mc_task_235486_task.args = &futhark_mc_task_235486;
    futhark_mc_task_235486_task.top_level_fn = futhark_mc_segmap_task_235487;
    futhark_mc_task_235486_task.name = "futhark_mc_segmap_task_235487";
    futhark_mc_task_235486_task.iterations = partition_sizze_203577;
    futhark_mc_task_235486_task.task_time =
        &ctx->futhark_mc_segmap_task_235487_total_time;
    futhark_mc_task_235486_task.task_iter =
        &ctx->futhark_mc_segmap_task_235487_total_iter;
    futhark_mc_task_235486_task.sched = STATIC;
    futhark_mc_task_235486_task.nested_fn =
        futhark_mc_segmap_nested_task_235491;
    
    int futhark_mc_segmap_task_235487_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235486_task);
    
    if (futhark_mc_segmap_task_235487_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t i_203718 = sub64(defunc_0_f_res_203631, (int64_t) 1);
    bool x_203719 = sle64((int64_t) 0, i_203718);
    bool y_203720 = slt64(i_203718, defunc_0_f_res_203631);
    bool bounds_check_203721 = x_203719 && y_203720;
    bool index_certs_203722;
    
    if (!bounds_check_203721) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) i_203718,
                               "] out of bounds for array of shape [",
                               (long long) defunc_0_f_res_203631, "].",
                               "-> #0  /prelude/array.fut:26:29-34\n   #1  utils.fut:45:13-20\n   #2  stl.fut:133:51-67\n   #3  stl.fut:132:12-135:21\n   #4  stl.fut:131:5-136:16\n   #5  stl.fut:415:61-429:75\n   #6  stl.fut:455:3-469:34\n   #7  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    if (mem_217536_cached_sizze_235387 < (size_t) bytes_217413) {
        mem_217536 = realloc(mem_217536, bytes_217413);
        mem_217536_cached_sizze_235387 = bytes_217413;
    }
    
    int64_t binop_y_217538 = (int64_t) 8 * binop_x_217410;
    int64_t bytes_217539 = smax64((int64_t) 0, binop_y_217538);
    
    if (mem_217540_cached_sizze_235388 < (size_t) bytes_217539) {
        mem_217540 = realloc(mem_217540, bytes_217539);
        mem_217540_cached_sizze_235388 = bytes_217539;
    }
    
    int64_t binop_y_217455 = (int64_t) 8 * n_p_203492;
    int64_t bytes_217456 = smax64((int64_t) 0, binop_y_217455);
    int64_t flat_tid_206985 = (int64_t) 0;
    int32_t num_tasks_221295;
    int64_t flat_tid_207022 = (int64_t) 0;
    struct futhark_mc_task_235508 futhark_mc_task_235508;
    
    futhark_mc_task_235508.ctx = ctx;
    futhark_mc_task_235508.free_n_p_203492 = n_p_203492;
    futhark_mc_task_235508.free_partition_sizze_203577 = partition_sizze_203577;
    futhark_mc_task_235508.free_defunc_0_f_res_203631 = defunc_0_f_res_203631;
    futhark_mc_task_235508.free_i_203718 = i_203718;
    futhark_mc_task_235508.free_bytes_217345 = bytes_217345;
    futhark_mc_task_235508.free_bytes_217364 = bytes_217364;
    futhark_mc_task_235508.free_mem_217414 = mem_217414;
    futhark_mc_task_235508.free_bytes_217456 = bytes_217456;
    futhark_mc_task_235508.free_mem_217536 = mem_217536;
    futhark_mc_task_235508.free_mem_217540 = mem_217540;
    
    struct scheduler_segop futhark_mc_task_235508_task;
    
    futhark_mc_task_235508_task.args = &futhark_mc_task_235508;
    futhark_mc_task_235508_task.top_level_fn = futhark_mc_segmap_task_235509;
    futhark_mc_task_235508_task.name = "futhark_mc_segmap_task_235509";
    futhark_mc_task_235508_task.iterations = partition_sizze_203577;
    futhark_mc_task_235508_task.task_time =
        &ctx->futhark_mc_segmap_task_235509_total_time;
    futhark_mc_task_235508_task.task_iter =
        &ctx->futhark_mc_segmap_task_235509_total_iter;
    futhark_mc_task_235508_task.sched = STATIC;
    futhark_mc_task_235508_task.nested_fn =
        futhark_mc_segmap_nested_task_235516;
    
    int futhark_mc_segmap_task_235509_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235508_task);
    
    if (futhark_mc_segmap_task_235509_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_203749 = smin64(q_s_203493, defunc_0_f_res_203631);
    bool bounds_invalid_upwards_203750 = slt64(s_n_m_203636, (int64_t) 0);
    bool valid_203751 = !bounds_invalid_upwards_203750;
    bool range_valid_c_203752;
    
    if (!valid_203751) {
        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) s_n_m_203636, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  utils.fut:6:3-16\n   #3  loess.fut:443:3-470:10\n   #4  loess.fut:517:15-50\n   #5  stl.fut:142:20-80\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:141:12-143:40\n   #9  /prelude/soacs.fut:67:19-23\n   #10 /prelude/soacs.fut:67:3-37\n   #11 stl.fut:140:5-144:36\n   #12 stl.fut:415:61-429:75\n   #13 stl.fut:455:3-469:34\n   #14 stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_203754 = slt64((int64_t) 1, min_res_203749);
    double i64_res_203755 = sitofp_i64_f64(q_s_203493);
    int64_t binop_x_217707 = s_n_m_203636 * binop_x_217410;
    int64_t binop_y_217708 = (int64_t) 8 * binop_x_217707;
    int64_t bytes_217709 = smax64((int64_t) 0, binop_y_217708);
    
    if (mem_217710_cached_sizze_235389 < (size_t) bytes_217709) {
        mem_217710 = realloc(mem_217710, bytes_217709);
        mem_217710_cached_sizze_235389 = bytes_217709;
    }
    if (mem_217715_cached_sizze_235390 < (size_t) bytes_217709) {
        mem_217715 = realloc(mem_217715, bytes_217709);
        mem_217715_cached_sizze_235390 = bytes_217709;
    }
    
    int64_t binop_x_217595 = n_p_203492 * s_n_m_203636;
    int64_t binop_y_217596 = (int64_t) 8 * binop_x_217595;
    int64_t bytes_217597 = smax64((int64_t) 0, binop_y_217596);
    int64_t binop_y_217544 = (int64_t) 8 * s_n_m_203636;
    int64_t bytes_217545 = smax64((int64_t) 0, binop_y_217544);
    int64_t flat_tid_207073 = (int64_t) 0;
    int32_t num_tasks_221456;
    int64_t flat_tid_207208 = (int64_t) 0;
    struct futhark_mc_task_235543 futhark_mc_task_235543;
    
    futhark_mc_task_235543.ctx = ctx;
    futhark_mc_task_235543.free_n_p_203492 = n_p_203492;
    futhark_mc_task_235543.free_q_s_203493 = q_s_203493;
    futhark_mc_task_235543.free_jump_s_203499 = jump_s_203499;
    futhark_mc_task_235543.free_partition_sizze_203577 = partition_sizze_203577;
    futhark_mc_task_235543.free_defunc_0_f_res_203631 = defunc_0_f_res_203631;
    futhark_mc_task_235543.free_pad_css_len_203632 = pad_css_len_203632;
    futhark_mc_task_235543.free_s_n_m_203636 = s_n_m_203636;
    futhark_mc_task_235543.free_i_203718 = i_203718;
    futhark_mc_task_235543.free_x_203719 = x_203719;
    futhark_mc_task_235543.free_min_res_203749 = min_res_203749;
    futhark_mc_task_235543.free_loop_cond_203754 = loop_cond_203754;
    futhark_mc_task_235543.free_i64_res_203755 = i64_res_203755;
    futhark_mc_task_235543.free_bytes_217345 = bytes_217345;
    futhark_mc_task_235543.free_mem_217536 = mem_217536;
    futhark_mc_task_235543.free_mem_217540 = mem_217540;
    futhark_mc_task_235543.free_bytes_217545 = bytes_217545;
    futhark_mc_task_235543.free_bytes_217597 = bytes_217597;
    futhark_mc_task_235543.free_mem_217710 = mem_217710;
    futhark_mc_task_235543.free_mem_217715 = mem_217715;
    
    struct scheduler_segop futhark_mc_task_235543_task;
    
    futhark_mc_task_235543_task.args = &futhark_mc_task_235543;
    futhark_mc_task_235543_task.top_level_fn = futhark_mc_segmap_task_235544;
    futhark_mc_task_235543_task.name = "futhark_mc_segmap_task_235544";
    futhark_mc_task_235543_task.iterations = partition_sizze_203577;
    futhark_mc_task_235543_task.task_time =
        &ctx->futhark_mc_segmap_task_235544_total_time;
    futhark_mc_task_235543_task.task_iter =
        &ctx->futhark_mc_segmap_task_235544_total_iter;
    futhark_mc_task_235543_task.sched = DYNAMIC;
    futhark_mc_task_235543_task.nested_fn =
        futhark_mc_segmap_nested_task_235550;
    
    int futhark_mc_segmap_task_235544_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235543_task);
    
    if (futhark_mc_segmap_task_235544_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_203881 = smin64(n_203490, q_l_203495);
    bool bounds_invalid_upwards_203882 = slt64(l_n_m_203643, (int64_t) 0);
    bool valid_203883 = !bounds_invalid_upwards_203882;
    bool range_valid_c_203884;
    
    if (!valid_203883) {
        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) l_n_m_203643, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  utils.fut:6:3-16\n   #3  loess.fut:443:3-470:10\n   #4  loess.fut:503:15-61\n   #5  stl.fut:150:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:148:5-151:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_203886 = slt64((int64_t) 1, min_res_203881);
    double i64_res_203887 = sitofp_i64_f64(q_l_203495);
    int64_t binop_x_217770 = partition_sizze_203577 * l_n_m_203643;
    int64_t binop_y_217771 = (int64_t) 8 * binop_x_217770;
    int64_t bytes_217772 = smax64((int64_t) 0, binop_y_217771);
    
    if (mem_217773_cached_sizze_235391 < (size_t) bytes_217772) {
        mem_217773 = realloc(mem_217773, bytes_217772);
        mem_217773_cached_sizze_235391 = bytes_217772;
    }
    if (mem_217777_cached_sizze_235392 < (size_t) bytes_217772) {
        mem_217777 = realloc(mem_217777, bytes_217772);
        mem_217777_cached_sizze_235392 = bytes_217772;
    }
    
    int64_t binop_y_217719 = (int64_t) 8 * l_n_m_203643;
    int64_t bytes_217720 = smax64((int64_t) 0, binop_y_217719);
    int64_t flat_tid_207456 = (int64_t) 0;
    int32_t num_tasks_222180;
    int64_t flat_tid_207464 = (int64_t) 0;
    struct futhark_mc_task_235576 futhark_mc_task_235576;
    
    futhark_mc_task_235576.ctx = ctx;
    futhark_mc_task_235576.free_n_203490 = n_203490;
    futhark_mc_task_235576.free_q_l_203495 = q_l_203495;
    futhark_mc_task_235576.free_jump_l_203501 = jump_l_203501;
    futhark_mc_task_235576.free_partition_sizze_203577 = partition_sizze_203577;
    futhark_mc_task_235576.free_l_n_m_203643 = l_n_m_203643;
    futhark_mc_task_235576.free_i_203670 = i_203670;
    futhark_mc_task_235576.free_x_203671 = x_203671;
    futhark_mc_task_235576.free_min_res_203881 = min_res_203881;
    futhark_mc_task_235576.free_loop_cond_203886 = loop_cond_203886;
    futhark_mc_task_235576.free_i64_res_203887 = i64_res_203887;
    futhark_mc_task_235576.free_bytes_217302 = bytes_217302;
    futhark_mc_task_235576.free_mem_217340 = mem_217340;
    futhark_mc_task_235576.free_mem_217343 = mem_217343;
    futhark_mc_task_235576.free_bytes_217720 = bytes_217720;
    futhark_mc_task_235576.free_mem_217773 = mem_217773;
    futhark_mc_task_235576.free_mem_217777 = mem_217777;
    
    struct scheduler_segop futhark_mc_task_235576_task;
    
    futhark_mc_task_235576_task.args = &futhark_mc_task_235576;
    futhark_mc_task_235576_task.top_level_fn = futhark_mc_segmap_task_235577;
    futhark_mc_task_235576_task.name = "futhark_mc_segmap_task_235577";
    futhark_mc_task_235576_task.iterations = partition_sizze_203577;
    futhark_mc_task_235576_task.task_time =
        &ctx->futhark_mc_segmap_task_235577_total_time;
    futhark_mc_task_235576_task.task_iter =
        &ctx->futhark_mc_segmap_task_235577_total_iter;
    futhark_mc_task_235576_task.sched = DYNAMIC;
    futhark_mc_task_235576_task.nested_fn =
        futhark_mc_segmap_nested_task_235583;
    
    int futhark_mc_segmap_task_235577_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235576_task);
    
    if (futhark_mc_segmap_task_235577_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_203993 = smin64(n_203490, q_t_203494);
    bool bounds_invalid_upwards_203994 = slt64(t_n_m_203650, (int64_t) 0);
    bool valid_203995 = !bounds_invalid_upwards_203994;
    bool range_valid_c_203996;
    
    if (!valid_203995) {
        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) t_n_m_203650, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  utils.fut:6:3-16\n   #3  loess.fut:443:3-470:10\n   #4  loess.fut:503:15-61\n   #5  stl.fut:157:13-60\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:155:5-158:26\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_203998 = slt64((int64_t) 1, min_res_203993);
    double i64_res_203999 = sitofp_i64_f64(q_t_203494);
    int64_t binop_x_217832 = partition_sizze_203577 * t_n_m_203650;
    int64_t binop_y_217833 = (int64_t) 8 * binop_x_217832;
    int64_t bytes_217834 = smax64((int64_t) 0, binop_y_217833);
    
    if (mem_217835_cached_sizze_235393 < (size_t) bytes_217834) {
        mem_217835 = realloc(mem_217835, bytes_217834);
        mem_217835_cached_sizze_235393 = bytes_217834;
    }
    if (mem_217839_cached_sizze_235394 < (size_t) bytes_217834) {
        mem_217839 = realloc(mem_217839, bytes_217834);
        mem_217839_cached_sizze_235394 = bytes_217834;
    }
    
    int64_t binop_y_217781 = (int64_t) 8 * t_n_m_203650;
    int64_t bytes_217782 = smax64((int64_t) 0, binop_y_217781);
    int64_t flat_tid_207571 = (int64_t) 0;
    int32_t num_tasks_222455;
    int64_t flat_tid_207579 = (int64_t) 0;
    struct futhark_mc_task_235597 futhark_mc_task_235597;
    
    futhark_mc_task_235597.ctx = ctx;
    futhark_mc_task_235597.free_n_203490 = n_203490;
    futhark_mc_task_235597.free_q_t_203494 = q_t_203494;
    futhark_mc_task_235597.free_jump_t_203500 = jump_t_203500;
    futhark_mc_task_235597.free_partition_sizze_203577 = partition_sizze_203577;
    futhark_mc_task_235597.free_t_n_m_203650 = t_n_m_203650;
    futhark_mc_task_235597.free_i_203670 = i_203670;
    futhark_mc_task_235597.free_x_203671 = x_203671;
    futhark_mc_task_235597.free_min_res_203993 = min_res_203993;
    futhark_mc_task_235597.free_loop_cond_203998 = loop_cond_203998;
    futhark_mc_task_235597.free_i64_res_203999 = i64_res_203999;
    futhark_mc_task_235597.free_bytes_217302 = bytes_217302;
    futhark_mc_task_235597.free_mem_217340 = mem_217340;
    futhark_mc_task_235597.free_mem_217343 = mem_217343;
    futhark_mc_task_235597.free_bytes_217782 = bytes_217782;
    futhark_mc_task_235597.free_mem_217835 = mem_217835;
    futhark_mc_task_235597.free_mem_217839 = mem_217839;
    
    struct scheduler_segop futhark_mc_task_235597_task;
    
    futhark_mc_task_235597_task.args = &futhark_mc_task_235597;
    futhark_mc_task_235597_task.top_level_fn = futhark_mc_segmap_task_235598;
    futhark_mc_task_235597_task.name = "futhark_mc_segmap_task_235598";
    futhark_mc_task_235597_task.iterations = partition_sizze_203577;
    futhark_mc_task_235597_task.task_time =
        &ctx->futhark_mc_segmap_task_235598_total_time;
    futhark_mc_task_235597_task.task_iter =
        &ctx->futhark_mc_segmap_task_235598_total_iter;
    futhark_mc_task_235597_task.sched = DYNAMIC;
    futhark_mc_task_235597_task.nested_fn =
        futhark_mc_segmap_nested_task_235604;
    
    int futhark_mc_segmap_task_235598_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235597_task);
    
    if (futhark_mc_segmap_task_235598_err != 0) {
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    struct memblock mem_217843;
    
    mem_217843.references = NULL;
    if (memblock_alloc(ctx, &mem_217843, bytes_217339, "mem_217843")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_222730 = 0; i_222730 < partition_sizze_203577; i_222730++) {
        for (int64_t i_222731 = 0; i_222731 < n_203490; i_222731++) {
            ((double *) mem_217843.mem)[i_222730 * n_203490 + i_222731] = 0.0;
        }
    }
    
    struct memblock mem_217847;
    
    mem_217847.references = NULL;
    if (memblock_alloc(ctx, &mem_217847, bytes_217339, "mem_217847")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_222732 = 0; i_222732 < partition_sizze_203577; i_222732++) {
        for (int64_t i_222733 = 0; i_222733 < n_203490; i_222733++) {
            ((double *) mem_217847.mem)[i_222732 * n_203490 + i_222733] = 1.0;
        }
    }
    
    bool cond_204107 = slt64((int64_t) 1, jump_l_203501);
    bool cond_204108 = slt64((int64_t) 1, jump_t_203500);
    int64_t y_204109 = sub64(n_outer_203503, (int64_t) 1);
    int64_t css_results_l_204110;
    
    if (cond_203635) {
        css_results_l_204110 = s_n_m_203636;
    } else {
        css_results_l_204110 = pad_css_len_203632;
    }
    
    bool zzero_204111 = n_p_203492 == (int64_t) 0;
    bool nonzzero_204112 = !zzero_204111;
    bool loop_not_taken_204113 = !assert_cond_203626;
    bool protect_assert_disj_204114 = nonzzero_204112 || loop_not_taken_204113;
    bool loop_not_taken_204115 = !assert_cond_203628;
    bool protect_assert_disj_204116 = protect_assert_disj_204114 ||
         loop_not_taken_204115;
    bool nonzzero_cert_204117;
    
    if (!protect_assert_disj_204116) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "division by zero",
                               "-> #0  stl.fut:226:51-57\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  stl.fut:226:28-74\n   #5  stl.fut:225:21-227:39\n   #6  stl.fut:415:61-429:75\n   #7  stl.fut:455:3-469:34\n   #8  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t j_204118 = add64(n_203490, n_p_203492);
    bool empty_slice_204119 = n_203490 == (int64_t) 0;
    int64_t i_p_m_t_s_204120 = add64(n_p_203492, i_203670);
    bool zzero_leq_i_p_m_t_s_204121 = sle64((int64_t) 0, i_p_m_t_s_204120);
    bool i_p_m_t_s_leq_w_204122 = slt64(i_p_m_t_s_204120, C_len_203634);
    bool zzero_lte_i_204123 = sle64((int64_t) 0, n_p_203492);
    bool i_lte_j_204124 = sle64(n_p_203492, j_204118);
    bool y_204125 = i_p_m_t_s_leq_w_204122 && zzero_lte_i_204123;
    bool y_204126 = zzero_leq_i_p_m_t_s_204121 && y_204125;
    bool y_204127 = i_lte_j_204124 && y_204126;
    bool forwards_ok_204128 = zzero_lte_i_204123 && y_204127;
    bool ok_or_empty_204129 = empty_slice_204119 || forwards_ok_204128;
    bool protect_assert_disj_204130 = loop_not_taken_204113 ||
         ok_or_empty_204129;
    bool protect_assert_disj_204131 = loop_not_taken_204115 ||
         protect_assert_disj_204130;
    bool index_certs_204132;
    
    if (!protect_assert_disj_204131) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) n_p_203492, ":",
                               (long long) j_204118,
                               "] out of bounds for array of shape [",
                               (long long) C_len_203634, "].",
                               "-> #0  stl.fut:262:35-50\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  stl.fut:260:13-265:26\n   #4  stl.fut:415:61-429:75\n   #5  stl.fut:455:3-469:34\n   #6  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t j_m_i_204133 = sub64(stl_res_203665, stl_res_203664);
    int64_t lifted_single_ma_l_arg_204134 = add64((int64_t) 1, j_204118);
    int64_t m_204135 = sub64(n_p_203492, (int64_t) 1);
    bool zzero_leq_i_p_m_t_s_204136 = sle64((int64_t) 0, m_204135);
    bool i_p_m_t_s_leq_w_204137 = slt64(m_204135, C_len_203634);
    bool y_204138 = zzero_leq_i_p_m_t_s_204136 && i_p_m_t_s_leq_w_204137;
    bool y_204139 = zzero_lte_i_204123 && y_204138;
    bool ok_or_empty_204140 = zzero_204111 || y_204139;
    bool protect_assert_disj_204141 = loop_not_taken_204113 ||
         ok_or_empty_204140;
    bool protect_assert_disj_204142 = loop_not_taken_204115 ||
         protect_assert_disj_204141;
    bool index_certs_204143;
    
    if (!protect_assert_disj_204142) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (long long) n_p_203492,
                               "] out of bounds for array of shape [",
                               (long long) C_len_203634, "].",
                               "-> #0  stl.fut:24:37-43\n   #1  stl.fut:24:20-48\n   #2  stl.fut:38:3-36\n   #3  stl.fut:231:23-47\n   #4  stl.fut:415:61-429:75\n   #5  stl.fut:455:3-469:34\n   #6  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t dyn_lifted_single_ma_l_arg_204144 = add64((int64_t) 2, n_203490);
    bool i_p_m_t_s_leq_w_204145 = slt64(m_204135,
                                        lifted_single_ma_l_arg_204134);
    bool y_204146 = zzero_leq_i_p_m_t_s_204136 && i_p_m_t_s_leq_w_204145;
    bool y_204147 = zzero_lte_i_204123 && y_204146;
    bool ok_or_empty_204148 = zzero_204111 || y_204147;
    bool protect_assert_disj_204149 = loop_not_taken_204113 ||
         ok_or_empty_204148;
    bool protect_assert_disj_204150 = loop_not_taken_204115 ||
         protect_assert_disj_204149;
    bool index_certs_204151;
    
    if (!protect_assert_disj_204150) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (long long) n_p_203492,
                               "] out of bounds for array of shape [",
                               (long long) lifted_single_ma_l_arg_204134, "].",
                               "-> #0  stl.fut:24:37-43\n   #1  stl.fut:24:20-48\n   #2  /prelude/functional.fut:9:42-44\n   #3  stl.fut:38:3-64\n   #4  stl.fut:231:23-47\n   #5  stl.fut:415:61-429:75\n   #6  stl.fut:455:3-469:34\n   #7  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool i_p_m_t_s_leq_w_204152 = slt64((int64_t) 2,
                                        dyn_lifted_single_ma_l_arg_204144);
    bool protect_assert_disj_204153 = loop_not_taken_204113 ||
         i_p_m_t_s_leq_w_204152;
    bool protect_assert_disj_204154 = loop_not_taken_204115 ||
         protect_assert_disj_204153;
    bool index_certs_204155;
    
    if (!protect_assert_disj_204154) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (long long) (int64_t) 3,
                               "] out of bounds for array of shape [",
                               (long long) dyn_lifted_single_ma_l_arg_204144,
                               "].",
                               "-> #0  stl.fut:24:37-43\n   #1  stl.fut:24:20-48\n   #2  /prelude/functional.fut:9:42-44\n   #3  stl.fut:38:3-84\n   #4  stl.fut:231:23-47\n   #5  stl.fut:415:61-429:75\n   #6  stl.fut:455:3-469:34\n   #7  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool cond_204156 = slt64(jump_l_203501, jump_threshold_203504);
    bool cond_f_res_204157 = slt64(q_threshold_203505, q_l_203495);
    bool x_204158 = !cond_204156;
    bool y_204159 = cond_f_res_204157 && x_204158;
    bool cond_204160 = cond_204156 || y_204159;
    bool cond_204161 = slt64(jump_t_203500, jump_threshold_203504);
    bool cond_f_res_204162 = slt64(q_threshold_203505, q_t_203494);
    bool x_204163 = !cond_204161;
    bool y_204164 = cond_f_res_204162 && x_204163;
    bool cond_204165 = cond_204161 || y_204164;
    bool cond_204166 = slt64(jump_s_203499, jump_threshold_203504);
    bool cond_f_res_204167 = slt64(q_threshold_203505, q_s_203493);
    bool x_204168 = !cond_204166;
    bool y_204169 = cond_f_res_204167 && x_204168;
    bool cond_204170 = cond_204166 || y_204169;
    bool bounds_invalid_upwards_204171 = slt64(C_len_203634, (int64_t) 0);
    bool valid_204172 = !bounds_invalid_upwards_204171;
    bool protect_assert_disj_204173 = loop_not_taken_204113 || valid_204172;
    bool protect_assert_disj_204174 = loop_not_taken_204115 ||
         protect_assert_disj_204173;
    bool range_valid_c_204175;
    
    if (!protect_assert_disj_204174) {
        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) C_len_203634, " 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  stl.fut:226:28-74\n   #4  stl.fut:225:21-227:39\n   #5  stl.fut:415:61-429:75\n   #6  stl.fut:455:3-469:34\n   #7  stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_204177 = slt64(lifted_single_ma_l_arg_204134,
                                               (int64_t) 0);
    bool valid_204178 = !bounds_invalid_upwards_204177;
    bool protect_assert_disj_204179 = loop_not_taken_204113 || valid_204178;
    bool protect_assert_disj_204180 = loop_not_taken_204115 ||
         protect_assert_disj_204179;
    bool range_valid_c_204181;
    
    if (!protect_assert_disj_204180) {
        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) lifted_single_ma_l_arg_204134,
                               " 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  stl.fut:27:13-33:19\n   #4  /prelude/soacs.fut:67:19-23\n   #5  /prelude/soacs.fut:67:3-37\n   #6  stl.fut:26:5-34:23\n   #7  stl.fut:38:3-36\n   #8  stl.fut:231:23-47\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_204183 =
         slt64(dyn_lifted_single_ma_l_arg_204144, (int64_t) 0);
    bool valid_204184 = !bounds_invalid_upwards_204183;
    bool protect_assert_disj_204185 = loop_not_taken_204113 || valid_204184;
    bool protect_assert_disj_204186 = loop_not_taken_204115 ||
         protect_assert_disj_204185;
    bool range_valid_c_204187;
    
    if (!protect_assert_disj_204186) {
        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) dyn_lifted_single_ma_l_arg_204144,
                               " 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  stl.fut:27:13-33:19\n   #4  /prelude/soacs.fut:67:19-23\n   #5  /prelude/soacs.fut:67:3-37\n   #6  stl.fut:26:5-34:23\n   #7  /prelude/functional.fut:9:42-44\n   #8  stl.fut:38:3-64\n   #9  stl.fut:231:23-47\n   #10 stl.fut:415:61-429:75\n   #11 stl.fut:455:3-469:34\n   #12 stl.fut:439:1-469:34\n");
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    if (mem_217915_cached_sizze_235395 < (size_t) bytes_217339) {
        mem_217915 = realloc(mem_217915, bytes_217339);
        mem_217915_cached_sizze_235395 = bytes_217339;
    }
    if (mem_218052_cached_sizze_235396 < (size_t) bytes_217413) {
        mem_218052 = realloc(mem_218052, bytes_217413);
        mem_218052_cached_sizze_235396 = bytes_217413;
    }
    if (mem_218057_cached_sizze_235397 < (size_t) bytes_217413) {
        mem_218057 = realloc(mem_218057, bytes_217413);
        mem_218057_cached_sizze_235397 = bytes_217413;
    }
    
    int64_t binop_x_219191 = pad_css_len_203632 * binop_x_217410;
    int64_t binop_y_219192 = (int64_t) 8 * binop_x_219191;
    int64_t bytes_219193 = smax64((int64_t) 0, binop_y_219192);
    int64_t binop_x_219215 = partition_sizze_203577 * C_len_203634;
    int64_t binop_y_219216 = (int64_t) 8 * binop_x_219215;
    int64_t bytes_219217 = smax64((int64_t) 0, binop_y_219216);
    
    if (mem_219218_cached_sizze_235398 < (size_t) bytes_219217) {
        mem_219218 = realloc(mem_219218, bytes_219217);
        mem_219218_cached_sizze_235398 = bytes_219217;
    }
    
    int64_t binop_y_219197 = (int64_t) 8 * C_len_203634;
    int64_t bytes_219198 = smax64((int64_t) 0, binop_y_219197);
    
    if (mem_219221_cached_sizze_235399 < (size_t) bytes_217342) {
        mem_219221 = realloc(mem_219221, bytes_217342);
        mem_219221_cached_sizze_235399 = bytes_217342;
    }
    
    int64_t binop_x_219240 = partition_sizze_203577 *
            lifted_single_ma_l_arg_204134;
    int64_t binop_y_219241 = (int64_t) 8 * binop_x_219240;
    int64_t bytes_219242 = smax64((int64_t) 0, binop_y_219241);
    
    if (mem_219243_cached_sizze_235400 < (size_t) bytes_219242) {
        mem_219243 = realloc(mem_219243, bytes_219242);
        mem_219243_cached_sizze_235400 = bytes_219242;
    }
    
    int64_t binop_y_219222 = (int64_t) 8 * lifted_single_ma_l_arg_204134;
    int64_t bytes_219223 = smax64((int64_t) 0, binop_y_219222);
    
    if (mem_219246_cached_sizze_235401 < (size_t) bytes_217342) {
        mem_219246 = realloc(mem_219246, bytes_217342);
        mem_219246_cached_sizze_235401 = bytes_217342;
    }
    
    int64_t binop_x_219265 = partition_sizze_203577 *
            dyn_lifted_single_ma_l_arg_204144;
    int64_t binop_y_219266 = (int64_t) 8 * binop_x_219265;
    int64_t bytes_219267 = smax64((int64_t) 0, binop_y_219266);
    
    if (mem_219268_cached_sizze_235402 < (size_t) bytes_219267) {
        mem_219268 = realloc(mem_219268, bytes_219267);
        mem_219268_cached_sizze_235402 = bytes_219267;
    }
    
    int64_t binop_y_219247 = (int64_t) 8 * dyn_lifted_single_ma_l_arg_204144;
    int64_t bytes_219248 = smax64((int64_t) 0, binop_y_219247);
    
    if (mem_219271_cached_sizze_235403 < (size_t) bytes_217342) {
        mem_219271 = realloc(mem_219271, bytes_217342);
        mem_219271_cached_sizze_235403 = bytes_217342;
    }
    if (mem_219293_cached_sizze_235404 < (size_t) bytes_217339) {
        mem_219293 = realloc(mem_219293, bytes_217339);
        mem_219293_cached_sizze_235404 = bytes_217339;
    }
    
    int64_t ext_219786;
    
    if (cond_204107) {
        ext_219786 = n_203490;
    } else {
        ext_219786 = l_n_m_203643;
    }
    
    int64_t ext_220625;
    
    if (cond_204108) {
        ext_220625 = n_203490;
    } else {
        ext_220625 = t_n_m_203650;
    }
    
    int64_t ext_220890;
    int64_t ext_220888;
    int64_t ext_220884;
    int64_t ext_220883;
    int64_t ext_220882;
    int64_t ext_220881;
    int64_t ext_220880;
    int64_t ext_220879;
    int64_t ext_220878;
    struct memblock ext_mem_220877;
    
    ext_mem_220877.references = NULL;
    
    struct memblock ext_mem_220876;
    
    ext_mem_220876.references = NULL;
    
    struct memblock ext_mem_220875;
    
    ext_mem_220875.references = NULL;
    
    struct memblock mem_param_217855;
    
    mem_param_217855.references = NULL;
    
    int64_t ctx_param_ext_217857;
    int64_t ctx_param_ext_217859;
    struct memblock mem_param_217863;
    
    mem_param_217863.references = NULL;
    
    int64_t ctx_param_ext_217864;
    int64_t ctx_param_ext_217865;
    int64_t ctx_param_ext_217866;
    int64_t ctx_param_ext_217867;
    int64_t ctx_param_ext_217868;
    int64_t ctx_param_ext_217869;
    int64_t ctx_param_ext_217870;
    struct memblock mem_param_217871;
    
    mem_param_217871.references = NULL;
    ctx_param_ext_217857 = n_203490;
    ctx_param_ext_217859 = n_203490;
    ctx_param_ext_217864 = partition_sizze_203577;
    ctx_param_ext_217865 = n_203490;
    ctx_param_ext_217866 = (int64_t) 0;
    ctx_param_ext_217867 = n_203490;
    ctx_param_ext_217868 = partition_sizze_203577;
    ctx_param_ext_217869 = (int64_t) 1;
    ctx_param_ext_217870 = n_203490;
    if (memblock_set(ctx, &mem_param_217855, &mem_217843, "mem_217843") != 0)
        return 1;
    if (memblock_set(ctx, &mem_param_217863, &mem_217843, "mem_217843") != 0)
        return 1;
    if (memblock_set(ctx, &mem_param_217871, &mem_217847, "mem_217847") != 0)
        return 1;
    for (int64_t i_outer_204192 = 0; i_outer_204192 < n_outer_203503;
         i_outer_204192++) {
        int64_t ext_220637;
        int64_t ext_220635;
        struct memblock ext_mem_220631;
        
        ext_mem_220631.references = NULL;
        
        struct memblock ext_mem_220630;
        
        ext_mem_220630.references = NULL;
        
        struct memblock mem_param_217885;
        
        mem_param_217885.references = NULL;
        
        int64_t ctx_param_ext_217887;
        int64_t ctx_param_ext_217889;
        struct memblock mem_param_217893;
        
        mem_param_217893.references = NULL;
        ctx_param_ext_217887 = ctx_param_ext_217857;
        ctx_param_ext_217889 = ctx_param_ext_217859;
        if (memblock_set(ctx, &mem_param_217885, &mem_param_217855,
                         "mem_param_217855") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_217893, &mem_param_217863,
                         "mem_param_217863") != 0)
            return 1;
        for (int64_t _i_inner_204198 = 0; _i_inner_204198 < n_inner_203502;
             _i_inner_204198++) {
            int64_t flat_tid_207686 = (int64_t) 0;
            int32_t num_tasks_222755;
            int64_t flat_tid_207692 = (int64_t) 0;
            struct futhark_mc_task_235618 futhark_mc_task_235618;
            
            futhark_mc_task_235618.ctx = ctx;
            futhark_mc_task_235618.free_n_203490 = n_203490;
            futhark_mc_task_235618.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_235618.free_mem_217297 = mem_217297;
            futhark_mc_task_235618.free_bytes_217302 = bytes_217302;
            futhark_mc_task_235618.free_ctx_param_ext_217889 =
                ctx_param_ext_217889;
            futhark_mc_task_235618.free_mem_param_217893 = mem_param_217893.mem;
            futhark_mc_task_235618.free_mem_217915 = mem_217915;
            
            struct scheduler_segop futhark_mc_task_235618_task;
            
            futhark_mc_task_235618_task.args = &futhark_mc_task_235618;
            futhark_mc_task_235618_task.top_level_fn =
                futhark_mc_segmap_task_235619;
            futhark_mc_task_235618_task.name = "futhark_mc_segmap_task_235619";
            futhark_mc_task_235618_task.iterations = partition_sizze_203577;
            futhark_mc_task_235618_task.task_time =
                &ctx->futhark_mc_segmap_task_235619_total_time;
            futhark_mc_task_235618_task.task_iter =
                &ctx->futhark_mc_segmap_task_235619_total_iter;
            futhark_mc_task_235618_task.sched = STATIC;
            futhark_mc_task_235618_task.nested_fn =
                futhark_mc_segmap_nested_task_235623;
            
            int futhark_mc_segmap_task_235619_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235618_task);
            
            if (futhark_mc_segmap_task_235619_err != 0) {
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_207702 = (int64_t) 0;
            int32_t num_tasks_222778;
            int64_t flat_tid_207736 = (int64_t) 0;
            struct futhark_mc_task_235631 futhark_mc_task_235631;
            
            futhark_mc_task_235631.ctx = ctx;
            futhark_mc_task_235631.free_n_203490 = n_203490;
            futhark_mc_task_235631.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235631.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_235631.free_defunc_0_f_res_203631 =
                defunc_0_f_res_203631;
            futhark_mc_task_235631.free_i_203670 = i_203670;
            futhark_mc_task_235631.free_bytes_217345 = bytes_217345;
            futhark_mc_task_235631.free_bytes_217364 = bytes_217364;
            futhark_mc_task_235631.free_mem_217536 = mem_217536;
            futhark_mc_task_235631.free_ctx_param_ext_217866 =
                ctx_param_ext_217866;
            futhark_mc_task_235631.free_ctx_param_ext_217867 =
                ctx_param_ext_217867;
            futhark_mc_task_235631.free_ctx_param_ext_217869 =
                ctx_param_ext_217869;
            futhark_mc_task_235631.free_mem_param_217871 = mem_param_217871.mem;
            futhark_mc_task_235631.free_mem_217915 = mem_217915;
            futhark_mc_task_235631.free_mem_218052 = mem_218052;
            futhark_mc_task_235631.free_mem_218057 = mem_218057;
            
            struct scheduler_segop futhark_mc_task_235631_task;
            
            futhark_mc_task_235631_task.args = &futhark_mc_task_235631;
            futhark_mc_task_235631_task.top_level_fn =
                futhark_mc_segmap_task_235632;
            futhark_mc_task_235631_task.name = "futhark_mc_segmap_task_235632";
            futhark_mc_task_235631_task.iterations = partition_sizze_203577;
            futhark_mc_task_235631_task.task_time =
                &ctx->futhark_mc_segmap_task_235632_total_time;
            futhark_mc_task_235631_task.task_iter =
                &ctx->futhark_mc_segmap_task_235632_total_iter;
            futhark_mc_task_235631_task.sched = STATIC;
            futhark_mc_task_235631_task.nested_fn =
                futhark_mc_segmap_nested_task_235637;
            
            int futhark_mc_segmap_task_235632_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235631_task);
            
            if (futhark_mc_segmap_task_235632_err != 0) {
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock ext_mem_219123;
            
            ext_mem_219123.references = NULL;
            
            struct memblock ext_mem_219122;
            
            ext_mem_219122.references = NULL;
            if (cond_204170) {
                bool match_lit_204240 = (int64_t) 0 == d_s_203496;
                struct memblock ext_mem_218421;
                
                ext_mem_218421.references = NULL;
                
                struct memblock ext_mem_218420;
                
                ext_mem_218420.references = NULL;
                if (match_lit_204240) {
                    struct memblock mem_218062;
                    
                    mem_218062.references = NULL;
                    if (memblock_alloc(ctx, &mem_218062, bytes_217709,
                                       "mem_218062")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_222926 = 0; i_222926 <
                         partition_sizze_203577; i_222926++) {
                        for (int64_t i_222927 = 0; i_222927 < n_p_203492;
                             i_222927++) {
                            for (int64_t i_222928 = 0; i_222928 < s_n_m_203636;
                                 i_222928++) {
                                ((double *) mem_218062.mem)[i_222926 *
                                                            (s_n_m_203636 *
                                                             n_p_203492) +
                                                            i_222927 *
                                                            s_n_m_203636 +
                                                            i_222928] = 0.0;
                            }
                        }
                    }
                    
                    struct memblock mem_218133;
                    
                    mem_218133.references = NULL;
                    if (memblock_alloc(ctx, &mem_218133, bytes_217709,
                                       "mem_218133")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_207789 = (int64_t) 0;
                    int32_t num_tasks_222929;
                    int64_t flat_tid_208050 = (int64_t) 0;
                    struct futhark_mc_task_235657 futhark_mc_task_235657;
                    
                    futhark_mc_task_235657.ctx = ctx;
                    futhark_mc_task_235657.free_n_p_203492 = n_p_203492;
                    futhark_mc_task_235657.free_q_s_203493 = q_s_203493;
                    futhark_mc_task_235657.free_jump_s_203499 = jump_s_203499;
                    futhark_mc_task_235657.free_partition_sizze_203577 =
                        partition_sizze_203577;
                    futhark_mc_task_235657.free_defunc_0_f_res_203631 =
                        defunc_0_f_res_203631;
                    futhark_mc_task_235657.free_pad_css_len_203632 =
                        pad_css_len_203632;
                    futhark_mc_task_235657.free_s_n_m_203636 = s_n_m_203636;
                    futhark_mc_task_235657.free_mem_217536 = mem_217536;
                    futhark_mc_task_235657.free_mem_217540 = mem_217540;
                    futhark_mc_task_235657.free_bytes_217545 = bytes_217545;
                    futhark_mc_task_235657.free_bytes_217597 = bytes_217597;
                    futhark_mc_task_235657.free_mem_217710 = mem_217710;
                    futhark_mc_task_235657.free_mem_217715 = mem_217715;
                    futhark_mc_task_235657.free_mem_218052 = mem_218052;
                    futhark_mc_task_235657.free_mem_218057 = mem_218057;
                    futhark_mc_task_235657.free_mem_218133 = mem_218133.mem;
                    
                    struct scheduler_segop futhark_mc_task_235657_task;
                    
                    futhark_mc_task_235657_task.args = &futhark_mc_task_235657;
                    futhark_mc_task_235657_task.top_level_fn =
                        futhark_mc_segmap_task_235658;
                    futhark_mc_task_235657_task.name =
                        "futhark_mc_segmap_task_235658";
                    futhark_mc_task_235657_task.iterations =
                        partition_sizze_203577;
                    futhark_mc_task_235657_task.task_time =
                        &ctx->futhark_mc_segmap_task_235658_total_time;
                    futhark_mc_task_235657_task.task_iter =
                        &ctx->futhark_mc_segmap_task_235658_total_iter;
                    futhark_mc_task_235657_task.sched = STATIC;
                    futhark_mc_task_235657_task.nested_fn =
                        futhark_mc_segmap_nested_task_235662;
                    
                    int futhark_mc_segmap_task_235658_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_235657_task);
                    
                    if (futhark_mc_segmap_task_235658_err != 0) {
                        if (memblock_unref(ctx, &mem_218133, "mem_218133") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218062, "mem_218062") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_218420,
                                           "ext_mem_218420") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_218421,
                                           "ext_mem_218421") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219122,
                                           "ext_mem_219122") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219123,
                                           "ext_mem_219123") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217893,
                                           "mem_param_217893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217885,
                                           "mem_param_217885") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220630,
                                           "ext_mem_220630") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220631,
                                           "ext_mem_220631") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217871,
                                           "mem_param_217871") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217863,
                                           "mem_param_217863") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217855,
                                           "mem_param_217855") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220875,
                                           "ext_mem_220875") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220876,
                                           "ext_mem_220876") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220877,
                                           "ext_mem_220877") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221032,
                                           "mem_out_221032") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221031,
                                           "mem_out_221031") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221030,
                                           "mem_out_221030") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_218421, &mem_218133,
                                     "mem_218133") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_218420, &mem_218062,
                                     "mem_218062") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218133, "mem_218133") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218062, "mem_218062") != 0)
                        return 1;
                } else {
                    bool match_lit_204336 = (int64_t) 1 == d_s_203496;
                    struct memblock ext_mem_218419;
                    
                    ext_mem_218419.references = NULL;
                    
                    struct memblock ext_mem_218418;
                    
                    ext_mem_218418.references = NULL;
                    if (match_lit_204336) {
                        struct memblock mem_218270;
                        
                        mem_218270.references = NULL;
                        if (memblock_alloc(ctx, &mem_218270, bytes_217709,
                                           "mem_218270")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_218275;
                        
                        mem_218275.references = NULL;
                        if (memblock_alloc(ctx, &mem_218275, bytes_217709,
                                           "mem_218275")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_208307 = (int64_t) 0;
                        int32_t num_tasks_223644;
                        int64_t flat_tid_208653 = (int64_t) 0;
                        struct futhark_mc_task_235692 futhark_mc_task_235692;
                        
                        futhark_mc_task_235692.ctx = ctx;
                        futhark_mc_task_235692.free_n_p_203492 = n_p_203492;
                        futhark_mc_task_235692.free_q_s_203493 = q_s_203493;
                        futhark_mc_task_235692.free_jump_s_203499 =
                            jump_s_203499;
                        futhark_mc_task_235692.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_235692.free_defunc_0_f_res_203631 =
                            defunc_0_f_res_203631;
                        futhark_mc_task_235692.free_pad_css_len_203632 =
                            pad_css_len_203632;
                        futhark_mc_task_235692.free_s_n_m_203636 = s_n_m_203636;
                        futhark_mc_task_235692.free_mem_217536 = mem_217536;
                        futhark_mc_task_235692.free_mem_217540 = mem_217540;
                        futhark_mc_task_235692.free_bytes_217545 = bytes_217545;
                        futhark_mc_task_235692.free_bytes_217597 = bytes_217597;
                        futhark_mc_task_235692.free_mem_217710 = mem_217710;
                        futhark_mc_task_235692.free_mem_217715 = mem_217715;
                        futhark_mc_task_235692.free_mem_218052 = mem_218052;
                        futhark_mc_task_235692.free_mem_218057 = mem_218057;
                        futhark_mc_task_235692.free_mem_218270 = mem_218270.mem;
                        futhark_mc_task_235692.free_mem_218275 = mem_218275.mem;
                        
                        struct scheduler_segop futhark_mc_task_235692_task;
                        
                        futhark_mc_task_235692_task.args =
                            &futhark_mc_task_235692;
                        futhark_mc_task_235692_task.top_level_fn =
                            futhark_mc_segmap_task_235693;
                        futhark_mc_task_235692_task.name =
                            "futhark_mc_segmap_task_235693";
                        futhark_mc_task_235692_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_235692_task.task_time =
                            &ctx->futhark_mc_segmap_task_235693_total_time;
                        futhark_mc_task_235692_task.task_iter =
                            &ctx->futhark_mc_segmap_task_235693_total_iter;
                        futhark_mc_task_235692_task.sched = STATIC;
                        futhark_mc_task_235692_task.nested_fn =
                            futhark_mc_segmap_nested_task_235698;
                        
                        int futhark_mc_segmap_task_235693_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_235692_task);
                        
                        if (futhark_mc_segmap_task_235693_err != 0) {
                            if (memblock_unref(ctx, &mem_218275,
                                               "mem_218275") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_218270,
                                               "mem_218270") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218418,
                                               "ext_mem_218418") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218419,
                                               "ext_mem_218419") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218420,
                                               "ext_mem_218420") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218421,
                                               "ext_mem_218421") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_218419, &mem_218270,
                                         "mem_218270") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_218418, &mem_218275,
                                         "mem_218275") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218275, "mem_218275") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218270, "mem_218270") != 0)
                            return 1;
                    } else {
                        struct memblock mem_218412;
                        
                        mem_218412.references = NULL;
                        if (memblock_alloc(ctx, &mem_218412, bytes_217709,
                                           "mem_218412")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_218417;
                        
                        mem_218417.references = NULL;
                        if (memblock_alloc(ctx, &mem_218417, bytes_217709,
                                           "mem_218417")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_208997 = (int64_t) 0;
                        int32_t num_tasks_224616;
                        int64_t flat_tid_209439 = (int64_t) 0;
                        struct futhark_mc_task_235734 futhark_mc_task_235734;
                        
                        futhark_mc_task_235734.ctx = ctx;
                        futhark_mc_task_235734.free_n_p_203492 = n_p_203492;
                        futhark_mc_task_235734.free_q_s_203493 = q_s_203493;
                        futhark_mc_task_235734.free_jump_s_203499 =
                            jump_s_203499;
                        futhark_mc_task_235734.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_235734.free_defunc_0_f_res_203631 =
                            defunc_0_f_res_203631;
                        futhark_mc_task_235734.free_pad_css_len_203632 =
                            pad_css_len_203632;
                        futhark_mc_task_235734.free_s_n_m_203636 = s_n_m_203636;
                        futhark_mc_task_235734.free_mem_217536 = mem_217536;
                        futhark_mc_task_235734.free_mem_217540 = mem_217540;
                        futhark_mc_task_235734.free_bytes_217545 = bytes_217545;
                        futhark_mc_task_235734.free_bytes_217597 = bytes_217597;
                        futhark_mc_task_235734.free_mem_217710 = mem_217710;
                        futhark_mc_task_235734.free_mem_217715 = mem_217715;
                        futhark_mc_task_235734.free_mem_218052 = mem_218052;
                        futhark_mc_task_235734.free_mem_218057 = mem_218057;
                        futhark_mc_task_235734.free_mem_218412 = mem_218412.mem;
                        futhark_mc_task_235734.free_mem_218417 = mem_218417.mem;
                        
                        struct scheduler_segop futhark_mc_task_235734_task;
                        
                        futhark_mc_task_235734_task.args =
                            &futhark_mc_task_235734;
                        futhark_mc_task_235734_task.top_level_fn =
                            futhark_mc_segmap_task_235735;
                        futhark_mc_task_235734_task.name =
                            "futhark_mc_segmap_task_235735";
                        futhark_mc_task_235734_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_235734_task.task_time =
                            &ctx->futhark_mc_segmap_task_235735_total_time;
                        futhark_mc_task_235734_task.task_iter =
                            &ctx->futhark_mc_segmap_task_235735_total_iter;
                        futhark_mc_task_235734_task.sched = STATIC;
                        futhark_mc_task_235734_task.nested_fn =
                            futhark_mc_segmap_nested_task_235740;
                        
                        int futhark_mc_segmap_task_235735_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_235734_task);
                        
                        if (futhark_mc_segmap_task_235735_err != 0) {
                            if (memblock_unref(ctx, &mem_218417,
                                               "mem_218417") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_218412,
                                               "mem_218412") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218418,
                                               "ext_mem_218418") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218419,
                                               "ext_mem_218419") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218420,
                                               "ext_mem_218420") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218421,
                                               "ext_mem_218421") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_218419, &mem_218412,
                                         "mem_218412") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_218418, &mem_218417,
                                         "mem_218417") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218417, "mem_218417") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218412, "mem_218412") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_218421, &ext_mem_218419,
                                     "ext_mem_218419") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_218420, &ext_mem_218418,
                                     "ext_mem_218418") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_218418,
                                       "ext_mem_218418") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_218419,
                                       "ext_mem_218419") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219123, &ext_mem_218421,
                                 "ext_mem_218421") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219122, &ext_mem_218420,
                                 "ext_mem_218420") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_218420, "ext_mem_218420") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_218421, "ext_mem_218421") != 0)
                    return 1;
            } else {
                bool match_lit_204617 = (int64_t) 0 == d_s_203496;
                struct memblock ext_mem_219121;
                
                ext_mem_219121.references = NULL;
                
                struct memblock ext_mem_219120;
                
                ext_mem_219120.references = NULL;
                if (match_lit_204617) {
                    struct memblock mem_218426;
                    
                    mem_218426.references = NULL;
                    if (memblock_alloc(ctx, &mem_218426, bytes_217709,
                                       "mem_218426")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_225844 = 0; i_225844 <
                         partition_sizze_203577; i_225844++) {
                        for (int64_t i_225845 = 0; i_225845 < n_p_203492;
                             i_225845++) {
                            for (int64_t i_225846 = 0; i_225846 < s_n_m_203636;
                                 i_225846++) {
                                ((double *) mem_218426.mem)[i_225844 *
                                                            (s_n_m_203636 *
                                                             n_p_203492) +
                                                            i_225845 *
                                                            s_n_m_203636 +
                                                            i_225846] = 0.0;
                            }
                        }
                    }
                    
                    struct memblock mem_218545;
                    
                    mem_218545.references = NULL;
                    if (memblock_alloc(ctx, &mem_218545, bytes_217709,
                                       "mem_218545")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_218427 = (int64_t) 8 * q_s_203493;
                    int64_t bytes_218428 = smax64((int64_t) 0, binop_y_218427);
                    int64_t flat_tid_209879 = (int64_t) 0;
                    int32_t num_tasks_225847;
                    int64_t flat_tid_210068 = (int64_t) 0;
                    struct futhark_mc_task_235778 futhark_mc_task_235778;
                    
                    futhark_mc_task_235778.ctx = ctx;
                    futhark_mc_task_235778.free_n_p_203492 = n_p_203492;
                    futhark_mc_task_235778.free_q_s_203493 = q_s_203493;
                    futhark_mc_task_235778.free_jump_s_203499 = jump_s_203499;
                    futhark_mc_task_235778.free_partition_sizze_203577 =
                        partition_sizze_203577;
                    futhark_mc_task_235778.free_defunc_0_f_res_203631 =
                        defunc_0_f_res_203631;
                    futhark_mc_task_235778.free_pad_css_len_203632 =
                        pad_css_len_203632;
                    futhark_mc_task_235778.free_s_n_m_203636 = s_n_m_203636;
                    futhark_mc_task_235778.free_mem_217536 = mem_217536;
                    futhark_mc_task_235778.free_mem_217540 = mem_217540;
                    futhark_mc_task_235778.free_bytes_217545 = bytes_217545;
                    futhark_mc_task_235778.free_bytes_217597 = bytes_217597;
                    futhark_mc_task_235778.free_mem_217710 = mem_217710;
                    futhark_mc_task_235778.free_mem_217715 = mem_217715;
                    futhark_mc_task_235778.free_mem_218052 = mem_218052;
                    futhark_mc_task_235778.free_mem_218057 = mem_218057;
                    futhark_mc_task_235778.free_bytes_218428 = bytes_218428;
                    futhark_mc_task_235778.free_mem_218545 = mem_218545.mem;
                    
                    struct scheduler_segop futhark_mc_task_235778_task;
                    
                    futhark_mc_task_235778_task.args = &futhark_mc_task_235778;
                    futhark_mc_task_235778_task.top_level_fn =
                        futhark_mc_segmap_task_235779;
                    futhark_mc_task_235778_task.name =
                        "futhark_mc_segmap_task_235779";
                    futhark_mc_task_235778_task.iterations =
                        partition_sizze_203577;
                    futhark_mc_task_235778_task.task_time =
                        &ctx->futhark_mc_segmap_task_235779_total_time;
                    futhark_mc_task_235778_task.task_iter =
                        &ctx->futhark_mc_segmap_task_235779_total_iter;
                    futhark_mc_task_235778_task.sched = STATIC;
                    futhark_mc_task_235778_task.nested_fn =
                        futhark_mc_segmap_nested_task_235784;
                    
                    int futhark_mc_segmap_task_235779_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_235778_task);
                    
                    if (futhark_mc_segmap_task_235779_err != 0) {
                        if (memblock_unref(ctx, &mem_218545, "mem_218545") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218426, "mem_218426") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219120,
                                           "ext_mem_219120") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219121,
                                           "ext_mem_219121") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219122,
                                           "ext_mem_219122") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219123,
                                           "ext_mem_219123") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217893,
                                           "mem_param_217893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217885,
                                           "mem_param_217885") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220630,
                                           "ext_mem_220630") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220631,
                                           "ext_mem_220631") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217871,
                                           "mem_param_217871") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217863,
                                           "mem_param_217863") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217855,
                                           "mem_param_217855") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220875,
                                           "ext_mem_220875") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220876,
                                           "ext_mem_220876") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220877,
                                           "ext_mem_220877") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221032,
                                           "mem_out_221032") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221031,
                                           "mem_out_221031") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221030,
                                           "mem_out_221030") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_219121, &mem_218545,
                                     "mem_218545") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219120, &mem_218426,
                                     "mem_218426") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218545, "mem_218545") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218426, "mem_218426") != 0)
                        return 1;
                } else {
                    bool match_lit_204689 = (int64_t) 1 == d_s_203496;
                    struct memblock ext_mem_219119;
                    
                    ext_mem_219119.references = NULL;
                    
                    struct memblock ext_mem_219118;
                    
                    ext_mem_219118.references = NULL;
                    if (match_lit_204689) {
                        struct memblock mem_218778;
                        
                        mem_218778.references = NULL;
                        if (memblock_alloc(ctx, &mem_218778, bytes_217709,
                                           "mem_218778")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_218783;
                        
                        mem_218783.references = NULL;
                        if (memblock_alloc(ctx, &mem_218783, bytes_217709,
                                           "mem_218783")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_218546 = (int64_t) 8 * q_s_203493;
                        int64_t bytes_218547 = smax64((int64_t) 0,
                                                      binop_y_218546);
                        int64_t flat_tid_210253 = (int64_t) 0;
                        int32_t num_tasks_226371;
                        int64_t flat_tid_210530 = (int64_t) 0;
                        struct futhark_mc_task_235817 futhark_mc_task_235817;
                        
                        futhark_mc_task_235817.ctx = ctx;
                        futhark_mc_task_235817.free_n_p_203492 = n_p_203492;
                        futhark_mc_task_235817.free_q_s_203493 = q_s_203493;
                        futhark_mc_task_235817.free_jump_s_203499 =
                            jump_s_203499;
                        futhark_mc_task_235817.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_235817.free_defunc_0_f_res_203631 =
                            defunc_0_f_res_203631;
                        futhark_mc_task_235817.free_pad_css_len_203632 =
                            pad_css_len_203632;
                        futhark_mc_task_235817.free_s_n_m_203636 = s_n_m_203636;
                        futhark_mc_task_235817.free_mem_217536 = mem_217536;
                        futhark_mc_task_235817.free_mem_217540 = mem_217540;
                        futhark_mc_task_235817.free_bytes_217545 = bytes_217545;
                        futhark_mc_task_235817.free_bytes_217597 = bytes_217597;
                        futhark_mc_task_235817.free_mem_217710 = mem_217710;
                        futhark_mc_task_235817.free_mem_217715 = mem_217715;
                        futhark_mc_task_235817.free_mem_218052 = mem_218052;
                        futhark_mc_task_235817.free_mem_218057 = mem_218057;
                        futhark_mc_task_235817.free_bytes_218547 = bytes_218547;
                        futhark_mc_task_235817.free_mem_218778 = mem_218778.mem;
                        futhark_mc_task_235817.free_mem_218783 = mem_218783.mem;
                        
                        struct scheduler_segop futhark_mc_task_235817_task;
                        
                        futhark_mc_task_235817_task.args =
                            &futhark_mc_task_235817;
                        futhark_mc_task_235817_task.top_level_fn =
                            futhark_mc_segmap_task_235818;
                        futhark_mc_task_235817_task.name =
                            "futhark_mc_segmap_task_235818";
                        futhark_mc_task_235817_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_235817_task.task_time =
                            &ctx->futhark_mc_segmap_task_235818_total_time;
                        futhark_mc_task_235817_task.task_iter =
                            &ctx->futhark_mc_segmap_task_235818_total_iter;
                        futhark_mc_task_235817_task.sched = STATIC;
                        futhark_mc_task_235817_task.nested_fn =
                            futhark_mc_segmap_nested_task_235825;
                        
                        int futhark_mc_segmap_task_235818_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_235817_task);
                        
                        if (futhark_mc_segmap_task_235818_err != 0) {
                            if (memblock_unref(ctx, &mem_218783,
                                               "mem_218783") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_218778,
                                               "mem_218778") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219118,
                                               "ext_mem_219118") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219119,
                                               "ext_mem_219119") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219120,
                                               "ext_mem_219120") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219121,
                                               "ext_mem_219121") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219119, &mem_218778,
                                         "mem_218778") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219118, &mem_218783,
                                         "mem_218783") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218783, "mem_218783") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218778, "mem_218778") != 0)
                            return 1;
                    } else {
                        struct memblock mem_219112;
                        
                        mem_219112.references = NULL;
                        if (memblock_alloc(ctx, &mem_219112, bytes_217709,
                                           "mem_219112")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219117;
                        
                        mem_219117.references = NULL;
                        if (memblock_alloc(ctx, &mem_219117, bytes_217709,
                                           "mem_219117")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_218784 = (int64_t) 8 * q_s_203493;
                        int64_t bytes_218785 = smax64((int64_t) 0,
                                                      binop_y_218784);
                        int64_t flat_tid_210805 = (int64_t) 0;
                        int32_t num_tasks_227184;
                        int64_t flat_tid_211196 = (int64_t) 0;
                        struct futhark_mc_task_235867 futhark_mc_task_235867;
                        
                        futhark_mc_task_235867.ctx = ctx;
                        futhark_mc_task_235867.free_n_p_203492 = n_p_203492;
                        futhark_mc_task_235867.free_q_s_203493 = q_s_203493;
                        futhark_mc_task_235867.free_jump_s_203499 =
                            jump_s_203499;
                        futhark_mc_task_235867.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_235867.free_defunc_0_f_res_203631 =
                            defunc_0_f_res_203631;
                        futhark_mc_task_235867.free_pad_css_len_203632 =
                            pad_css_len_203632;
                        futhark_mc_task_235867.free_s_n_m_203636 = s_n_m_203636;
                        futhark_mc_task_235867.free_mem_217536 = mem_217536;
                        futhark_mc_task_235867.free_mem_217540 = mem_217540;
                        futhark_mc_task_235867.free_bytes_217545 = bytes_217545;
                        futhark_mc_task_235867.free_bytes_217597 = bytes_217597;
                        futhark_mc_task_235867.free_mem_217710 = mem_217710;
                        futhark_mc_task_235867.free_mem_217715 = mem_217715;
                        futhark_mc_task_235867.free_mem_218052 = mem_218052;
                        futhark_mc_task_235867.free_mem_218057 = mem_218057;
                        futhark_mc_task_235867.free_bytes_218785 = bytes_218785;
                        futhark_mc_task_235867.free_mem_219112 = mem_219112.mem;
                        futhark_mc_task_235867.free_mem_219117 = mem_219117.mem;
                        
                        struct scheduler_segop futhark_mc_task_235867_task;
                        
                        futhark_mc_task_235867_task.args =
                            &futhark_mc_task_235867;
                        futhark_mc_task_235867_task.top_level_fn =
                            futhark_mc_segmap_task_235868;
                        futhark_mc_task_235867_task.name =
                            "futhark_mc_segmap_task_235868";
                        futhark_mc_task_235867_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_235867_task.task_time =
                            &ctx->futhark_mc_segmap_task_235868_total_time;
                        futhark_mc_task_235867_task.task_iter =
                            &ctx->futhark_mc_segmap_task_235868_total_iter;
                        futhark_mc_task_235867_task.sched = STATIC;
                        futhark_mc_task_235867_task.nested_fn =
                            futhark_mc_segmap_nested_task_235877;
                        
                        int futhark_mc_segmap_task_235868_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_235867_task);
                        
                        if (futhark_mc_segmap_task_235868_err != 0) {
                            if (memblock_unref(ctx, &mem_219117,
                                               "mem_219117") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219112,
                                               "mem_219112") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219118,
                                               "ext_mem_219118") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219119,
                                               "ext_mem_219119") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219120,
                                               "ext_mem_219120") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219121,
                                               "ext_mem_219121") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219119, &mem_219112,
                                         "mem_219112") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219118, &mem_219117,
                                         "mem_219117") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219117, "mem_219117") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219112, "mem_219112") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_219121, &ext_mem_219119,
                                     "ext_mem_219119") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219120, &ext_mem_219118,
                                     "ext_mem_219118") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219118,
                                       "ext_mem_219118") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219119,
                                       "ext_mem_219119") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219123, &ext_mem_219121,
                                 "ext_mem_219121") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219122, &ext_mem_219120,
                                 "ext_mem_219120") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219120, "ext_mem_219120") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219121, "ext_mem_219121") != 0)
                    return 1;
            }
            
            struct memblock ext_mem_219195;
            
            ext_mem_219195.references = NULL;
            if (cond_203635) {
                if (memblock_set(ctx, &ext_mem_219195, &ext_mem_219123,
                                 "ext_mem_219123") != 0)
                    return 1;
            } else {
                bool bounds_invalid_upwards_204971 = slt64(pad_css_len_203632,
                                                           (int64_t) 0);
                bool valid_204972 = !bounds_invalid_upwards_204971;
                bool range_valid_c_204973;
                
                if (!valid_204972) {
                    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) pad_css_len_203632,
                                  " 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:557:3-566:9\n   #4  stl.fut:220:31-96\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:219:23-221:48\n   #8  /prelude/soacs.fut:67:19-23\n   #9  /prelude/soacs.fut:67:3-37\n   #10 stl.fut:218:15-222:44\n   #11 stl.fut:415:61-429:75\n   #12 stl.fut:455:3-469:34\n   #13 stl.fut:439:1-469:34\n");
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock mem_219194;
                
                mem_219194.references = NULL;
                if (memblock_alloc(ctx, &mem_219194, bytes_219193,
                                   "mem_219194")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t binop_x_219142 = n_p_203492 * pad_css_len_203632;
                int64_t binop_y_219143 = (int64_t) 8 * binop_x_219142;
                int64_t bytes_219144 = smax64((int64_t) 0, binop_y_219143);
                int64_t binop_y_219124 = (int64_t) 8 * pad_css_len_203632;
                int64_t bytes_219125 = smax64((int64_t) 0, binop_y_219124);
                int64_t flat_tid_211581 = (int64_t) 0;
                int32_t num_tasks_228356;
                int64_t flat_tid_211678 = (int64_t) 0;
                struct futhark_mc_task_235931 futhark_mc_task_235931;
                
                futhark_mc_task_235931.ctx = ctx;
                futhark_mc_task_235931.free_n_p_203492 = n_p_203492;
                futhark_mc_task_235931.free_jump_s_203499 = jump_s_203499;
                futhark_mc_task_235931.free_partition_sizze_203577 =
                    partition_sizze_203577;
                futhark_mc_task_235931.free_defunc_0_f_res_203631 =
                    defunc_0_f_res_203631;
                futhark_mc_task_235931.free_pad_css_len_203632 =
                    pad_css_len_203632;
                futhark_mc_task_235931.free_s_n_m_203636 = s_n_m_203636;
                futhark_mc_task_235931.free_ext_mem_219122 = ext_mem_219122.mem;
                futhark_mc_task_235931.free_ext_mem_219123 = ext_mem_219123.mem;
                futhark_mc_task_235931.free_bytes_219125 = bytes_219125;
                futhark_mc_task_235931.free_bytes_219144 = bytes_219144;
                futhark_mc_task_235931.free_mem_219194 = mem_219194.mem;
                
                struct scheduler_segop futhark_mc_task_235931_task;
                
                futhark_mc_task_235931_task.args = &futhark_mc_task_235931;
                futhark_mc_task_235931_task.top_level_fn =
                    futhark_mc_segmap_task_235932;
                futhark_mc_task_235931_task.name =
                    "futhark_mc_segmap_task_235932";
                futhark_mc_task_235931_task.iterations = partition_sizze_203577;
                futhark_mc_task_235931_task.task_time =
                    &ctx->futhark_mc_segmap_task_235932_total_time;
                futhark_mc_task_235931_task.task_iter =
                    &ctx->futhark_mc_segmap_task_235932_total_iter;
                futhark_mc_task_235931_task.sched = STATIC;
                futhark_mc_task_235931_task.nested_fn =
                    futhark_mc_segmap_nested_task_235936;
                
                int futhark_mc_segmap_task_235932_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_235931_task);
                
                if (futhark_mc_segmap_task_235932_err != 0) {
                    if (memblock_unref(ctx, &mem_219194, "mem_219194") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_219195, &mem_219194,
                                 "mem_219194") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_219194, "mem_219194") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                return 1;
            
            int64_t flat_tid_211855 = (int64_t) 0;
            int32_t num_tasks_228874;
            int64_t flat_tid_211861 = (int64_t) 0;
            struct futhark_mc_task_235953 futhark_mc_task_235953;
            
            futhark_mc_task_235953.ctx = ctx;
            futhark_mc_task_235953.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235953.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_235953.free_C_len_203634 = C_len_203634;
            futhark_mc_task_235953.free_css_results_l_204110 =
                css_results_l_204110;
            futhark_mc_task_235953.free_ext_mem_219195 = ext_mem_219195.mem;
            futhark_mc_task_235953.free_bytes_219198 = bytes_219198;
            futhark_mc_task_235953.free_mem_219218 = mem_219218;
            
            struct scheduler_segop futhark_mc_task_235953_task;
            
            futhark_mc_task_235953_task.args = &futhark_mc_task_235953;
            futhark_mc_task_235953_task.top_level_fn =
                futhark_mc_segmap_task_235954;
            futhark_mc_task_235953_task.name = "futhark_mc_segmap_task_235954";
            futhark_mc_task_235953_task.iterations = partition_sizze_203577;
            futhark_mc_task_235953_task.task_time =
                &ctx->futhark_mc_segmap_task_235954_total_time;
            futhark_mc_task_235953_task.task_iter =
                &ctx->futhark_mc_segmap_task_235954_total_iter;
            futhark_mc_task_235953_task.sched = STATIC;
            futhark_mc_task_235953_task.nested_fn =
                futhark_mc_segmap_nested_task_235958;
            
            int futhark_mc_segmap_task_235954_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235953_task);
            
            if (futhark_mc_segmap_task_235954_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                return 1;
            
            int64_t flat_tid_211879 = (int64_t) 0;
            int32_t num_tasks_228913;
            int64_t flat_tid_211885 = (int64_t) 0;
            struct futhark_mc_task_235966 futhark_mc_task_235966;
            
            futhark_mc_task_235966.ctx = ctx;
            futhark_mc_task_235966.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235966.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_235966.free_C_len_203634 = C_len_203634;
            futhark_mc_task_235966.free_mem_219218 = mem_219218;
            futhark_mc_task_235966.free_mem_219221 = mem_219221;
            
            struct scheduler_segop futhark_mc_task_235966_task;
            
            futhark_mc_task_235966_task.args = &futhark_mc_task_235966;
            futhark_mc_task_235966_task.top_level_fn =
                futhark_mc_segmap_task_235967;
            futhark_mc_task_235966_task.name = "futhark_mc_segmap_task_235967";
            futhark_mc_task_235966_task.iterations = partition_sizze_203577;
            futhark_mc_task_235966_task.task_time =
                &ctx->futhark_mc_segmap_task_235967_total_time;
            futhark_mc_task_235966_task.task_iter =
                &ctx->futhark_mc_segmap_task_235967_total_iter;
            futhark_mc_task_235966_task.sched = STATIC;
            futhark_mc_task_235966_task.nested_fn =
                futhark_mc_segmap_nested_task_235970;
            
            int futhark_mc_segmap_task_235967_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235966_task);
            
            if (futhark_mc_segmap_task_235967_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_211895 = (int64_t) 0;
            int32_t num_tasks_228940;
            int64_t flat_tid_211901 = (int64_t) 0;
            struct futhark_mc_task_235978 futhark_mc_task_235978;
            
            futhark_mc_task_235978.ctx = ctx;
            futhark_mc_task_235978.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235978.free_i64_res_203507 = i64_res_203507;
            futhark_mc_task_235978.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_235978.free_C_len_203634 = C_len_203634;
            futhark_mc_task_235978.free_lifted_single_ma_l_arg_204134 =
                lifted_single_ma_l_arg_204134;
            futhark_mc_task_235978.free_mem_219218 = mem_219218;
            futhark_mc_task_235978.free_mem_219221 = mem_219221;
            futhark_mc_task_235978.free_bytes_219223 = bytes_219223;
            futhark_mc_task_235978.free_mem_219243 = mem_219243;
            
            struct scheduler_segop futhark_mc_task_235978_task;
            
            futhark_mc_task_235978_task.args = &futhark_mc_task_235978;
            futhark_mc_task_235978_task.top_level_fn =
                futhark_mc_segmap_task_235979;
            futhark_mc_task_235978_task.name = "futhark_mc_segmap_task_235979";
            futhark_mc_task_235978_task.iterations = partition_sizze_203577;
            futhark_mc_task_235978_task.task_time =
                &ctx->futhark_mc_segmap_task_235979_total_time;
            futhark_mc_task_235978_task.task_iter =
                &ctx->futhark_mc_segmap_task_235979_total_iter;
            futhark_mc_task_235978_task.sched = STATIC;
            futhark_mc_task_235978_task.nested_fn =
                futhark_mc_segmap_nested_task_235983;
            
            int futhark_mc_segmap_task_235979_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235978_task);
            
            if (futhark_mc_segmap_task_235979_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_211930 = (int64_t) 0;
            int32_t num_tasks_229009;
            int64_t flat_tid_211936 = (int64_t) 0;
            struct futhark_mc_task_235994 futhark_mc_task_235994;
            
            futhark_mc_task_235994.ctx = ctx;
            futhark_mc_task_235994.free_n_p_203492 = n_p_203492;
            futhark_mc_task_235994.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_235994.free_lifted_single_ma_l_arg_204134 =
                lifted_single_ma_l_arg_204134;
            futhark_mc_task_235994.free_mem_219243 = mem_219243;
            futhark_mc_task_235994.free_mem_219246 = mem_219246;
            
            struct scheduler_segop futhark_mc_task_235994_task;
            
            futhark_mc_task_235994_task.args = &futhark_mc_task_235994;
            futhark_mc_task_235994_task.top_level_fn =
                futhark_mc_segmap_task_235995;
            futhark_mc_task_235994_task.name = "futhark_mc_segmap_task_235995";
            futhark_mc_task_235994_task.iterations = partition_sizze_203577;
            futhark_mc_task_235994_task.task_time =
                &ctx->futhark_mc_segmap_task_235995_total_time;
            futhark_mc_task_235994_task.task_iter =
                &ctx->futhark_mc_segmap_task_235995_total_iter;
            futhark_mc_task_235994_task.sched = STATIC;
            futhark_mc_task_235994_task.nested_fn =
                futhark_mc_segmap_nested_task_235998;
            
            int futhark_mc_segmap_task_235995_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235994_task);
            
            if (futhark_mc_segmap_task_235995_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_211946 = (int64_t) 0;
            int32_t num_tasks_229036;
            int64_t flat_tid_211952 = (int64_t) 0;
            struct futhark_mc_task_236006 futhark_mc_task_236006;
            
            futhark_mc_task_236006.ctx = ctx;
            futhark_mc_task_236006.free_n_p_203492 = n_p_203492;
            futhark_mc_task_236006.free_i64_res_203507 = i64_res_203507;
            futhark_mc_task_236006.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236006.free_lifted_single_ma_l_arg_204134 =
                lifted_single_ma_l_arg_204134;
            futhark_mc_task_236006.free_dyn_lifted_single_ma_l_arg_204144 =
                dyn_lifted_single_ma_l_arg_204144;
            futhark_mc_task_236006.free_mem_219243 = mem_219243;
            futhark_mc_task_236006.free_mem_219246 = mem_219246;
            futhark_mc_task_236006.free_bytes_219248 = bytes_219248;
            futhark_mc_task_236006.free_mem_219268 = mem_219268;
            
            struct scheduler_segop futhark_mc_task_236006_task;
            
            futhark_mc_task_236006_task.args = &futhark_mc_task_236006;
            futhark_mc_task_236006_task.top_level_fn =
                futhark_mc_segmap_task_236007;
            futhark_mc_task_236006_task.name = "futhark_mc_segmap_task_236007";
            futhark_mc_task_236006_task.iterations = partition_sizze_203577;
            futhark_mc_task_236006_task.task_time =
                &ctx->futhark_mc_segmap_task_236007_total_time;
            futhark_mc_task_236006_task.task_iter =
                &ctx->futhark_mc_segmap_task_236007_total_iter;
            futhark_mc_task_236006_task.sched = STATIC;
            futhark_mc_task_236006_task.nested_fn =
                futhark_mc_segmap_nested_task_236011;
            
            int futhark_mc_segmap_task_236007_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236006_task);
            
            if (futhark_mc_segmap_task_236007_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_211981 = (int64_t) 0;
            int32_t num_tasks_229105;
            int64_t flat_tid_211987 = (int64_t) 0;
            struct futhark_mc_task_236022 futhark_mc_task_236022;
            
            futhark_mc_task_236022.ctx = ctx;
            futhark_mc_task_236022.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236022.free_dyn_lifted_single_ma_l_arg_204144 =
                dyn_lifted_single_ma_l_arg_204144;
            futhark_mc_task_236022.free_mem_219268 = mem_219268;
            futhark_mc_task_236022.free_mem_219271 = mem_219271;
            
            struct scheduler_segop futhark_mc_task_236022_task;
            
            futhark_mc_task_236022_task.args = &futhark_mc_task_236022;
            futhark_mc_task_236022_task.top_level_fn =
                futhark_mc_segmap_task_236023;
            futhark_mc_task_236022_task.name = "futhark_mc_segmap_task_236023";
            futhark_mc_task_236022_task.iterations = partition_sizze_203577;
            futhark_mc_task_236022_task.task_time =
                &ctx->futhark_mc_segmap_task_236023_total_time;
            futhark_mc_task_236022_task.task_iter =
                &ctx->futhark_mc_segmap_task_236023_total_iter;
            futhark_mc_task_236022_task.sched = STATIC;
            futhark_mc_task_236022_task.nested_fn =
                futhark_mc_segmap_nested_task_236026;
            
            int futhark_mc_segmap_task_236023_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236022_task);
            
            if (futhark_mc_segmap_task_236023_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_211997 = (int64_t) 0;
            int32_t num_tasks_229133;
            int64_t flat_tid_212003 = (int64_t) 0;
            struct futhark_mc_task_236034 futhark_mc_task_236034;
            
            futhark_mc_task_236034.ctx = ctx;
            futhark_mc_task_236034.free_n_203490 = n_203490;
            futhark_mc_task_236034.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236034.free_dyn_lifted_single_ma_l_arg_204144 =
                dyn_lifted_single_ma_l_arg_204144;
            futhark_mc_task_236034.free_bytes_217302 = bytes_217302;
            futhark_mc_task_236034.free_mem_219268 = mem_219268;
            futhark_mc_task_236034.free_mem_219271 = mem_219271;
            futhark_mc_task_236034.free_mem_219293 = mem_219293;
            
            struct scheduler_segop futhark_mc_task_236034_task;
            
            futhark_mc_task_236034_task.args = &futhark_mc_task_236034;
            futhark_mc_task_236034_task.top_level_fn =
                futhark_mc_segmap_task_236035;
            futhark_mc_task_236034_task.name = "futhark_mc_segmap_task_236035";
            futhark_mc_task_236034_task.iterations = partition_sizze_203577;
            futhark_mc_task_236034_task.task_time =
                &ctx->futhark_mc_segmap_task_236035_total_time;
            futhark_mc_task_236034_task.task_iter =
                &ctx->futhark_mc_segmap_task_236035_total_iter;
            futhark_mc_task_236034_task.sched = STATIC;
            futhark_mc_task_236034_task.nested_fn =
                futhark_mc_segmap_nested_task_236039;
            
            int futhark_mc_segmap_task_236035_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236034_task);
            
            if (futhark_mc_segmap_task_236035_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock ext_mem_219762;
            
            ext_mem_219762.references = NULL;
            
            struct memblock ext_mem_219761;
            
            ext_mem_219761.references = NULL;
            if (cond_204160) {
                bool match_lit_205190 = (int64_t) 0 == d_l_203498;
                struct memblock ext_mem_219411;
                
                ext_mem_219411.references = NULL;
                
                struct memblock ext_mem_219410;
                
                ext_mem_219410.references = NULL;
                if (match_lit_205190) {
                    struct memblock mem_219297;
                    
                    mem_219297.references = NULL;
                    if (memblock_alloc(ctx, &mem_219297, bytes_217772,
                                       "mem_219297")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_229202 = 0; i_229202 <
                         partition_sizze_203577; i_229202++) {
                        for (int64_t i_229203 = 0; i_229203 < l_n_m_203643;
                             i_229203++) {
                            ((double *) mem_219297.mem)[i_229202 *
                                                        l_n_m_203643 +
                                                        i_229203] = 0.0;
                        }
                    }
                    
                    struct memblock mem_219319;
                    
                    mem_219319.references = NULL;
                    if (memblock_alloc(ctx, &mem_219319, bytes_217772,
                                       "mem_219319")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_212032 = (int64_t) 0;
                    int32_t num_tasks_229204;
                    int64_t flat_tid_212106 = (int64_t) 0;
                    struct futhark_mc_task_236050 futhark_mc_task_236050;
                    
                    futhark_mc_task_236050.ctx = ctx;
                    futhark_mc_task_236050.free_n_203490 = n_203490;
                    futhark_mc_task_236050.free_q_l_203495 = q_l_203495;
                    futhark_mc_task_236050.free_jump_t_203500 = jump_t_203500;
                    futhark_mc_task_236050.free_partition_sizze_203577 =
                        partition_sizze_203577;
                    futhark_mc_task_236050.free_l_n_m_203643 = l_n_m_203643;
                    futhark_mc_task_236050.free_i_203670 = i_203670;
                    futhark_mc_task_236050.free_bytes_217720 = bytes_217720;
                    futhark_mc_task_236050.free_mem_217773 = mem_217773;
                    futhark_mc_task_236050.free_mem_217777 = mem_217777;
                    futhark_mc_task_236050.free_ctx_param_ext_217866 =
                        ctx_param_ext_217866;
                    futhark_mc_task_236050.free_ctx_param_ext_217867 =
                        ctx_param_ext_217867;
                    futhark_mc_task_236050.free_ctx_param_ext_217869 =
                        ctx_param_ext_217869;
                    futhark_mc_task_236050.free_mem_param_217871 =
                        mem_param_217871.mem;
                    futhark_mc_task_236050.free_mem_219293 = mem_219293;
                    futhark_mc_task_236050.free_mem_219319 = mem_219319.mem;
                    
                    struct scheduler_segop futhark_mc_task_236050_task;
                    
                    futhark_mc_task_236050_task.args = &futhark_mc_task_236050;
                    futhark_mc_task_236050_task.top_level_fn =
                        futhark_mc_segmap_task_236051;
                    futhark_mc_task_236050_task.name =
                        "futhark_mc_segmap_task_236051";
                    futhark_mc_task_236050_task.iterations =
                        partition_sizze_203577;
                    futhark_mc_task_236050_task.task_time =
                        &ctx->futhark_mc_segmap_task_236051_total_time;
                    futhark_mc_task_236050_task.task_iter =
                        &ctx->futhark_mc_segmap_task_236051_total_iter;
                    futhark_mc_task_236050_task.sched = STATIC;
                    futhark_mc_task_236050_task.nested_fn =
                        futhark_mc_segmap_nested_task_236055;
                    
                    int futhark_mc_segmap_task_236051_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_236050_task);
                    
                    if (futhark_mc_segmap_task_236051_err != 0) {
                        if (memblock_unref(ctx, &mem_219319, "mem_219319") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219297, "mem_219297") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219410,
                                           "ext_mem_219410") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219411,
                                           "ext_mem_219411") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219761,
                                           "ext_mem_219761") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219762,
                                           "ext_mem_219762") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219195,
                                           "ext_mem_219195") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219122,
                                           "ext_mem_219122") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219123,
                                           "ext_mem_219123") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217893,
                                           "mem_param_217893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217885,
                                           "mem_param_217885") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220630,
                                           "ext_mem_220630") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220631,
                                           "ext_mem_220631") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217871,
                                           "mem_param_217871") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217863,
                                           "mem_param_217863") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217855,
                                           "mem_param_217855") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220875,
                                           "ext_mem_220875") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220876,
                                           "ext_mem_220876") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220877,
                                           "ext_mem_220877") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221032,
                                           "mem_out_221032") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221031,
                                           "mem_out_221031") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221030,
                                           "mem_out_221030") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_219411, &mem_219319,
                                     "mem_219319") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219410, &mem_219297,
                                     "mem_219297") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219319, "mem_219319") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219297, "mem_219297") != 0)
                        return 1;
                } else {
                    bool match_lit_205259 = (int64_t) 1 == d_l_203498;
                    struct memblock ext_mem_219409;
                    
                    ext_mem_219409.references = NULL;
                    
                    struct memblock ext_mem_219408;
                    
                    ext_mem_219408.references = NULL;
                    if (match_lit_205259) {
                        struct memblock mem_219359;
                        
                        mem_219359.references = NULL;
                        if (memblock_alloc(ctx, &mem_219359, bytes_217772,
                                           "mem_219359")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219363;
                        
                        mem_219363.references = NULL;
                        if (memblock_alloc(ctx, &mem_219363, bytes_217772,
                                           "mem_219363")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_212233 = (int64_t) 0;
                        int32_t num_tasks_229505;
                        int64_t flat_tid_212335 = (int64_t) 0;
                        struct futhark_mc_task_236076 futhark_mc_task_236076;
                        
                        futhark_mc_task_236076.ctx = ctx;
                        futhark_mc_task_236076.free_n_203490 = n_203490;
                        futhark_mc_task_236076.free_q_l_203495 = q_l_203495;
                        futhark_mc_task_236076.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236076.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236076.free_l_n_m_203643 = l_n_m_203643;
                        futhark_mc_task_236076.free_i_203670 = i_203670;
                        futhark_mc_task_236076.free_bytes_217720 = bytes_217720;
                        futhark_mc_task_236076.free_mem_217773 = mem_217773;
                        futhark_mc_task_236076.free_mem_217777 = mem_217777;
                        futhark_mc_task_236076.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236076.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236076.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236076.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236076.free_mem_219293 = mem_219293;
                        futhark_mc_task_236076.free_mem_219359 = mem_219359.mem;
                        futhark_mc_task_236076.free_mem_219363 = mem_219363.mem;
                        
                        struct scheduler_segop futhark_mc_task_236076_task;
                        
                        futhark_mc_task_236076_task.args =
                            &futhark_mc_task_236076;
                        futhark_mc_task_236076_task.top_level_fn =
                            futhark_mc_segmap_task_236077;
                        futhark_mc_task_236076_task.name =
                            "futhark_mc_segmap_task_236077";
                        futhark_mc_task_236076_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236076_task.task_time =
                            &ctx->futhark_mc_segmap_task_236077_total_time;
                        futhark_mc_task_236076_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236077_total_iter;
                        futhark_mc_task_236076_task.sched = STATIC;
                        futhark_mc_task_236076_task.nested_fn =
                            futhark_mc_segmap_nested_task_236082;
                        
                        int futhark_mc_segmap_task_236077_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236076_task);
                        
                        if (futhark_mc_segmap_task_236077_err != 0) {
                            if (memblock_unref(ctx, &mem_219363,
                                               "mem_219363") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219359,
                                               "mem_219359") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219408,
                                               "ext_mem_219408") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219409,
                                               "ext_mem_219409") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219410,
                                               "ext_mem_219410") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219411,
                                               "ext_mem_219411") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219409, &mem_219359,
                                         "mem_219359") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219408, &mem_219363,
                                         "mem_219363") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219363, "mem_219363") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219359, "mem_219359") != 0)
                            return 1;
                    } else {
                        struct memblock mem_219403;
                        
                        mem_219403.references = NULL;
                        if (memblock_alloc(ctx, &mem_219403, bytes_217772,
                                           "mem_219403")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219407;
                        
                        mem_219407.references = NULL;
                        if (memblock_alloc(ctx, &mem_219407, bytes_217772,
                                           "mem_219407")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_212519 = (int64_t) 0;
                        int32_t num_tasks_229944;
                        int64_t flat_tid_212653 = (int64_t) 0;
                        struct futhark_mc_task_236107 futhark_mc_task_236107;
                        
                        futhark_mc_task_236107.ctx = ctx;
                        futhark_mc_task_236107.free_n_203490 = n_203490;
                        futhark_mc_task_236107.free_q_l_203495 = q_l_203495;
                        futhark_mc_task_236107.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236107.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236107.free_l_n_m_203643 = l_n_m_203643;
                        futhark_mc_task_236107.free_i_203670 = i_203670;
                        futhark_mc_task_236107.free_bytes_217720 = bytes_217720;
                        futhark_mc_task_236107.free_mem_217773 = mem_217773;
                        futhark_mc_task_236107.free_mem_217777 = mem_217777;
                        futhark_mc_task_236107.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236107.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236107.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236107.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236107.free_mem_219293 = mem_219293;
                        futhark_mc_task_236107.free_mem_219403 = mem_219403.mem;
                        futhark_mc_task_236107.free_mem_219407 = mem_219407.mem;
                        
                        struct scheduler_segop futhark_mc_task_236107_task;
                        
                        futhark_mc_task_236107_task.args =
                            &futhark_mc_task_236107;
                        futhark_mc_task_236107_task.top_level_fn =
                            futhark_mc_segmap_task_236108;
                        futhark_mc_task_236107_task.name =
                            "futhark_mc_segmap_task_236108";
                        futhark_mc_task_236107_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236107_task.task_time =
                            &ctx->futhark_mc_segmap_task_236108_total_time;
                        futhark_mc_task_236107_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236108_total_iter;
                        futhark_mc_task_236107_task.sched = STATIC;
                        futhark_mc_task_236107_task.nested_fn =
                            futhark_mc_segmap_nested_task_236113;
                        
                        int futhark_mc_segmap_task_236108_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236107_task);
                        
                        if (futhark_mc_segmap_task_236108_err != 0) {
                            if (memblock_unref(ctx, &mem_219407,
                                               "mem_219407") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219403,
                                               "mem_219403") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219408,
                                               "ext_mem_219408") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219409,
                                               "ext_mem_219409") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219410,
                                               "ext_mem_219410") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219411,
                                               "ext_mem_219411") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219409, &mem_219403,
                                         "mem_219403") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219408, &mem_219407,
                                         "mem_219407") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219407, "mem_219407") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219403, "mem_219403") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_219411, &ext_mem_219409,
                                     "ext_mem_219409") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219410, &ext_mem_219408,
                                     "ext_mem_219408") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219408,
                                       "ext_mem_219408") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219409,
                                       "ext_mem_219409") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219762, &ext_mem_219411,
                                 "ext_mem_219411") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219761, &ext_mem_219410,
                                 "ext_mem_219410") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219410, "ext_mem_219410") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219411, "ext_mem_219411") != 0)
                    return 1;
            } else {
                bool match_lit_205484 = (int64_t) 0 == d_l_203498;
                struct memblock ext_mem_219760;
                
                ext_mem_219760.references = NULL;
                
                struct memblock ext_mem_219759;
                
                ext_mem_219759.references = NULL;
                if (match_lit_205484) {
                    struct memblock mem_219415;
                    
                    mem_219415.references = NULL;
                    if (memblock_alloc(ctx, &mem_219415, bytes_217772,
                                       "mem_219415")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_230515 = 0; i_230515 <
                         partition_sizze_203577; i_230515++) {
                        for (int64_t i_230516 = 0; i_230516 < l_n_m_203643;
                             i_230516++) {
                            ((double *) mem_219415.mem)[i_230515 *
                                                        l_n_m_203643 +
                                                        i_230516] = 0.0;
                        }
                    }
                    
                    struct memblock mem_219470;
                    
                    mem_219470.references = NULL;
                    if (memblock_alloc(ctx, &mem_219470, bytes_217772,
                                       "mem_219470")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_219416 = (int64_t) 8 * q_l_203495;
                    int64_t bytes_219417 = smax64((int64_t) 0, binop_y_219416);
                    int64_t flat_tid_212901 = (int64_t) 0;
                    int32_t num_tasks_230517;
                    int64_t flat_tid_212961 = (int64_t) 0;
                    struct futhark_mc_task_236140 futhark_mc_task_236140;
                    
                    futhark_mc_task_236140.ctx = ctx;
                    futhark_mc_task_236140.free_n_203490 = n_203490;
                    futhark_mc_task_236140.free_q_l_203495 = q_l_203495;
                    futhark_mc_task_236140.free_jump_t_203500 = jump_t_203500;
                    futhark_mc_task_236140.free_partition_sizze_203577 =
                        partition_sizze_203577;
                    futhark_mc_task_236140.free_l_n_m_203643 = l_n_m_203643;
                    futhark_mc_task_236140.free_i_203670 = i_203670;
                    futhark_mc_task_236140.free_bytes_217720 = bytes_217720;
                    futhark_mc_task_236140.free_mem_217773 = mem_217773;
                    futhark_mc_task_236140.free_mem_217777 = mem_217777;
                    futhark_mc_task_236140.free_ctx_param_ext_217866 =
                        ctx_param_ext_217866;
                    futhark_mc_task_236140.free_ctx_param_ext_217867 =
                        ctx_param_ext_217867;
                    futhark_mc_task_236140.free_ctx_param_ext_217869 =
                        ctx_param_ext_217869;
                    futhark_mc_task_236140.free_mem_param_217871 =
                        mem_param_217871.mem;
                    futhark_mc_task_236140.free_mem_219293 = mem_219293;
                    futhark_mc_task_236140.free_bytes_219417 = bytes_219417;
                    futhark_mc_task_236140.free_mem_219470 = mem_219470.mem;
                    
                    struct scheduler_segop futhark_mc_task_236140_task;
                    
                    futhark_mc_task_236140_task.args = &futhark_mc_task_236140;
                    futhark_mc_task_236140_task.top_level_fn =
                        futhark_mc_segmap_task_236141;
                    futhark_mc_task_236140_task.name =
                        "futhark_mc_segmap_task_236141";
                    futhark_mc_task_236140_task.iterations =
                        partition_sizze_203577;
                    futhark_mc_task_236140_task.task_time =
                        &ctx->futhark_mc_segmap_task_236141_total_time;
                    futhark_mc_task_236140_task.task_iter =
                        &ctx->futhark_mc_segmap_task_236141_total_iter;
                    futhark_mc_task_236140_task.sched = STATIC;
                    futhark_mc_task_236140_task.nested_fn =
                        futhark_mc_segmap_nested_task_236146;
                    
                    int futhark_mc_segmap_task_236141_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_236140_task);
                    
                    if (futhark_mc_segmap_task_236141_err != 0) {
                        if (memblock_unref(ctx, &mem_219470, "mem_219470") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219415, "mem_219415") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219759,
                                           "ext_mem_219759") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219760,
                                           "ext_mem_219760") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219761,
                                           "ext_mem_219761") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219762,
                                           "ext_mem_219762") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219195,
                                           "ext_mem_219195") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219122,
                                           "ext_mem_219122") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219123,
                                           "ext_mem_219123") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217893,
                                           "mem_param_217893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217885,
                                           "mem_param_217885") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220630,
                                           "ext_mem_220630") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220631,
                                           "ext_mem_220631") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217871,
                                           "mem_param_217871") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217863,
                                           "mem_param_217863") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217855,
                                           "mem_param_217855") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220875,
                                           "ext_mem_220875") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220876,
                                           "ext_mem_220876") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220877,
                                           "ext_mem_220877") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221032,
                                           "mem_out_221032") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221031,
                                           "mem_out_221031") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221030,
                                           "mem_out_221030") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_219760, &mem_219470,
                                     "mem_219470") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219759, &mem_219415,
                                     "mem_219415") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219470, "mem_219470") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219415, "mem_219415") != 0)
                        return 1;
                } else {
                    bool match_lit_205539 = (int64_t) 1 == d_l_203498;
                    struct memblock ext_mem_219758;
                    
                    ext_mem_219758.references = NULL;
                    
                    struct memblock ext_mem_219757;
                    
                    ext_mem_219757.references = NULL;
                    if (match_lit_205539) {
                        struct memblock mem_219576;
                        
                        mem_219576.references = NULL;
                        if (memblock_alloc(ctx, &mem_219576, bytes_217772,
                                           "mem_219576")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219580;
                        
                        mem_219580.references = NULL;
                        if (memblock_alloc(ctx, &mem_219580, bytes_217772,
                                           "mem_219580")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_219471 = (int64_t) 8 * q_l_203495;
                        int64_t bytes_219472 = smax64((int64_t) 0,
                                                      binop_y_219471);
                        int64_t flat_tid_213060 = (int64_t) 0;
                        int32_t num_tasks_230758;
                        int64_t flat_tid_213149 = (int64_t) 0;
                        struct futhark_mc_task_236169 futhark_mc_task_236169;
                        
                        futhark_mc_task_236169.ctx = ctx;
                        futhark_mc_task_236169.free_n_203490 = n_203490;
                        futhark_mc_task_236169.free_q_l_203495 = q_l_203495;
                        futhark_mc_task_236169.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236169.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236169.free_l_n_m_203643 = l_n_m_203643;
                        futhark_mc_task_236169.free_i_203670 = i_203670;
                        futhark_mc_task_236169.free_bytes_217720 = bytes_217720;
                        futhark_mc_task_236169.free_mem_217773 = mem_217773;
                        futhark_mc_task_236169.free_mem_217777 = mem_217777;
                        futhark_mc_task_236169.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236169.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236169.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236169.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236169.free_mem_219293 = mem_219293;
                        futhark_mc_task_236169.free_bytes_219472 = bytes_219472;
                        futhark_mc_task_236169.free_mem_219576 = mem_219576.mem;
                        futhark_mc_task_236169.free_mem_219580 = mem_219580.mem;
                        
                        struct scheduler_segop futhark_mc_task_236169_task;
                        
                        futhark_mc_task_236169_task.args =
                            &futhark_mc_task_236169;
                        futhark_mc_task_236169_task.top_level_fn =
                            futhark_mc_segmap_task_236170;
                        futhark_mc_task_236169_task.name =
                            "futhark_mc_segmap_task_236170";
                        futhark_mc_task_236169_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236169_task.task_time =
                            &ctx->futhark_mc_segmap_task_236170_total_time;
                        futhark_mc_task_236169_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236170_total_iter;
                        futhark_mc_task_236169_task.sched = STATIC;
                        futhark_mc_task_236169_task.nested_fn =
                            futhark_mc_segmap_nested_task_236177;
                        
                        int futhark_mc_segmap_task_236170_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236169_task);
                        
                        if (futhark_mc_segmap_task_236170_err != 0) {
                            if (memblock_unref(ctx, &mem_219580,
                                               "mem_219580") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219576,
                                               "mem_219576") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219757,
                                               "ext_mem_219757") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219758,
                                               "ext_mem_219758") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219759,
                                               "ext_mem_219759") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219760,
                                               "ext_mem_219760") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219758, &mem_219576,
                                         "mem_219576") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219757, &mem_219580,
                                         "mem_219580") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219580, "mem_219580") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219576, "mem_219576") != 0)
                            return 1;
                    } else {
                        struct memblock mem_219752;
                        
                        mem_219752.references = NULL;
                        if (memblock_alloc(ctx, &mem_219752, bytes_217772,
                                           "mem_219752")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219756;
                        
                        mem_219756.references = NULL;
                        if (memblock_alloc(ctx, &mem_219756, bytes_217772,
                                           "mem_219756")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_219581 = (int64_t) 8 * q_l_203495;
                        int64_t bytes_219582 = smax64((int64_t) 0,
                                                      binop_y_219581);
                        int64_t flat_tid_213307 = (int64_t) 0;
                        int32_t num_tasks_231152;
                        int64_t flat_tid_213436 = (int64_t) 0;
                        struct futhark_mc_task_236206 futhark_mc_task_236206;
                        
                        futhark_mc_task_236206.ctx = ctx;
                        futhark_mc_task_236206.free_n_203490 = n_203490;
                        futhark_mc_task_236206.free_q_l_203495 = q_l_203495;
                        futhark_mc_task_236206.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236206.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236206.free_l_n_m_203643 = l_n_m_203643;
                        futhark_mc_task_236206.free_i_203670 = i_203670;
                        futhark_mc_task_236206.free_bytes_217720 = bytes_217720;
                        futhark_mc_task_236206.free_mem_217773 = mem_217773;
                        futhark_mc_task_236206.free_mem_217777 = mem_217777;
                        futhark_mc_task_236206.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236206.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236206.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236206.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236206.free_mem_219293 = mem_219293;
                        futhark_mc_task_236206.free_bytes_219582 = bytes_219582;
                        futhark_mc_task_236206.free_mem_219752 = mem_219752.mem;
                        futhark_mc_task_236206.free_mem_219756 = mem_219756.mem;
                        
                        struct scheduler_segop futhark_mc_task_236206_task;
                        
                        futhark_mc_task_236206_task.args =
                            &futhark_mc_task_236206;
                        futhark_mc_task_236206_task.top_level_fn =
                            futhark_mc_segmap_task_236207;
                        futhark_mc_task_236206_task.name =
                            "futhark_mc_segmap_task_236207";
                        futhark_mc_task_236206_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236206_task.task_time =
                            &ctx->futhark_mc_segmap_task_236207_total_time;
                        futhark_mc_task_236206_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236207_total_iter;
                        futhark_mc_task_236206_task.sched = STATIC;
                        futhark_mc_task_236206_task.nested_fn =
                            futhark_mc_segmap_nested_task_236216;
                        
                        int futhark_mc_segmap_task_236207_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236206_task);
                        
                        if (futhark_mc_segmap_task_236207_err != 0) {
                            if (memblock_unref(ctx, &mem_219756,
                                               "mem_219756") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219752,
                                               "mem_219752") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219757,
                                               "ext_mem_219757") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219758,
                                               "ext_mem_219758") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219759,
                                               "ext_mem_219759") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219760,
                                               "ext_mem_219760") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219758, &mem_219752,
                                         "mem_219752") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219757, &mem_219756,
                                         "mem_219756") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219756, "mem_219756") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219752, "mem_219752") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_219760, &ext_mem_219758,
                                     "ext_mem_219758") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219759, &ext_mem_219757,
                                     "ext_mem_219757") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219757,
                                       "ext_mem_219757") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219758,
                                       "ext_mem_219758") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219762, &ext_mem_219760,
                                 "ext_mem_219760") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219761, &ext_mem_219759,
                                 "ext_mem_219759") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219759, "ext_mem_219759") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219760, "ext_mem_219760") != 0)
                    return 1;
            }
            
            struct memblock ext_mem_219785;
            
            ext_mem_219785.references = NULL;
            if (cond_204107) {
                bool zzero_205783 = jump_l_203501 == (int64_t) 0;
                bool nonzzero_205784 = !zzero_205783;
                bool nonzzero_cert_205785;
                
                if (!nonzzero_205784) {
                    ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                           "division by zero",
                                           "-> #0  loess.fut:547:20-27\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:546:3-550:9\n   #5  stl.fut:252:23-75\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:250:15-253:43\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                    if (memblock_unref(ctx, &ext_mem_219785,
                                       "ext_mem_219785") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219761,
                                       "ext_mem_219761") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219762,
                                       "ext_mem_219762") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                int64_t y_205786 = sub64(l_n_m_203643, (int64_t) 1);
                struct memblock mem_219784;
                
                mem_219784.references = NULL;
                if (memblock_alloc(ctx, &mem_219784, bytes_217339,
                                   "mem_219784")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t flat_tid_213668 = (int64_t) 0;
                int32_t num_tasks_231733;
                int64_t flat_tid_213674 = (int64_t) 0;
                struct futhark_mc_task_236255 futhark_mc_task_236255;
                
                futhark_mc_task_236255.ctx = ctx;
                futhark_mc_task_236255.free_n_203490 = n_203490;
                futhark_mc_task_236255.free_jump_l_203501 = jump_l_203501;
                futhark_mc_task_236255.free_partition_sizze_203577 =
                    partition_sizze_203577;
                futhark_mc_task_236255.free_l_n_m_203643 = l_n_m_203643;
                futhark_mc_task_236255.free_i_203670 = i_203670;
                futhark_mc_task_236255.free_y_205786 = y_205786;
                futhark_mc_task_236255.free_bytes_217302 = bytes_217302;
                futhark_mc_task_236255.free_ext_mem_219761 = ext_mem_219761.mem;
                futhark_mc_task_236255.free_ext_mem_219762 = ext_mem_219762.mem;
                futhark_mc_task_236255.free_mem_219784 = mem_219784.mem;
                
                struct scheduler_segop futhark_mc_task_236255_task;
                
                futhark_mc_task_236255_task.args = &futhark_mc_task_236255;
                futhark_mc_task_236255_task.top_level_fn =
                    futhark_mc_segmap_task_236256;
                futhark_mc_task_236255_task.name =
                    "futhark_mc_segmap_task_236256";
                futhark_mc_task_236255_task.iterations = partition_sizze_203577;
                futhark_mc_task_236255_task.task_time =
                    &ctx->futhark_mc_segmap_task_236256_total_time;
                futhark_mc_task_236255_task.task_iter =
                    &ctx->futhark_mc_segmap_task_236256_total_iter;
                futhark_mc_task_236255_task.sched = STATIC;
                futhark_mc_task_236255_task.nested_fn =
                    futhark_mc_segmap_nested_task_236260;
                
                int futhark_mc_segmap_task_236256_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_236255_task);
                
                if (futhark_mc_segmap_task_236256_err != 0) {
                    if (memblock_unref(ctx, &mem_219784, "mem_219784") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219785,
                                       "ext_mem_219785") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219761,
                                       "ext_mem_219761") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219762,
                                       "ext_mem_219762") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_219785, &mem_219784,
                                 "mem_219784") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_219784, "mem_219784") != 0)
                    return 1;
            } else {
                bool dim_match_205838 = n_203490 == l_n_m_203643;
                bool empty_or_match_cert_205839;
                
                if (!dim_match_205838) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Value of (core language) shape (",
                                  (long long) partition_sizze_203577, ", ",
                                  (long long) l_n_m_203643,
                                  ") cannot match shape of type `[",
                                  (long long) partition_sizze_203577, "][",
                                  (long long) n_203490, "]t`.",
                                  "-> #0  stl.fut:255:15-36\n   #1  stl.fut:415:61-429:75\n   #2  stl.fut:455:3-469:34\n   #3  stl.fut:439:1-469:34\n");
                    if (memblock_unref(ctx, &ext_mem_219785,
                                       "ext_mem_219785") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219761,
                                       "ext_mem_219761") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219762,
                                       "ext_mem_219762") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_219785, &ext_mem_219762,
                                 "ext_mem_219762") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &ext_mem_219761, "ext_mem_219761") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219762, "ext_mem_219762") != 0)
                return 1;
            
            struct memblock mem_219808;
            
            mem_219808.references = NULL;
            if (memblock_alloc(ctx, &mem_219808, bytes_217339, "mem_219808")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_213728 = (int64_t) 0;
            int32_t num_tasks_231843;
            int64_t flat_tid_213734 = (int64_t) 0;
            struct futhark_mc_task_236268 futhark_mc_task_236268;
            
            futhark_mc_task_236268.ctx = ctx;
            futhark_mc_task_236268.free_n_203490 = n_203490;
            futhark_mc_task_236268.free_n_p_203492 = n_p_203492;
            futhark_mc_task_236268.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236268.free_C_len_203634 = C_len_203634;
            futhark_mc_task_236268.free_bytes_217302 = bytes_217302;
            futhark_mc_task_236268.free_mem_219218 = mem_219218;
            futhark_mc_task_236268.free_ext_mem_219785 = ext_mem_219785.mem;
            futhark_mc_task_236268.free_ext_219786 = ext_219786;
            futhark_mc_task_236268.free_mem_219808 = mem_219808.mem;
            
            struct scheduler_segop futhark_mc_task_236268_task;
            
            futhark_mc_task_236268_task.args = &futhark_mc_task_236268;
            futhark_mc_task_236268_task.top_level_fn =
                futhark_mc_segmap_task_236269;
            futhark_mc_task_236268_task.name = "futhark_mc_segmap_task_236269";
            futhark_mc_task_236268_task.iterations = partition_sizze_203577;
            futhark_mc_task_236268_task.task_time =
                &ctx->futhark_mc_segmap_task_236269_total_time;
            futhark_mc_task_236268_task.task_iter =
                &ctx->futhark_mc_segmap_task_236269_total_iter;
            futhark_mc_task_236268_task.sched = STATIC;
            futhark_mc_task_236268_task.nested_fn =
                futhark_mc_segmap_nested_task_236273;
            
            int futhark_mc_segmap_task_236269_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236268_task);
            
            if (futhark_mc_segmap_task_236269_err != 0) {
                if (memblock_unref(ctx, &mem_219808, "mem_219808") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219785, "ext_mem_219785") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219761, "ext_mem_219761") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219762, "ext_mem_219762") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_unref(ctx, &ext_mem_219785, "ext_mem_219785") != 0)
                return 1;
            
            struct memblock ext_mem_220601;
            
            ext_mem_220601.references = NULL;
            
            struct memblock ext_mem_220600;
            
            ext_mem_220600.references = NULL;
            if (cond_204165) {
                bool match_lit_205851 = (int64_t) 0 == d_t_203497;
                struct memblock ext_mem_220088;
                
                ext_mem_220088.references = NULL;
                
                struct memblock ext_mem_220087;
                
                ext_mem_220087.references = NULL;
                if (match_lit_205851) {
                    struct memblock mem_219812;
                    
                    mem_219812.references = NULL;
                    if (memblock_alloc(ctx, &mem_219812, bytes_217834,
                                       "mem_219812")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_231868 = 0; i_231868 <
                         partition_sizze_203577; i_231868++) {
                        for (int64_t i_231869 = 0; i_231869 < t_n_m_203650;
                             i_231869++) {
                            ((double *) mem_219812.mem)[i_231868 *
                                                        t_n_m_203650 +
                                                        i_231869] = 0.0;
                        }
                    }
                    
                    struct memblock mem_219888;
                    
                    mem_219888.references = NULL;
                    if (memblock_alloc(ctx, &mem_219888, bytes_217834,
                                       "mem_219888")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_213744 = (int64_t) 0;
                    int32_t num_tasks_231870;
                    int64_t flat_tid_213824 = (int64_t) 0;
                    struct futhark_mc_task_236281 futhark_mc_task_236281;
                    
                    futhark_mc_task_236281.ctx = ctx;
                    futhark_mc_task_236281.free_n_203490 = n_203490;
                    futhark_mc_task_236281.free_q_t_203494 = q_t_203494;
                    futhark_mc_task_236281.free_jump_t_203500 = jump_t_203500;
                    futhark_mc_task_236281.free_partition_sizze_203577 =
                        partition_sizze_203577;
                    futhark_mc_task_236281.free_t_n_m_203650 = t_n_m_203650;
                    futhark_mc_task_236281.free_i_203670 = i_203670;
                    futhark_mc_task_236281.free_mem_217297 = mem_217297;
                    futhark_mc_task_236281.free_bytes_217302 = bytes_217302;
                    futhark_mc_task_236281.free_mem_217340 = mem_217340;
                    futhark_mc_task_236281.free_mem_217343 = mem_217343;
                    futhark_mc_task_236281.free_bytes_217782 = bytes_217782;
                    futhark_mc_task_236281.free_mem_217835 = mem_217835;
                    futhark_mc_task_236281.free_mem_217839 = mem_217839;
                    futhark_mc_task_236281.free_ctx_param_ext_217866 =
                        ctx_param_ext_217866;
                    futhark_mc_task_236281.free_ctx_param_ext_217867 =
                        ctx_param_ext_217867;
                    futhark_mc_task_236281.free_ctx_param_ext_217869 =
                        ctx_param_ext_217869;
                    futhark_mc_task_236281.free_mem_param_217871 =
                        mem_param_217871.mem;
                    futhark_mc_task_236281.free_mem_219808 = mem_219808.mem;
                    futhark_mc_task_236281.free_mem_219888 = mem_219888.mem;
                    
                    struct scheduler_segop futhark_mc_task_236281_task;
                    
                    futhark_mc_task_236281_task.args = &futhark_mc_task_236281;
                    futhark_mc_task_236281_task.top_level_fn =
                        futhark_mc_segmap_task_236282;
                    futhark_mc_task_236281_task.name =
                        "futhark_mc_segmap_task_236282";
                    futhark_mc_task_236281_task.iterations =
                        partition_sizze_203577;
                    futhark_mc_task_236281_task.task_time =
                        &ctx->futhark_mc_segmap_task_236282_total_time;
                    futhark_mc_task_236281_task.task_iter =
                        &ctx->futhark_mc_segmap_task_236282_total_iter;
                    futhark_mc_task_236281_task.sched = STATIC;
                    futhark_mc_task_236281_task.nested_fn =
                        futhark_mc_segmap_nested_task_236289;
                    
                    int futhark_mc_segmap_task_236282_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_236281_task);
                    
                    if (futhark_mc_segmap_task_236282_err != 0) {
                        if (memblock_unref(ctx, &mem_219888, "mem_219888") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219812, "mem_219812") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220087,
                                           "ext_mem_220087") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220088,
                                           "ext_mem_220088") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220600,
                                           "ext_mem_220600") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220601,
                                           "ext_mem_220601") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219808, "mem_219808") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219785,
                                           "ext_mem_219785") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219761,
                                           "ext_mem_219761") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219762,
                                           "ext_mem_219762") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219195,
                                           "ext_mem_219195") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219122,
                                           "ext_mem_219122") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219123,
                                           "ext_mem_219123") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217893,
                                           "mem_param_217893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217885,
                                           "mem_param_217885") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220630,
                                           "ext_mem_220630") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220631,
                                           "ext_mem_220631") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217871,
                                           "mem_param_217871") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217863,
                                           "mem_param_217863") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217855,
                                           "mem_param_217855") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220875,
                                           "ext_mem_220875") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220876,
                                           "ext_mem_220876") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220877,
                                           "ext_mem_220877") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221032,
                                           "mem_out_221032") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221031,
                                           "mem_out_221031") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221030,
                                           "mem_out_221030") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_220088, &mem_219888,
                                     "mem_219888") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220087, &mem_219812,
                                     "mem_219812") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219888, "mem_219888") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219812, "mem_219812") != 0)
                        return 1;
                } else {
                    bool match_lit_205943 = (int64_t) 1 == d_t_203497;
                    struct memblock ext_mem_220086;
                    
                    ext_mem_220086.references = NULL;
                    
                    struct memblock ext_mem_220085;
                    
                    ext_mem_220085.references = NULL;
                    if (match_lit_205943) {
                        struct memblock mem_219982;
                        
                        mem_219982.references = NULL;
                        if (memblock_alloc(ctx, &mem_219982, bytes_217834,
                                           "mem_219982")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219986;
                        
                        mem_219986.references = NULL;
                        if (memblock_alloc(ctx, &mem_219986, bytes_217834,
                                           "mem_219986")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_213980 = (int64_t) 0;
                        int32_t num_tasks_232242;
                        int64_t flat_tid_214088 = (int64_t) 0;
                        struct futhark_mc_task_236321 futhark_mc_task_236321;
                        
                        futhark_mc_task_236321.ctx = ctx;
                        futhark_mc_task_236321.free_n_203490 = n_203490;
                        futhark_mc_task_236321.free_q_t_203494 = q_t_203494;
                        futhark_mc_task_236321.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236321.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236321.free_t_n_m_203650 = t_n_m_203650;
                        futhark_mc_task_236321.free_i_203670 = i_203670;
                        futhark_mc_task_236321.free_mem_217297 = mem_217297;
                        futhark_mc_task_236321.free_bytes_217302 = bytes_217302;
                        futhark_mc_task_236321.free_mem_217340 = mem_217340;
                        futhark_mc_task_236321.free_mem_217343 = mem_217343;
                        futhark_mc_task_236321.free_bytes_217782 = bytes_217782;
                        futhark_mc_task_236321.free_mem_217835 = mem_217835;
                        futhark_mc_task_236321.free_mem_217839 = mem_217839;
                        futhark_mc_task_236321.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236321.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236321.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236321.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236321.free_mem_219808 = mem_219808.mem;
                        futhark_mc_task_236321.free_mem_219982 = mem_219982.mem;
                        futhark_mc_task_236321.free_mem_219986 = mem_219986.mem;
                        
                        struct scheduler_segop futhark_mc_task_236321_task;
                        
                        futhark_mc_task_236321_task.args =
                            &futhark_mc_task_236321;
                        futhark_mc_task_236321_task.top_level_fn =
                            futhark_mc_segmap_task_236322;
                        futhark_mc_task_236321_task.name =
                            "futhark_mc_segmap_task_236322";
                        futhark_mc_task_236321_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236321_task.task_time =
                            &ctx->futhark_mc_segmap_task_236322_total_time;
                        futhark_mc_task_236321_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236322_total_iter;
                        futhark_mc_task_236321_task.sched = STATIC;
                        futhark_mc_task_236321_task.nested_fn =
                            futhark_mc_segmap_nested_task_236330;
                        
                        int futhark_mc_segmap_task_236322_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236321_task);
                        
                        if (futhark_mc_segmap_task_236322_err != 0) {
                            if (memblock_unref(ctx, &mem_219986,
                                               "mem_219986") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219982,
                                               "mem_219982") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220085,
                                               "ext_mem_220085") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220086,
                                               "ext_mem_220086") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220087,
                                               "ext_mem_220087") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220088,
                                               "ext_mem_220088") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220600,
                                               "ext_mem_220600") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220601,
                                               "ext_mem_220601") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219808,
                                               "mem_219808") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219785,
                                               "ext_mem_219785") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220086, &mem_219982,
                                         "mem_219982") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220085, &mem_219986,
                                         "mem_219986") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219986, "mem_219986") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219982, "mem_219982") != 0)
                            return 1;
                    } else {
                        struct memblock mem_220080;
                        
                        mem_220080.references = NULL;
                        if (memblock_alloc(ctx, &mem_220080, bytes_217834,
                                           "mem_220080")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_220084;
                        
                        mem_220084.references = NULL;
                        if (memblock_alloc(ctx, &mem_220084, bytes_217834,
                                           "mem_220084")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_214301 = (int64_t) 0;
                        int32_t num_tasks_232752;
                        int64_t flat_tid_214441 = (int64_t) 0;
                        struct futhark_mc_task_236366 futhark_mc_task_236366;
                        
                        futhark_mc_task_236366.ctx = ctx;
                        futhark_mc_task_236366.free_n_203490 = n_203490;
                        futhark_mc_task_236366.free_q_t_203494 = q_t_203494;
                        futhark_mc_task_236366.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236366.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236366.free_t_n_m_203650 = t_n_m_203650;
                        futhark_mc_task_236366.free_i_203670 = i_203670;
                        futhark_mc_task_236366.free_mem_217297 = mem_217297;
                        futhark_mc_task_236366.free_bytes_217302 = bytes_217302;
                        futhark_mc_task_236366.free_mem_217340 = mem_217340;
                        futhark_mc_task_236366.free_mem_217343 = mem_217343;
                        futhark_mc_task_236366.free_bytes_217782 = bytes_217782;
                        futhark_mc_task_236366.free_mem_217835 = mem_217835;
                        futhark_mc_task_236366.free_mem_217839 = mem_217839;
                        futhark_mc_task_236366.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236366.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236366.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236366.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236366.free_mem_219808 = mem_219808.mem;
                        futhark_mc_task_236366.free_mem_220080 = mem_220080.mem;
                        futhark_mc_task_236366.free_mem_220084 = mem_220084.mem;
                        
                        struct scheduler_segop futhark_mc_task_236366_task;
                        
                        futhark_mc_task_236366_task.args =
                            &futhark_mc_task_236366;
                        futhark_mc_task_236366_task.top_level_fn =
                            futhark_mc_segmap_task_236367;
                        futhark_mc_task_236366_task.name =
                            "futhark_mc_segmap_task_236367";
                        futhark_mc_task_236366_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236366_task.task_time =
                            &ctx->futhark_mc_segmap_task_236367_total_time;
                        futhark_mc_task_236366_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236367_total_iter;
                        futhark_mc_task_236366_task.sched = STATIC;
                        futhark_mc_task_236366_task.nested_fn =
                            futhark_mc_segmap_nested_task_236375;
                        
                        int futhark_mc_segmap_task_236367_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236366_task);
                        
                        if (futhark_mc_segmap_task_236367_err != 0) {
                            if (memblock_unref(ctx, &mem_220084,
                                               "mem_220084") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_220080,
                                               "mem_220080") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220085,
                                               "ext_mem_220085") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220086,
                                               "ext_mem_220086") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220087,
                                               "ext_mem_220087") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220088,
                                               "ext_mem_220088") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220600,
                                               "ext_mem_220600") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220601,
                                               "ext_mem_220601") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219808,
                                               "mem_219808") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219785,
                                               "ext_mem_219785") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220086, &mem_220080,
                                         "mem_220080") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220085, &mem_220084,
                                         "mem_220084") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220084, "mem_220084") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220080, "mem_220080") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_220088, &ext_mem_220086,
                                     "ext_mem_220086") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220087, &ext_mem_220085,
                                     "ext_mem_220085") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220085,
                                       "ext_mem_220085") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220086,
                                       "ext_mem_220086") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_220601, &ext_mem_220088,
                                 "ext_mem_220088") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_220600, &ext_mem_220087,
                                 "ext_mem_220087") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220087, "ext_mem_220087") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220088, "ext_mem_220088") != 0)
                    return 1;
            } else {
                bool match_lit_206214 = (int64_t) 0 == d_t_203497;
                struct memblock ext_mem_220599;
                
                ext_mem_220599.references = NULL;
                
                struct memblock ext_mem_220598;
                
                ext_mem_220598.references = NULL;
                if (match_lit_206214) {
                    struct memblock mem_220092;
                    
                    mem_220092.references = NULL;
                    if (memblock_alloc(ctx, &mem_220092, bytes_217834,
                                       "mem_220092")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_233394 = 0; i_233394 <
                         partition_sizze_203577; i_233394++) {
                        for (int64_t i_233395 = 0; i_233395 < t_n_m_203650;
                             i_233395++) {
                            ((double *) mem_220092.mem)[i_233394 *
                                                        t_n_m_203650 +
                                                        i_233395] = 0.0;
                        }
                    }
                    
                    struct memblock mem_220201;
                    
                    mem_220201.references = NULL;
                    if (memblock_alloc(ctx, &mem_220201, bytes_217834,
                                       "mem_220201")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_220102 = (int64_t) 8 * q_t_203494;
                    int64_t bytes_220103 = smax64((int64_t) 0, binop_y_220102);
                    int64_t flat_tid_214718 = (int64_t) 0;
                    int32_t num_tasks_233396;
                    int64_t flat_tid_214783 = (int64_t) 0;
                    struct futhark_mc_task_236413 futhark_mc_task_236413;
                    
                    futhark_mc_task_236413.ctx = ctx;
                    futhark_mc_task_236413.free_n_203490 = n_203490;
                    futhark_mc_task_236413.free_q_t_203494 = q_t_203494;
                    futhark_mc_task_236413.free_jump_t_203500 = jump_t_203500;
                    futhark_mc_task_236413.free_partition_sizze_203577 =
                        partition_sizze_203577;
                    futhark_mc_task_236413.free_t_n_m_203650 = t_n_m_203650;
                    futhark_mc_task_236413.free_i_203670 = i_203670;
                    futhark_mc_task_236413.free_mem_217297 = mem_217297;
                    futhark_mc_task_236413.free_bytes_217302 = bytes_217302;
                    futhark_mc_task_236413.free_mem_217340 = mem_217340;
                    futhark_mc_task_236413.free_mem_217343 = mem_217343;
                    futhark_mc_task_236413.free_bytes_217782 = bytes_217782;
                    futhark_mc_task_236413.free_mem_217835 = mem_217835;
                    futhark_mc_task_236413.free_mem_217839 = mem_217839;
                    futhark_mc_task_236413.free_ctx_param_ext_217866 =
                        ctx_param_ext_217866;
                    futhark_mc_task_236413.free_ctx_param_ext_217867 =
                        ctx_param_ext_217867;
                    futhark_mc_task_236413.free_ctx_param_ext_217869 =
                        ctx_param_ext_217869;
                    futhark_mc_task_236413.free_mem_param_217871 =
                        mem_param_217871.mem;
                    futhark_mc_task_236413.free_mem_219808 = mem_219808.mem;
                    futhark_mc_task_236413.free_bytes_220103 = bytes_220103;
                    futhark_mc_task_236413.free_mem_220201 = mem_220201.mem;
                    
                    struct scheduler_segop futhark_mc_task_236413_task;
                    
                    futhark_mc_task_236413_task.args = &futhark_mc_task_236413;
                    futhark_mc_task_236413_task.top_level_fn =
                        futhark_mc_segmap_task_236414;
                    futhark_mc_task_236413_task.name =
                        "futhark_mc_segmap_task_236414";
                    futhark_mc_task_236413_task.iterations =
                        partition_sizze_203577;
                    futhark_mc_task_236413_task.task_time =
                        &ctx->futhark_mc_segmap_task_236414_total_time;
                    futhark_mc_task_236413_task.task_iter =
                        &ctx->futhark_mc_segmap_task_236414_total_iter;
                    futhark_mc_task_236413_task.sched = STATIC;
                    futhark_mc_task_236413_task.nested_fn =
                        futhark_mc_segmap_nested_task_236422;
                    
                    int futhark_mc_segmap_task_236414_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_236413_task);
                    
                    if (futhark_mc_segmap_task_236414_err != 0) {
                        if (memblock_unref(ctx, &mem_220201, "mem_220201") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220092, "mem_220092") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220598,
                                           "ext_mem_220598") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220599,
                                           "ext_mem_220599") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220600,
                                           "ext_mem_220600") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220601,
                                           "ext_mem_220601") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219808, "mem_219808") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219785,
                                           "ext_mem_219785") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219761,
                                           "ext_mem_219761") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219762,
                                           "ext_mem_219762") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219195,
                                           "ext_mem_219195") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219122,
                                           "ext_mem_219122") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219123,
                                           "ext_mem_219123") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217893,
                                           "mem_param_217893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217885,
                                           "mem_param_217885") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220630,
                                           "ext_mem_220630") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220631,
                                           "ext_mem_220631") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217871,
                                           "mem_param_217871") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217863,
                                           "mem_param_217863") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217855,
                                           "mem_param_217855") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220875,
                                           "ext_mem_220875") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220876,
                                           "ext_mem_220876") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220877,
                                           "ext_mem_220877") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221032,
                                           "mem_out_221032") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221031,
                                           "mem_out_221031") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221030,
                                           "mem_out_221030") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_220599, &mem_220201,
                                     "mem_220201") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220598, &mem_220092,
                                     "mem_220092") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_220201, "mem_220201") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_220092, "mem_220092") != 0)
                        return 1;
                } else {
                    bool match_lit_206291 = (int64_t) 1 == d_t_203497;
                    struct memblock ext_mem_220597;
                    
                    ext_mem_220597.references = NULL;
                    
                    struct memblock ext_mem_220596;
                    
                    ext_mem_220596.references = NULL;
                    if (match_lit_206291) {
                        struct memblock mem_220361;
                        
                        mem_220361.references = NULL;
                        if (memblock_alloc(ctx, &mem_220361, bytes_217834,
                                           "mem_220361")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_220365;
                        
                        mem_220365.references = NULL;
                        if (memblock_alloc(ctx, &mem_220365, bytes_217834,
                                           "mem_220365")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_220211 = (int64_t) 8 * q_t_203494;
                        int64_t bytes_220212 = smax64((int64_t) 0,
                                                      binop_y_220211);
                        int64_t flat_tid_214909 = (int64_t) 0;
                        int32_t num_tasks_233703;
                        int64_t flat_tid_215003 = (int64_t) 0;
                        struct futhark_mc_task_236456 futhark_mc_task_236456;
                        
                        futhark_mc_task_236456.ctx = ctx;
                        futhark_mc_task_236456.free_n_203490 = n_203490;
                        futhark_mc_task_236456.free_q_t_203494 = q_t_203494;
                        futhark_mc_task_236456.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236456.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236456.free_t_n_m_203650 = t_n_m_203650;
                        futhark_mc_task_236456.free_i_203670 = i_203670;
                        futhark_mc_task_236456.free_mem_217297 = mem_217297;
                        futhark_mc_task_236456.free_bytes_217302 = bytes_217302;
                        futhark_mc_task_236456.free_mem_217340 = mem_217340;
                        futhark_mc_task_236456.free_mem_217343 = mem_217343;
                        futhark_mc_task_236456.free_bytes_217782 = bytes_217782;
                        futhark_mc_task_236456.free_mem_217835 = mem_217835;
                        futhark_mc_task_236456.free_mem_217839 = mem_217839;
                        futhark_mc_task_236456.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236456.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236456.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236456.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236456.free_mem_219808 = mem_219808.mem;
                        futhark_mc_task_236456.free_bytes_220212 = bytes_220212;
                        futhark_mc_task_236456.free_mem_220361 = mem_220361.mem;
                        futhark_mc_task_236456.free_mem_220365 = mem_220365.mem;
                        
                        struct scheduler_segop futhark_mc_task_236456_task;
                        
                        futhark_mc_task_236456_task.args =
                            &futhark_mc_task_236456;
                        futhark_mc_task_236456_task.top_level_fn =
                            futhark_mc_segmap_task_236457;
                        futhark_mc_task_236456_task.name =
                            "futhark_mc_segmap_task_236457";
                        futhark_mc_task_236456_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236456_task.task_time =
                            &ctx->futhark_mc_segmap_task_236457_total_time;
                        futhark_mc_task_236456_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236457_total_iter;
                        futhark_mc_task_236456_task.sched = STATIC;
                        futhark_mc_task_236456_task.nested_fn =
                            futhark_mc_segmap_nested_task_236467;
                        
                        int futhark_mc_segmap_task_236457_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236456_task);
                        
                        if (futhark_mc_segmap_task_236457_err != 0) {
                            if (memblock_unref(ctx, &mem_220365,
                                               "mem_220365") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_220361,
                                               "mem_220361") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220596,
                                               "ext_mem_220596") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220597,
                                               "ext_mem_220597") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220598,
                                               "ext_mem_220598") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220599,
                                               "ext_mem_220599") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220600,
                                               "ext_mem_220600") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220601,
                                               "ext_mem_220601") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219808,
                                               "mem_219808") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219785,
                                               "ext_mem_219785") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220597, &mem_220361,
                                         "mem_220361") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220596, &mem_220365,
                                         "mem_220365") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220365, "mem_220365") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220361, "mem_220361") != 0)
                            return 1;
                    } else {
                        struct memblock mem_220591;
                        
                        mem_220591.references = NULL;
                        if (memblock_alloc(ctx, &mem_220591, bytes_217834,
                                           "mem_220591")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_220595;
                        
                        mem_220595.references = NULL;
                        if (memblock_alloc(ctx, &mem_220595, bytes_217834,
                                           "mem_220595")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_220375 = (int64_t) 8 * q_t_203494;
                        int64_t bytes_220376 = smax64((int64_t) 0,
                                                      binop_y_220375);
                        int64_t flat_tid_215188 = (int64_t) 0;
                        int32_t num_tasks_234163;
                        int64_t flat_tid_215322 = (int64_t) 0;
                        struct futhark_mc_task_236507 futhark_mc_task_236507;
                        
                        futhark_mc_task_236507.ctx = ctx;
                        futhark_mc_task_236507.free_n_203490 = n_203490;
                        futhark_mc_task_236507.free_q_t_203494 = q_t_203494;
                        futhark_mc_task_236507.free_jump_t_203500 =
                            jump_t_203500;
                        futhark_mc_task_236507.free_partition_sizze_203577 =
                            partition_sizze_203577;
                        futhark_mc_task_236507.free_t_n_m_203650 = t_n_m_203650;
                        futhark_mc_task_236507.free_i_203670 = i_203670;
                        futhark_mc_task_236507.free_mem_217297 = mem_217297;
                        futhark_mc_task_236507.free_bytes_217302 = bytes_217302;
                        futhark_mc_task_236507.free_mem_217340 = mem_217340;
                        futhark_mc_task_236507.free_mem_217343 = mem_217343;
                        futhark_mc_task_236507.free_bytes_217782 = bytes_217782;
                        futhark_mc_task_236507.free_mem_217835 = mem_217835;
                        futhark_mc_task_236507.free_mem_217839 = mem_217839;
                        futhark_mc_task_236507.free_ctx_param_ext_217866 =
                            ctx_param_ext_217866;
                        futhark_mc_task_236507.free_ctx_param_ext_217867 =
                            ctx_param_ext_217867;
                        futhark_mc_task_236507.free_ctx_param_ext_217869 =
                            ctx_param_ext_217869;
                        futhark_mc_task_236507.free_mem_param_217871 =
                            mem_param_217871.mem;
                        futhark_mc_task_236507.free_mem_219808 = mem_219808.mem;
                        futhark_mc_task_236507.free_bytes_220376 = bytes_220376;
                        futhark_mc_task_236507.free_mem_220591 = mem_220591.mem;
                        futhark_mc_task_236507.free_mem_220595 = mem_220595.mem;
                        
                        struct scheduler_segop futhark_mc_task_236507_task;
                        
                        futhark_mc_task_236507_task.args =
                            &futhark_mc_task_236507;
                        futhark_mc_task_236507_task.top_level_fn =
                            futhark_mc_segmap_task_236508;
                        futhark_mc_task_236507_task.name =
                            "futhark_mc_segmap_task_236508";
                        futhark_mc_task_236507_task.iterations =
                            partition_sizze_203577;
                        futhark_mc_task_236507_task.task_time =
                            &ctx->futhark_mc_segmap_task_236508_total_time;
                        futhark_mc_task_236507_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236508_total_iter;
                        futhark_mc_task_236507_task.sched = STATIC;
                        futhark_mc_task_236507_task.nested_fn =
                            futhark_mc_segmap_nested_task_236520;
                        
                        int futhark_mc_segmap_task_236508_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236507_task);
                        
                        if (futhark_mc_segmap_task_236508_err != 0) {
                            if (memblock_unref(ctx, &mem_220595,
                                               "mem_220595") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_220591,
                                               "mem_220591") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220596,
                                               "ext_mem_220596") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220597,
                                               "ext_mem_220597") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220598,
                                               "ext_mem_220598") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220599,
                                               "ext_mem_220599") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220600,
                                               "ext_mem_220600") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220601,
                                               "ext_mem_220601") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219808,
                                               "mem_219808") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219785,
                                               "ext_mem_219785") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219761,
                                               "ext_mem_219761") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219762,
                                               "ext_mem_219762") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219195,
                                               "ext_mem_219195") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219122,
                                               "ext_mem_219122") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219123,
                                               "ext_mem_219123") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217893,
                                               "mem_param_217893") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217885,
                                               "mem_param_217885") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220630,
                                               "ext_mem_220630") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220631,
                                               "ext_mem_220631") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217871,
                                               "mem_param_217871") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217863,
                                               "mem_param_217863") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217855,
                                               "mem_param_217855") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220875,
                                               "ext_mem_220875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220876,
                                               "ext_mem_220876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220877,
                                               "ext_mem_220877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217847,
                                               "mem_217847") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217843,
                                               "mem_217843") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221032,
                                               "mem_out_221032") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221031,
                                               "mem_out_221031") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221030,
                                               "mem_out_221030") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220597, &mem_220591,
                                         "mem_220591") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220596, &mem_220595,
                                         "mem_220595") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220595, "mem_220595") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220591, "mem_220591") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_220599, &ext_mem_220597,
                                     "ext_mem_220597") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220598, &ext_mem_220596,
                                     "ext_mem_220596") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220596,
                                       "ext_mem_220596") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220597,
                                       "ext_mem_220597") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_220601, &ext_mem_220599,
                                 "ext_mem_220599") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_220600, &ext_mem_220598,
                                 "ext_mem_220598") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220598, "ext_mem_220598") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220599, "ext_mem_220599") != 0)
                    return 1;
            }
            
            struct memblock ext_mem_220624;
            
            ext_mem_220624.references = NULL;
            if (cond_204108) {
                bool zzero_206580 = jump_t_203500 == (int64_t) 0;
                bool nonzzero_206581 = !zzero_206580;
                bool nonzzero_cert_206582;
                
                if (!nonzzero_206581) {
                    ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                           "division by zero",
                                           "-> #0  loess.fut:547:20-27\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:546:3-550:9\n   #5  stl.fut:304:23-75\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:303:15-305:43\n   #9  stl.fut:415:61-429:75\n   #10 stl.fut:455:3-469:34\n   #11 stl.fut:439:1-469:34\n");
                    if (memblock_unref(ctx, &ext_mem_220624,
                                       "ext_mem_220624") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220600,
                                       "ext_mem_220600") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220601,
                                       "ext_mem_220601") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219808, "mem_219808") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219785,
                                       "ext_mem_219785") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219761,
                                       "ext_mem_219761") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219762,
                                       "ext_mem_219762") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                int64_t y_206583 = sub64(t_n_m_203650, (int64_t) 1);
                struct memblock mem_220623;
                
                mem_220623.references = NULL;
                if (memblock_alloc(ctx, &mem_220623, bytes_217339,
                                   "mem_220623")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t flat_tid_215581 = (int64_t) 0;
                int32_t num_tasks_234811;
                int64_t flat_tid_215587 = (int64_t) 0;
                struct futhark_mc_task_236570 futhark_mc_task_236570;
                
                futhark_mc_task_236570.ctx = ctx;
                futhark_mc_task_236570.free_n_203490 = n_203490;
                futhark_mc_task_236570.free_jump_t_203500 = jump_t_203500;
                futhark_mc_task_236570.free_partition_sizze_203577 =
                    partition_sizze_203577;
                futhark_mc_task_236570.free_t_n_m_203650 = t_n_m_203650;
                futhark_mc_task_236570.free_i_203670 = i_203670;
                futhark_mc_task_236570.free_y_206583 = y_206583;
                futhark_mc_task_236570.free_bytes_217302 = bytes_217302;
                futhark_mc_task_236570.free_ext_mem_220600 = ext_mem_220600.mem;
                futhark_mc_task_236570.free_ext_mem_220601 = ext_mem_220601.mem;
                futhark_mc_task_236570.free_mem_220623 = mem_220623.mem;
                
                struct scheduler_segop futhark_mc_task_236570_task;
                
                futhark_mc_task_236570_task.args = &futhark_mc_task_236570;
                futhark_mc_task_236570_task.top_level_fn =
                    futhark_mc_segmap_task_236571;
                futhark_mc_task_236570_task.name =
                    "futhark_mc_segmap_task_236571";
                futhark_mc_task_236570_task.iterations = partition_sizze_203577;
                futhark_mc_task_236570_task.task_time =
                    &ctx->futhark_mc_segmap_task_236571_total_time;
                futhark_mc_task_236570_task.task_iter =
                    &ctx->futhark_mc_segmap_task_236571_total_iter;
                futhark_mc_task_236570_task.sched = STATIC;
                futhark_mc_task_236570_task.nested_fn =
                    futhark_mc_segmap_nested_task_236575;
                
                int futhark_mc_segmap_task_236571_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_236570_task);
                
                if (futhark_mc_segmap_task_236571_err != 0) {
                    if (memblock_unref(ctx, &mem_220623, "mem_220623") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220624,
                                       "ext_mem_220624") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220600,
                                       "ext_mem_220600") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220601,
                                       "ext_mem_220601") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219808, "mem_219808") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219785,
                                       "ext_mem_219785") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219761,
                                       "ext_mem_219761") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219762,
                                       "ext_mem_219762") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_220624, &mem_220623,
                                 "mem_220623") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_220623, "mem_220623") != 0)
                    return 1;
            } else {
                bool dim_match_206636 = n_203490 == t_n_m_203650;
                bool empty_or_match_cert_206637;
                
                if (!dim_match_206636) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Value of (core language) shape (",
                                  (long long) partition_sizze_203577, ", ",
                                  (long long) t_n_m_203650,
                                  ") cannot match shape of type `[",
                                  (long long) partition_sizze_203577, "][",
                                  (long long) n_203490, "]t`.",
                                  "-> #0  stl.fut:307:15-36\n   #1  stl.fut:415:61-429:75\n   #2  stl.fut:455:3-469:34\n   #3  stl.fut:439:1-469:34\n");
                    if (memblock_unref(ctx, &ext_mem_220624,
                                       "ext_mem_220624") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220600,
                                       "ext_mem_220600") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220601,
                                       "ext_mem_220601") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219808, "mem_219808") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219785,
                                       "ext_mem_219785") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219761,
                                       "ext_mem_219761") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219762,
                                       "ext_mem_219762") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219195,
                                       "ext_mem_219195") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219122,
                                       "ext_mem_219122") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219123,
                                       "ext_mem_219123") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217893,
                                       "mem_param_217893") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217885,
                                       "mem_param_217885") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220630,
                                       "ext_mem_220630") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220631,
                                       "ext_mem_220631") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217871,
                                       "mem_param_217871") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217863,
                                       "mem_param_217863") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217855,
                                       "mem_param_217855") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220875,
                                       "ext_mem_220875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220876,
                                       "ext_mem_220876") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220877,
                                       "ext_mem_220877") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221032,
                                       "mem_out_221032") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221031,
                                       "mem_out_221031") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221030,
                                       "mem_out_221030") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_220624, &ext_mem_220601,
                                 "ext_mem_220601") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &ext_mem_220600, "ext_mem_220600") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220601, "ext_mem_220601") != 0)
                return 1;
            
            int64_t ctx_param_ext_tmp_222749 = ext_220625;
            int64_t ctx_param_ext_tmp_222750 = ext_220625;
            struct memblock mem_param_tmp_222751;
            
            mem_param_tmp_222751.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_222751, &mem_219808,
                             "mem_219808") != 0)
                return 1;
            
            struct memblock mem_param_tmp_222752;
            
            mem_param_tmp_222752.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_222752, &ext_mem_220624,
                             "ext_mem_220624") != 0)
                return 1;
            ctx_param_ext_217887 = ctx_param_ext_tmp_222749;
            ctx_param_ext_217889 = ctx_param_ext_tmp_222750;
            if (memblock_set(ctx, &mem_param_217885, &mem_param_tmp_222751,
                             "mem_param_tmp_222751") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_217893, &mem_param_tmp_222752,
                             "mem_param_tmp_222752") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_222752,
                               "mem_param_tmp_222752") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_222751,
                               "mem_param_tmp_222751") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220624, "ext_mem_220624") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220600, "ext_mem_220600") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220601, "ext_mem_220601") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_219808, "mem_219808") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219785, "ext_mem_219785") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219761, "ext_mem_219761") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219762, "ext_mem_219762") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219195, "ext_mem_219195") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219122, "ext_mem_219122") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219123, "ext_mem_219123") != 0)
                return 1;
        }
        ext_220637 = ctx_param_ext_217887;
        ext_220635 = ctx_param_ext_217889;
        if (memblock_set(ctx, &ext_mem_220631, &mem_param_217885,
                         "mem_param_217885") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_220630, &mem_param_217893,
                         "mem_param_217893") != 0)
            return 1;
        
        bool cond_206639 = slt64(i_outer_204192, y_204109);
        int64_t ext_220874;
        
        if (cond_206639) {
            ext_220874 = partition_sizze_203577;
        } else {
            ext_220874 = ctx_param_ext_217868;
        }
        
        int64_t ext_220873;
        
        if (cond_206639) {
            ext_220873 = n_203490;
        } else {
            ext_220873 = ctx_param_ext_217870;
        }
        
        int64_t ext_220872;
        
        if (cond_206639) {
            ext_220872 = partition_sizze_203577;
        } else {
            ext_220872 = ctx_param_ext_217864;
        }
        
        int64_t ext_220871;
        
        if (cond_206639) {
            ext_220871 = n_203490;
        } else {
            ext_220871 = ctx_param_ext_217865;
        }
        
        int64_t ext_220870;
        
        if (cond_206639) {
            ext_220870 = n_203490;
        } else {
            ext_220870 = ctx_param_ext_217867;
        }
        
        int64_t ext_220869;
        
        if (cond_206639) {
            ext_220869 = (int64_t) 1;
        } else {
            ext_220869 = ctx_param_ext_217869;
        }
        
        int64_t ext_220868;
        
        if (cond_206639) {
            ext_220868 = (int64_t) 0;
        } else {
            ext_220868 = ctx_param_ext_217866;
        }
        
        struct memblock ext_mem_220867;
        
        ext_mem_220867.references = NULL;
        if (cond_206639) {
            if (mem_220685_cached_sizze_235405 < (size_t) bytes_217339) {
                mem_220685 = realloc(mem_220685, bytes_217339);
                mem_220685_cached_sizze_235405 = bytes_217339;
            }
            if (mem_220689_cached_sizze_235406 < (size_t) bytes_217339) {
                mem_220689 = realloc(mem_220689, bytes_217339);
                mem_220689_cached_sizze_235406 = bytes_217339;
            }
            
            int64_t flat_tid_215641 = (int64_t) 0;
            int32_t num_tasks_234921;
            int64_t flat_tid_215649 = (int64_t) 0;
            struct futhark_mc_task_236583 futhark_mc_task_236583;
            
            futhark_mc_task_236583.ctx = ctx;
            futhark_mc_task_236583.free_n_203490 = n_203490;
            futhark_mc_task_236583.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236583.free_mem_217297 = mem_217297;
            futhark_mc_task_236583.free_bytes_217302 = bytes_217302;
            futhark_mc_task_236583.free_mem_217340 = mem_217340;
            futhark_mc_task_236583.free_ext_mem_220630 = ext_mem_220630.mem;
            futhark_mc_task_236583.free_ext_mem_220631 = ext_mem_220631.mem;
            futhark_mc_task_236583.free_ext_220635 = ext_220635;
            futhark_mc_task_236583.free_mem_220685 = mem_220685;
            futhark_mc_task_236583.free_mem_220689 = mem_220689;
            
            struct scheduler_segop futhark_mc_task_236583_task;
            
            futhark_mc_task_236583_task.args = &futhark_mc_task_236583;
            futhark_mc_task_236583_task.top_level_fn =
                futhark_mc_segmap_task_236584;
            futhark_mc_task_236583_task.name = "futhark_mc_segmap_task_236584";
            futhark_mc_task_236583_task.iterations = partition_sizze_203577;
            futhark_mc_task_236583_task.task_time =
                &ctx->futhark_mc_segmap_task_236584_total_time;
            futhark_mc_task_236583_task.task_iter =
                &ctx->futhark_mc_segmap_task_236584_total_iter;
            futhark_mc_task_236583_task.sched = STATIC;
            futhark_mc_task_236583_task.nested_fn =
                futhark_mc_segmap_nested_task_236589;
            
            int futhark_mc_segmap_task_236584_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236583_task);
            
            if (futhark_mc_segmap_task_236584_err != 0) {
                if (memblock_unref(ctx, &ext_mem_220867, "ext_mem_220867") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int32_t iters_206665;
            
            if (empty_slice_204119) {
                iters_206665 = 0;
            } else {
                iters_206665 = 32;
            }
            
            bool loop_nonempty_206666 = slt32(0, iters_206665);
            bool loop_not_taken_206667 = !loop_nonempty_206666;
            bool protect_assert_disj_206668 = bounds_check_203673 ||
                 loop_not_taken_206667;
            bool index_certs_206669;
            
            if (!protect_assert_disj_206668) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) i_203670,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  /prelude/array.fut:26:29-34\n   #1  lib/github.com/diku-dk/sorts/radix_sort.fut:25:24-35\n   #2  lib/github.com/diku-dk/sorts/radix_sort.fut:53:31-62\n   #3  lib/github.com/diku-dk/sorts/radix_sort.fut:104:6-36\n   #4  stl.fut:338:35-77\n   #5  stl.fut:337:28-339:40\n   #6  stl.fut:415:61-429:75\n   #7  stl.fut:455:3-469:34\n   #8  stl.fut:439:1-469:34\n");
                if (memblock_unref(ctx, &ext_mem_220867, "ext_mem_220867") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            if (mem_220835_cached_sizze_235407 < (size_t) bytes_217339) {
                mem_220835 = realloc(mem_220835, bytes_217339);
                mem_220835_cached_sizze_235407 = bytes_217339;
            }
            
            int64_t binop_y_220713 = (int64_t) 4 * n_203490;
            int64_t bytes_220714 = smax64((int64_t) 0, binop_y_220713);
            int64_t num_bytes_221020 = (int64_t) 8 * n_203490;
            int64_t num_bytes_221025 = (int64_t) 8 * n_203490;
            int64_t flat_tid_215676 = (int64_t) 0;
            int32_t num_tasks_234983;
            int64_t flat_tid_215684 = (int64_t) 0;
            struct futhark_mc_task_236602 futhark_mc_task_236602;
            
            futhark_mc_task_236602.ctx = ctx;
            futhark_mc_task_236602.free_n_203490 = n_203490;
            futhark_mc_task_236602.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236602.free_i_203670 = i_203670;
            futhark_mc_task_236602.free_iters_206665 = iters_206665;
            futhark_mc_task_236602.free_bytes_217302 = bytes_217302;
            futhark_mc_task_236602.free_mem_220685 = mem_220685;
            futhark_mc_task_236602.free_bytes_220714 = bytes_220714;
            futhark_mc_task_236602.free_mem_220835 = mem_220835;
            futhark_mc_task_236602.free_num_bytes_221020 = num_bytes_221020;
            futhark_mc_task_236602.free_num_bytes_221025 = num_bytes_221025;
            
            struct scheduler_segop futhark_mc_task_236602_task;
            
            futhark_mc_task_236602_task.args = &futhark_mc_task_236602;
            futhark_mc_task_236602_task.top_level_fn =
                futhark_mc_segmap_task_236603;
            futhark_mc_task_236602_task.name = "futhark_mc_segmap_task_236603";
            futhark_mc_task_236602_task.iterations = partition_sizze_203577;
            futhark_mc_task_236602_task.task_time =
                &ctx->futhark_mc_segmap_task_236603_total_time;
            futhark_mc_task_236602_task.task_iter =
                &ctx->futhark_mc_segmap_task_236603_total_iter;
            futhark_mc_task_236602_task.sched = STATIC;
            futhark_mc_task_236602_task.nested_fn =
                futhark_mc_segmap_nested_task_236611;
            
            int futhark_mc_segmap_task_236603_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236602_task);
            
            if (futhark_mc_segmap_task_236603_err != 0) {
                if (memblock_unref(ctx, &ext_mem_220867, "ext_mem_220867") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            bool empty_slice_206791 = j_m_i_204133 == (int64_t) 0;
            int64_t m_206792 = sub64(j_m_i_204133, (int64_t) 1);
            int64_t i_p_m_t_s_206793 = add64(stl_res_203664, m_206792);
            bool zzero_leq_i_p_m_t_s_206794 = sle64((int64_t) 0,
                                                    i_p_m_t_s_206793);
            bool i_p_m_t_s_leq_w_206795 = slt64(i_p_m_t_s_206793, n_203490);
            bool zzero_lte_i_206796 = sle64((int64_t) 0, stl_res_203664);
            bool i_lte_j_206797 = sle64(stl_res_203664, stl_res_203665);
            bool y_206798 = i_p_m_t_s_leq_w_206795 && zzero_lte_i_206796;
            bool y_206799 = zzero_leq_i_p_m_t_s_206794 && y_206798;
            bool y_206800 = i_lte_j_206797 && y_206799;
            bool forwards_ok_206801 = zzero_lte_i_206796 && y_206800;
            bool ok_or_empty_206802 = empty_slice_206791 || forwards_ok_206801;
            bool index_certs_206803;
            
            if (!ok_or_empty_206802) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) stl_res_203664, ":",
                              (long long) stl_res_203665,
                              "] out of bounds for array of shape [",
                              (long long) n_203490, "].",
                              "-> #0  stl.fut:344:33-51\n   #1  stl.fut:342:13-349:28\n   #2  stl.fut:415:61-429:75\n   #3  stl.fut:455:3-469:34\n   #4  stl.fut:439:1-469:34\n");
                if (memblock_unref(ctx, &ext_mem_220867, "ext_mem_220867") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            if (mem_220838_cached_sizze_235408 < (size_t) bytes_217342) {
                mem_220838 = realloc(mem_220838, bytes_217342);
                mem_220838_cached_sizze_235408 = bytes_217342;
            }
            if (mem_220841_cached_sizze_235409 < (size_t) bytes_217342) {
                mem_220841 = realloc(mem_220841, bytes_217342);
                mem_220841_cached_sizze_235409 = bytes_217342;
            }
            if (mem_220844_cached_sizze_235410 < (size_t) bytes_217342) {
                mem_220844 = realloc(mem_220844, bytes_217342);
                mem_220844_cached_sizze_235410 = bytes_217342;
            }
            
            int64_t flat_tid_215780 = (int64_t) 0;
            int32_t num_tasks_235269;
            int64_t flat_tid_215786 = (int64_t) 0;
            struct futhark_mc_task_236633 futhark_mc_task_236633;
            
            futhark_mc_task_236633.ctx = ctx;
            futhark_mc_task_236633.free_n_203490 = n_203490;
            futhark_mc_task_236633.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236633.free_stl_res_203664 = stl_res_203664;
            futhark_mc_task_236633.free_j_m_i_204133 = j_m_i_204133;
            futhark_mc_task_236633.free_mem_220835 = mem_220835;
            futhark_mc_task_236633.free_mem_220838 = mem_220838;
            futhark_mc_task_236633.free_mem_220841 = mem_220841;
            futhark_mc_task_236633.free_mem_220844 = mem_220844;
            
            struct scheduler_segop futhark_mc_task_236633_task;
            
            futhark_mc_task_236633_task.args = &futhark_mc_task_236633;
            futhark_mc_task_236633_task.top_level_fn =
                futhark_mc_segmap_task_236634;
            futhark_mc_task_236633_task.name = "futhark_mc_segmap_task_236634";
            futhark_mc_task_236633_task.iterations = partition_sizze_203577;
            futhark_mc_task_236633_task.task_time =
                &ctx->futhark_mc_segmap_task_236634_total_time;
            futhark_mc_task_236633_task.task_iter =
                &ctx->futhark_mc_segmap_task_236634_total_iter;
            futhark_mc_task_236633_task.sched = STATIC;
            futhark_mc_task_236633_task.nested_fn =
                futhark_mc_segmap_nested_task_236637;
            
            int futhark_mc_segmap_task_236634_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236633_task);
            
            if (futhark_mc_segmap_task_236634_err != 0) {
                if (memblock_unref(ctx, &ext_mem_220867, "ext_mem_220867") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock mem_220866;
            
            mem_220866.references = NULL;
            if (memblock_alloc(ctx, &mem_220866, bytes_217339, "mem_220866")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_215799 = (int64_t) 0;
            int32_t num_tasks_235298;
            int64_t flat_tid_215805 = (int64_t) 0;
            struct futhark_mc_task_236645 futhark_mc_task_236645;
            
            futhark_mc_task_236645.ctx = ctx;
            futhark_mc_task_236645.free_n_203490 = n_203490;
            futhark_mc_task_236645.free_partition_sizze_203577 =
                partition_sizze_203577;
            futhark_mc_task_236645.free_bytes_217302 = bytes_217302;
            futhark_mc_task_236645.free_mem_220689 = mem_220689;
            futhark_mc_task_236645.free_mem_220838 = mem_220838;
            futhark_mc_task_236645.free_mem_220841 = mem_220841;
            futhark_mc_task_236645.free_mem_220844 = mem_220844;
            futhark_mc_task_236645.free_mem_220866 = mem_220866.mem;
            
            struct scheduler_segop futhark_mc_task_236645_task;
            
            futhark_mc_task_236645_task.args = &futhark_mc_task_236645;
            futhark_mc_task_236645_task.top_level_fn =
                futhark_mc_segmap_task_236646;
            futhark_mc_task_236645_task.name = "futhark_mc_segmap_task_236646";
            futhark_mc_task_236645_task.iterations = partition_sizze_203577;
            futhark_mc_task_236645_task.task_time =
                &ctx->futhark_mc_segmap_task_236646_total_time;
            futhark_mc_task_236645_task.task_iter =
                &ctx->futhark_mc_segmap_task_236646_total_iter;
            futhark_mc_task_236645_task.sched = STATIC;
            futhark_mc_task_236645_task.nested_fn =
                futhark_mc_segmap_nested_task_236650;
            
            int futhark_mc_segmap_task_236646_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236645_task);
            
            if (futhark_mc_segmap_task_236646_err != 0) {
                if (memblock_unref(ctx, &mem_220866, "mem_220866") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220867, "ext_mem_220867") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217893,
                                   "mem_param_217893") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217885,
                                   "mem_param_217885") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217871,
                                   "mem_param_217871") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217863,
                                   "mem_param_217863") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217855,
                                   "mem_param_217855") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_set(ctx, &ext_mem_220867, &mem_220866, "mem_220866") !=
                0)
                return 1;
            if (memblock_unref(ctx, &mem_220866, "mem_220866") != 0)
                return 1;
        } else {
            if (memblock_set(ctx, &ext_mem_220867, &mem_param_217871,
                             "mem_param_217871") != 0)
                return 1;
        }
        
        int64_t ctx_param_ext_tmp_222734 = ext_220637;
        int64_t ctx_param_ext_tmp_222735 = ext_220635;
        int64_t ctx_param_ext_tmp_222736 = ext_220872;
        int64_t ctx_param_ext_tmp_222737 = ext_220871;
        int64_t ctx_param_ext_tmp_222738 = ext_220868;
        int64_t ctx_param_ext_tmp_222739 = ext_220870;
        int64_t ctx_param_ext_tmp_222740 = ext_220874;
        int64_t ctx_param_ext_tmp_222741 = ext_220869;
        int64_t ctx_param_ext_tmp_222742 = ext_220873;
        struct memblock mem_param_tmp_222743;
        
        mem_param_tmp_222743.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_222743, &ext_mem_220631,
                         "ext_mem_220631") != 0)
            return 1;
        
        struct memblock mem_param_tmp_222744;
        
        mem_param_tmp_222744.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_222744, &ext_mem_220630,
                         "ext_mem_220630") != 0)
            return 1;
        
        struct memblock mem_param_tmp_222745;
        
        mem_param_tmp_222745.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_222745, &ext_mem_220867,
                         "ext_mem_220867") != 0)
            return 1;
        ctx_param_ext_217857 = ctx_param_ext_tmp_222734;
        ctx_param_ext_217859 = ctx_param_ext_tmp_222735;
        ctx_param_ext_217864 = ctx_param_ext_tmp_222736;
        ctx_param_ext_217865 = ctx_param_ext_tmp_222737;
        ctx_param_ext_217866 = ctx_param_ext_tmp_222738;
        ctx_param_ext_217867 = ctx_param_ext_tmp_222739;
        ctx_param_ext_217868 = ctx_param_ext_tmp_222740;
        ctx_param_ext_217869 = ctx_param_ext_tmp_222741;
        ctx_param_ext_217870 = ctx_param_ext_tmp_222742;
        if (memblock_set(ctx, &mem_param_217855, &mem_param_tmp_222743,
                         "mem_param_tmp_222743") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_217863, &mem_param_tmp_222744,
                         "mem_param_tmp_222744") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_217871, &mem_param_tmp_222745,
                         "mem_param_tmp_222745") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_222745,
                           "mem_param_tmp_222745") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_222744,
                           "mem_param_tmp_222744") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_222743,
                           "mem_param_tmp_222743") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220867, "ext_mem_220867") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217893, "mem_param_217893") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217885, "mem_param_217885") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220630, "ext_mem_220630") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220631, "ext_mem_220631") != 0)
            return 1;
    }
    ext_220890 = ctx_param_ext_217857;
    ext_220888 = ctx_param_ext_217859;
    ext_220884 = ctx_param_ext_217864;
    ext_220883 = ctx_param_ext_217865;
    ext_220882 = ctx_param_ext_217866;
    ext_220881 = ctx_param_ext_217867;
    ext_220880 = ctx_param_ext_217868;
    ext_220879 = ctx_param_ext_217869;
    ext_220878 = ctx_param_ext_217870;
    if (memblock_set(ctx, &ext_mem_220877, &mem_param_217855,
                     "mem_param_217855") != 0)
        return 1;
    if (memblock_set(ctx, &ext_mem_220876, &mem_param_217863,
                     "mem_param_217863") != 0)
        return 1;
    if (memblock_set(ctx, &ext_mem_220875, &mem_param_217871,
                     "mem_param_217871") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
        return 1;
    
    struct memblock mem_220902;
    
    mem_220902.references = NULL;
    if (memblock_alloc(ctx, &mem_220902, bytes_217296, "mem_220902")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_235355 = 0; i_235355 < m_203489; i_235355++) {
        for (int64_t i_235356 = 0; i_235356 < n_203490; i_235356++) {
            ((double *) mem_220902.mem)[i_235355 * n_203490 + i_235356] = NAN;
        }
    }
    
    struct memblock mem_220906;
    
    mem_220906.references = NULL;
    if (memblock_alloc(ctx, &mem_220906, bytes_217296, "mem_220906")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_235357 = 0; i_235357 < m_203489; i_235357++) {
        for (int64_t i_235358 = 0; i_235358 < n_203490; i_235358++) {
            ((double *) mem_220906.mem)[i_235357 * n_203490 + i_235358] = NAN;
        }
    }
    
    struct memblock mem_220910;
    
    mem_220910.references = NULL;
    if (memblock_alloc(ctx, &mem_220910, bytes_217296, "mem_220910")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_235359 = 0; i_235359 < m_203489; i_235359++) {
        for (int64_t i_235360 = 0; i_235360 < n_203490; i_235360++) {
            ((double *) mem_220910.mem)[i_235359 * n_203490 + i_235360] = NAN;
        }
    }
    
    int64_t flat_tid_215831 = (int64_t) 0;
    int32_t num_tasks_235361;
    struct futhark_mc_task_236658 futhark_mc_task_236658;
    
    futhark_mc_task_236658.ctx = ctx;
    futhark_mc_task_236658.free_m_203489 = m_203489;
    futhark_mc_task_236658.free_n_203490 = n_203490;
    futhark_mc_task_236658.free_partition_sizze_203577 = partition_sizze_203577;
    futhark_mc_task_236658.free_mem_217297 = mem_217297;
    futhark_mc_task_236658.free_mem_217300 = mem_217300;
    futhark_mc_task_236658.free_bytes_217302 = bytes_217302;
    futhark_mc_task_236658.free_ext_mem_220876 = ext_mem_220876.mem;
    futhark_mc_task_236658.free_ext_mem_220877 = ext_mem_220877.mem;
    futhark_mc_task_236658.free_ext_220888 = ext_220888;
    futhark_mc_task_236658.free_mem_220902 = mem_220902.mem;
    futhark_mc_task_236658.free_mem_220906 = mem_220906.mem;
    futhark_mc_task_236658.free_mem_220910 = mem_220910.mem;
    
    struct scheduler_segop futhark_mc_task_236658_task;
    
    futhark_mc_task_236658_task.args = &futhark_mc_task_236658;
    futhark_mc_task_236658_task.top_level_fn = futhark_mc_segmap_task_236659;
    futhark_mc_task_236658_task.name = "futhark_mc_segmap_task_236659";
    futhark_mc_task_236658_task.iterations = partition_sizze_203577;
    futhark_mc_task_236658_task.task_time =
        &ctx->futhark_mc_segmap_task_236659_total_time;
    futhark_mc_task_236658_task.task_iter =
        &ctx->futhark_mc_segmap_task_236659_total_iter;
    futhark_mc_task_236658_task.sched = STATIC;
    futhark_mc_task_236658_task.nested_fn = NULL;
    
    int futhark_mc_segmap_task_236659_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_236658_task);
    
    if (futhark_mc_segmap_task_236659_err != 0) {
        if (memblock_unref(ctx, &mem_220910, "mem_220910") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_220906, "mem_220906") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_220902, "mem_220902") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217871, "mem_param_217871") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217863, "mem_param_217863") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217855, "mem_param_217855") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
        return 1;
    if (memblock_set(ctx, &mem_out_221030, &mem_220902, "mem_220902") != 0)
        return 1;
    if (memblock_set(ctx, &mem_out_221031, &mem_220906, "mem_220906") != 0)
        return 1;
    if (memblock_set(ctx, &mem_out_221032, &mem_220910, "mem_220910") != 0)
        return 1;
    (*mem_out_p_235376).references = NULL;
    if (memblock_set(ctx, &*mem_out_p_235376, &mem_out_221030,
                     "mem_out_221030") != 0)
        return 1;
    (*mem_out_p_235377).references = NULL;
    if (memblock_set(ctx, &*mem_out_p_235377, &mem_out_221031,
                     "mem_out_221031") != 0)
        return 1;
    (*mem_out_p_235378).references = NULL;
    if (memblock_set(ctx, &*mem_out_p_235378, &mem_out_221032,
                     "mem_out_221032") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_220910, "mem_220910") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_220906, "mem_220906") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_220902, "mem_220902") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_217871, "mem_param_217871") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_217863, "mem_param_217863") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_217855, "mem_param_217855") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220875, "ext_mem_220875") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220876, "ext_mem_220876") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220877, "ext_mem_220877") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217847, "mem_217847") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217843, "mem_217843") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_out_221032, "mem_out_221032") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_out_221031, "mem_out_221031") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_out_221030, "mem_out_221030") != 0)
        return 1;
    
  cleanup:
    { }
    free(mem_217288);
    free(mem_217291);
    free(mem_217293);
    free(mem_217297);
    free(mem_217300);
    free(mem_217340);
    free(mem_217343);
    free(mem_217414);
    free(mem_217536);
    free(mem_217540);
    free(mem_217710);
    free(mem_217715);
    free(mem_217773);
    free(mem_217777);
    free(mem_217835);
    free(mem_217839);
    free(mem_217915);
    free(mem_218052);
    free(mem_218057);
    free(mem_219218);
    free(mem_219221);
    free(mem_219243);
    free(mem_219246);
    free(mem_219268);
    free(mem_219271);
    free(mem_219293);
    free(mem_220685);
    free(mem_220689);
    free(mem_220835);
    free(mem_220838);
    free(mem_220841);
    free(mem_220844);
    return err;
}

int futhark_entry_main(struct futhark_context *ctx,
                       struct futhark_f64_2d **out0,
                       struct futhark_f64_2d **out1,
                       struct futhark_f64_2d **out2, const
                       struct futhark_f64_2d *in0, const int64_t in1, const
                       int64_t in2, const int64_t in3, const int64_t in4, const
                       int64_t in5, const int64_t in6, const int64_t in7, const
                       int64_t in8, const int64_t in9, const int64_t in10, const
                       int64_t in11, const int64_t in12, const int64_t in13,
                       const int64_t in14)
{
    struct memblock Y_mem_217285;
    
    Y_mem_217285.references = NULL;
    
    int64_t m_203489;
    int64_t n_203490;
    int64_t n_p_203492;
    int64_t q_s_203493;
    int64_t q_t_203494;
    int64_t q_l_203495;
    int64_t d_s_203496;
    int64_t d_t_203497;
    int64_t d_l_203498;
    int64_t jump_s_203499;
    int64_t jump_t_203500;
    int64_t jump_l_203501;
    int64_t n_inner_203502;
    int64_t n_outer_203503;
    int64_t jump_threshold_203504;
    int64_t q_threshold_203505;
    struct memblock mem_out_221030;
    
    mem_out_221030.references = NULL;
    
    struct memblock mem_out_221031;
    
    mem_out_221031.references = NULL;
    
    struct memblock mem_out_221032;
    
    mem_out_221032.references = NULL;
    
    int ret = 0;
    
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    Y_mem_217285 = in0->mem;
    m_203489 = in0->shape[0];
    n_203490 = in0->shape[1];
    n_p_203492 = in1;
    q_s_203493 = in2;
    q_t_203494 = in3;
    q_l_203495 = in4;
    d_s_203496 = in5;
    d_t_203497 = in6;
    d_l_203498 = in7;
    jump_s_203499 = in8;
    jump_t_203500 = in9;
    jump_l_203501 = in10;
    n_inner_203502 = in11;
    n_outer_203503 = in12;
    jump_threshold_203504 = in13;
    q_threshold_203505 = in14;
    if (!(m_203489 == in0->shape[0] && n_203490 == 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_221030, &mem_out_221031,
                                &mem_out_221032, Y_mem_217285, m_203489,
                                n_203490, n_p_203492, q_s_203493, q_t_203494,
                                q_l_203495, d_s_203496, d_t_203497, d_l_203498,
                                jump_s_203499, jump_t_203500, jump_l_203501,
                                n_inner_203502, n_outer_203503,
                                jump_threshold_203504, q_threshold_203505);
        if (ret == 0) {
            assert((*out0 =
                    (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d))) !=
                NULL);
            (*out0)->mem = mem_out_221030;
            (*out0)->shape[0] = m_203489;
            (*out0)->shape[1] = n_203490;
            assert((*out1 =
                    (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d))) !=
                NULL);
            (*out1)->mem = mem_out_221031;
            (*out1)->shape[0] = m_203489;
            (*out1)->shape[1] = n_203490;
            assert((*out2 =
                    (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d))) !=
                NULL);
            (*out2)->mem = mem_out_221032;
            (*out2)->shape[0] = m_203489;
            (*out2)->shape[1] = n_203490;
        }
    }
    lock_unlock(&ctx->lock);
    return ret;
}
  
